Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: treesitter support for swift #428

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ In addition, you will need to have either Treesitter or a working LSP client. Yo
- snakemake
- solidity
- starlark
- swift
- teal
- toml
- tsx
Expand Down
86 changes: 86 additions & 0 deletions queries/swift/aerial.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
(protocol_declaration
name: _ @name
(#set! "kind" "Interface")) @symbol

(class_declaration
"enum"
.
name: _ * @name
(#set! "kind" "Enum")) @symbol

(class_declaration
"struct"
.
name: _ * @name
(#set! "kind" "Struct")) @symbol

(class_declaration
name: _ * @name
(#set! "kind" "Class")) @symbol

(init_declaration
name: "init" @name
(#set! "kind" "Constructor")) @symbol

(deinit_declaration
"deinit" @name
(#set! "kind" "Constructor")) @symbol

(enum_class_body
(function_declaration
name: _ @name
(#set! "kind" "Method")) @symbol)

(class_body
(function_declaration
name: _ @name
(#set! "kind" "Method")) @symbol)

(enum_class_body
(property_declaration
name: _ @name
computed_value: _
(#set! "kind" "Method")) @symbol)

(class_body
(property_declaration
name: _ @name
computed_value: _
(#set! "kind" "Method")) @symbol)

(enum_class_body
(property_declaration
name: _ @name
!computed_value
(#set! "kind" "Property")) @symbol)

(class_body
(property_declaration
name: _ @name
!computed_value
(#set! "kind" "Property")) @symbol)

(property_declaration
name: _ @name
computed_value: _
(#set! "kind" "Function")) @symbol

(property_declaration
name: _ @name
!computed_value
(#set! "kind" "Variable")) @symbol


(protocol_function_declaration
name: _ @name
(#set! "kind" "Method")) @symbol

(protocol_property_declaration
name: (pattern
bound_identifier: _ @name)
(#set! "kind" "Property")) @symbol

(function_declaration
name: _ @name
(#set! "kind" "Function")) @symbol

Loading
Loading