Skip to content
Open
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
35 changes: 35 additions & 0 deletions languages/ruby/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,38 @@
(interpolation
"#{" @punctuation.special
"}" @punctuation.special) @embedded


; fun function definitions
((call
method: (identifier) @methodName @keyword (#eq? @methodName "fun")
arguments: (argument_list
(pair
key: [
(call
method: (identifier) @function.method)
(identifier) @function.method
(constant) @function.method
]
value: [
[
(call)
(identifier)
(constant)
]
]
)
)
))

; fun keywords (void and never)
((call
method: (identifier) @keyword
arguments: (argument_list
(pair
value: (identifier) @constant.builtin
)
)
)
(#eq? @keyword "fun")
(#any-of? @constant.builtin "void" "never"))
91 changes: 91 additions & 0 deletions languages/ruby/outline.scm
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,94 @@
)
)
)

; fun method signature definitions
(call
method: (identifier) @methodName @context (#eq? @methodName "fun")
arguments: (argument_list
(pair
key: [
(call
receiver: (_) @context
operator: "." @context
method: (identifier) @name
)
(call
receiver: (_) @context
operator: "." @context
method: (identifier) @name
arguments: (argument_list) @name
)
(call
method: (identifier) @name
)
(call
method: (identifier) @name
arguments: (argument_list) @name
)
(identifier) @name
]
"=>" @name
value: [
(call
method: (identifier) @name
)
(call
method: (identifier) @name
arguments: (argument_list) @name
)
(identifier) @name
(constant) @name
]
)
)
block: (do_block)
) @item

; fun method signature definitions with modifier
(call
method: (identifier) @context
arguments: (argument_list
(call
method: (identifier) @methodName @context (#eq? @methodName "fun")
arguments: (argument_list
(pair
key: [
(call
receiver: (_) @context
operator: "." @context
method: (identifier) @name
)
(call
receiver: (_) @context
operator: "." @context
method: (identifier) @name
arguments: (argument_list) @name
)
(call
method: (identifier) @name
)
(call
method: (identifier) @name
arguments: (argument_list) @name
)
(identifier) @name
]
"=>" @name
value: [
(call
method: (identifier) @name
)
(call
method: (identifier) @name
arguments: (argument_list) @name
)
(identifier) @name
(constant) @name
]
)
)
)
)
block: (do_block)
) @item
6 changes: 6 additions & 0 deletions languages/ruby/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@
(method
body: (_)? @function.inside) @function.around

(call
method: (identifier) @methodName (#eq? @methodName "fun")
block: (do_block
body: (_)? @function.inside
)) @function.around

; Comments
(comment) @comment.inside
Loading