aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhạm Huy Hoàng <hoangtun0810@gmail.com>2024-03-03 23:56:32 +0900
committer再生花 <hoangtun0810@gmail.com>2024-03-04 00:05:45 +0900
commit63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1 (patch)
treec3eb2cf84a9b7eea316e9d4139f94bf75c31b2d4
parentfix(comment): remove duplicate 'FIXME' (diff)
downloadnvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.tar
nvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.tar.gz
nvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.tar.bz2
nvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.tar.lz
nvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.tar.xz
nvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.tar.zst
nvim-treesitter-63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1.zip
feat(swift): add will/didSet indent
Fixes CI error in PR.6237
-rw-r--r--lockfile.json2
-rw-r--r--queries/swift/indents.scm3
-rw-r--r--tests/indent/swift/declarations.swift3
-rw-r--r--tests/indent/swift_spec.lua5
4 files changed, 10 insertions, 3 deletions
diff --git a/lockfile.json b/lockfile.json
index 5f2257f34..22b858fd5 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -663,7 +663,7 @@
"revision": "04a126d9210def99f06d9ab84a255110b862d47c"
},
"swift": {
- "revision": "fc00cbb460b40228b30f322b5a34ea0e8f35a9f8"
+ "revision": "8a87eebcc3ca249e1eeb65b226e81b7e711eea7a"
},
"sxhkdrc": {
"revision": "440d5f913d9465c9c776a1bd92334d32febcf065"
diff --git a/queries/swift/indents.scm b/queries/swift/indents.scm
index 264e9aaef..33d39b025 100644
--- a/queries/swift/indents.scm
+++ b/queries/swift/indents.scm
@@ -32,6 +32,9 @@
(array_literal) ; [ foo, bar ]
(dictionary_literal) ; [ foo: bar, x: y ]
(lambda_literal)
+ (willset_didset_block)
+ (willset_clause)
+ (didset_clause)
] @indent.begin
; @something(...)
diff --git a/tests/indent/swift/declarations.swift b/tests/indent/swift/declarations.swift
index a6f576ef2..d4bc6e054 100644
--- a/tests/indent/swift/declarations.swift
+++ b/tests/indent/swift/declarations.swift
@@ -16,6 +16,9 @@ class EquilateralTriangle: NamedShape {
var perimeter: Double {
willSet {
}
+ didSet {
+
+ }
}
@funcattr
diff --git a/tests/indent/swift_spec.lua b/tests/indent/swift_spec.lua
index 6ba0d2cf0..5f07ee825 100644
--- a/tests/indent/swift_spec.lua
+++ b/tests/indent/swift_spec.lua
@@ -15,7 +15,8 @@ describe("indent Swift:", function()
run:new_line("declarations.swift", { on_line = 6, text = "var x = 1", indent = 2 })
run:new_line("declarations.swift", { on_line = 12, text = "var textInsideInit = true", indent = 4 })
run:new_line("declarations.swift", { on_line = 17, text = "var textInsideWillSet = 1", indent = 6 })
- run:new_line("declarations.swift", { on_line = 22, text = "var textInsideOverrideFunc", indent = 4 })
- run:new_line("declarations.swift", { on_line = 28, text = "var InsideProtocol: String { get }", indent = 2 })
+ run:new_line("declarations.swift", { on_line = 20, text = "var textInsideDidSet = 1", indent = 6 })
+ run:new_line("declarations.swift", { on_line = 25, text = "var textInsideOverrideFunc", indent = 4 })
+ run:new_line("declarations.swift", { on_line = 31, text = "var InsideProtocol: String { get }", indent = 2 })
end)
end)