@ -33,6 +33,26 @@
( type_definition
( type_definition
name: ( type_identifier ) @type )
name: ( type_identifier ) @type )
( full_enum_case
name: ( identifier ) @type )
( simple_enum_case
name: ( identifier ) @type )
;; val/var definitions/declarations
( val_definition
pattern: ( identifier ) @variable )
( var_definition
pattern: ( identifier ) @variable )
( val_declaration
name: ( identifier ) @variable )
( var_declaration
name: ( identifier ) @variable )
; method definition
; method definition
( class_definition
( class_definition
@ -48,7 +68,7 @@
( function_definition
( function_definition
name: ( identifier ) @function . method ) ) )
name: ( identifier ) @function . method ) ) )
; imports
; imports /exports
( import_declaration
( import_declaration
path: ( identifier ) @namespace )
path: ( identifier ) @namespace )
@ -58,7 +78,15 @@
path: ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
path: ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
( ( stable_identifier ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
( ( stable_identifier ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
( ( import_selectors ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
( export_declaration
path: ( identifier ) @namespace )
( ( stable_identifier ( identifier ) @namespace ) )
( ( export_declaration
path: ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
( ( stable_identifier ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
( ( namespace_selectors ( identifier ) @type ) ( # match? @type "^[A-Z]" ) )
; method invocation
; method invocation
@ -66,10 +94,17 @@
( call_expression
( call_expression
function: ( identifier ) @function )
function: ( identifier ) @function )
( call_expression
function: ( operator_identifier ) @function )
( call_expression
( call_expression
function: ( field_expression
function: ( field_expression
field: ( identifier ) @function . method ) )
field: ( identifier ) @function . method ) )
( call_expression
function: ( field_expression
field: ( operator_identifier ) @function . method ) )
( ( call_expression
( ( call_expression
function: ( identifier ) @variable . other . member )
function: ( identifier ) @variable . other . member )
( # match? @variable . other . member "^[A-Z]" ) )
( # match? @variable . other . member "^[A-Z]" ) )
@ -87,9 +122,15 @@
( function_definition
( function_definition
name: ( identifier ) @function )
name: ( identifier ) @function )
( function_definition
name: ( operator_identifier ) @function )
( parameter
( parameter
name: ( identifier ) @variable . parameter )
name: ( identifier ) @variable . parameter )
( binding
name: ( identifier ) @variable . parameter )
; expressions
; expressions
@ -118,29 +159,50 @@
( interpolation "$" @punctuation . special )
( interpolation "$" @punctuation . special )
; annotations
( annotation ) @attribute
;; keywords
;; keywords
;; storage in TextMate scope lingo means field or type
[
[
( opaque_modifier )
( infix_modifier )
( transparent_modifier )
( open_modifier )
"abstract"
"abstract"
"case"
"class"
"extends"
"final"
"final"
"finally"
;; `forSome` existential types not implemented yet
"implicit"
"implicit"
"lazy"
"lazy"
;; `macro` not implemented yet
"object"
"override"
"override"
"package"
"private"
"private"
"protected"
"protected"
"sealed"
"sealed"
] @keyword . storage . modifier
[
"class"
"enum"
"extension"
"given"
"object"
"package"
"trait"
"trait"
"type"
"type"
"val"
"val"
"var"
"var"
] @keyword . storage . type
[
"as"
"derives"
"end"
"extends"
;; `forSome` existential types not implemented yet
;; `macro` not implemented yet
;; `throws`
"using"
"with"
"with"
] @keyword
] @keyword
@ -152,33 +214,36 @@
"new" @keyword . operator
"new" @keyword . operator
[
[
"else"
"case"
"if"
"catch"
"match"
"else"
"try"
"finally"
"catch"
"if"
"throw"
"match"
"then"
"throw"
"try"
] @keyword . control . conditional
] @keyword . control . conditional
[
[
"("
"("
")"
")"
"["
"["
"]"
"]"
"{"
"{"
"}"
"}"
] @punctuation . bracket
] @punctuation . bracket
[
[
"."
"."
","
","
] @punctuation . delimiter
] @punctuation . delimiter
[
[
"do"
"do"
"for"
"for"
"while"
"while"
"yield"
"yield"
] @keyword . control . repeat
] @keyword . control . repeat
"def" @keyword . function
"def" @keyword . function
@ -191,6 +256,8 @@
"import" @keyword . control . import
"import" @keyword . control . import
"export" @keyword . control . import
"return" @keyword . control . return
"return" @keyword . control . return
( comment ) @comment
( comment ) @comment
@ -201,3 +268,5 @@
( case_clause ( "case" ) @keyword . control . conditional ) )
( case_clause ( "case" ) @keyword . control . conditional ) )
( identifier ) @variable
( identifier ) @variable
( operator_identifier ) @operator