1

Update generated neovim config

This commit is contained in:
2024-08-15 14:28:54 +02:00
parent 07409c223d
commit 25cfcf2941
3809 changed files with 351157 additions and 0 deletions

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,5 @@
([
(line_comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((junk) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,5 @@
([
(bracket_comment)
(line_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,5 @@
([
(comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1 @@
(section) @fold

View File

@ -0,0 +1,56 @@
(comment) @comment @spell
; consistency with toml and ini
(section
(section_name) @type)
(character_choice
(character) @constant)
(character_range
start: (character) @constant
end: (character) @constant)
[
"["
"]"
"{"
"}"
] @punctuation.bracket
[
","
".."
(path_separator)
] @punctuation.delimiter
[
"-"
"="
(negation)
] @operator
[
(wildcard_characters)
(wildcard_any_characters)
(wildcard_single_character)
] @character.special
(escaped_character) @string.escape
(pair
key: (identifier) @property
value: (_) @string)
(boolean) @boolean
(integer) @number
(unset) @constant.builtin
[
(spelling_language)
(indent_style)
(end_of_line)
(charset)
] @string.special

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,14 @@
((function_call_expr) @_fn
(#not-has-parent? @_fn parenthesized_expr)) @fold
[
(case_of_branch)
(case_of_expr)
(value_declaration)
(type_declaration)
(type_alias_declaration)
(list_expr)
(record_expr)
(parenthesized_expr)
(import_clause)+
] @fold

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((fsh_comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,5 @@
([
(comment)
(afx_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment_statement) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,11 @@
[
(typeGroupSpec)
(typeSingleSpec)
(typeStruct)
(serviceSpec)
(serviceBody)
(importStatement)
(serviceServerSpec)
(infoStatement)
(structType)
] @fold

View File

@ -0,0 +1,79 @@
; Key Symbol
"=" @operator
[
"."
","
":"
";"
] @punctuation.delimiter
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
; Keywords
[
"syntax"
"info"
"service"
] @keyword
"import" @keyword.import
"returns" @keyword.return
[
"type"
"struct"
] @keyword.type
[
"@doc"
"@handler"
"@server"
] @attribute
; Service
(serviceName) @type
; Httpmethod
(HTTPMETHOD) @keyword.operator
; Field
(fieldType) @type.builtin
(fieldName) @variable.member
(anonymousField) @variable.member
; Functions
(handlerValue) @function.method
; Strings
(VALUE) @string
(tag) @string.documentation
(PATH) @string.special.path
; Comments
(comment) @comment @spell
(key) @variable.member
(identValue) @string
(DURATION) @number
(NUMBER) @number
; Struct
(structNameId) @type
(body) @type

View File

@ -0,0 +1,15 @@
[
(importGroup)
(typeGroupSpec)
(structType)
(infoStatement)
(serviceServerSpec)
(serviceSpec)
] @indent.begin
[
")"
"}"
] @indent.branch @indent.end
(comment) @indent.ignore

View File

@ -0,0 +1,3 @@
; Inject comment language for goctl
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,8 @@
[
(if_action)
(range_action)
(block_action)
(with_action)
(define_action)
(comment)
] @fold

View File

@ -0,0 +1,12 @@
[
(if_action)
(range_action)
(block_action)
(with_action)
(define_action)
] @local.scope
(variable_definition
variable: (variable) @local.definition.var)
(variable) @local.reference

View File

@ -0,0 +1,5 @@
([
(comment)
(heredoc)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1 @@
; inherits: gotmpl

View File

@ -0,0 +1 @@
; inherits: gotmpl

View File

@ -0,0 +1,2 @@
((lineComment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,10 @@
";" @indent.end
"}" @indent.branch
(definition) @indent.begin
[
(preproc_define)
(preproc_include)
] @indent.ignore

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1 @@
(block) @fold

View File

@ -0,0 +1,59 @@
(comment) @comment @spell
(value) @variable
[
(location_modifier)
"="
] @operator
[
(keyword)
"location"
] @keyword
[
"if"
"map"
] @keyword.conditional
(boolean) @boolean
[
(auto)
(constant)
(level)
(connection_method)
(var)
(condition)
] @variable.builtin
[
(file)
(mask)
] @string.special.path
[
(string_literal)
(quoted_string_literal)
] @string
(directive
(variable
(keyword) @variable.parameter))
(location_route) @string.special
";" @punctuation.delimiter
[
(numeric_literal)
(time)
(size)
(cpumask)
] @number
[
"{"
"}"
] @punctuation.bracket

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,75 @@
[
(list_expression)
(indented_string_expression)
(let_expression)
(if_expression)
(binding)
(parenthesized_expression)
] @indent.begin
((attrset_expression) @indent.begin
(#not-has-parent? @indent.begin if_expression))
((rec_attrset_expression) @indent.begin
(#not-has-parent? @indent.begin if_expression))
((binding
"=" @indent.begin)
(#set! indent.immediate 1))
(binding
";" @indent.end)
(parenthesized_expression
")" @indent.branch @indent.end)
(attrset_expression
"}" @indent.branch @indent.end)
(rec_attrset_expression
"}" @indent.branch @indent.end)
(list_expression
"]" @indent.branch @indent.dedent)
(indented_string_expression
"''" @indent.branch @indent.end .)
[
"else"
"in"
] @indent.branch
(let_expression
body: (_) @indent.end @indent.dedent)
(string_fragment) @indent.ignore @indent.auto
(if_expression
condition: (_) @indent.auto)
alternative: (if_expression) @indent.dedent
(interpolation) @indent.begin @indent.dedent
(interpolation
"}" @indent.end @indent.branch)
(ERROR
"then" @indent.begin)
(ERROR
"then"
.
(formals) @indent.begin)
(ERROR
"then"
.
(formals
"}" @indent.branch @indent.end))
(ERROR
"let") @indent.begin
(comment) @indent.ignore

View File

@ -0,0 +1,13 @@
[
(expandable_here_string_literal)
(verbatim_here_string_characters)
(function_statement)
(param_block)
(script_block_expression)
(statement_block)
(switch_body)
(array_expression)
(hash_literal_expression)
(class_statement)
(class_method_definition)
] @fold

View File

@ -0,0 +1,334 @@
; Punctuation
;------------
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(hash_literal_expression
[
"@{"
"}"
] @punctuation.special)
(array_expression
[
"@("
")"
] @punctuation.special)
[
"."
"::"
","
";"
(empty_statement)
(command_argument_sep)
] @punctuation.delimiter
; Keywords
;---------
[
"if"
"elseif"
"else"
"switch"
] @keyword.conditional
[
"foreach"
"for"
"while"
"do"
"until"
"in"
"break"
"continue"
] @keyword.repeat
[
"function"
"filter"
"workflow"
"exit"
"trap"
"param"
"inlinescript"
] @keyword.function
"return" @keyword.return
[
"class"
"enum"
] @keyword.type
[
"data"
(class_attribute)
] @keyword.modifier
[
"throw"
"try"
"catch"
"finally"
] @keyword.exception
[
"parallel"
"sequence"
] @keyword.coroutine
[
"param"
"dynamicparam"
"begin"
"process"
"end"
] @keyword
; Operators
;----------
[
"-and"
"-or"
"-xor"
"-band"
"-bor"
"-bxor"
"+"
"-"
"/"
"\\"
"%"
"*"
".."
"-not"
"-bnot"
"!"
"="
"|"
(pre_increment_expression)
(pre_decrement_expression)
(post_increment_expression)
(post_decrement_expression)
(comparison_operator)
(assignement_operator)
] @operator
; Generic types
;--------------
(string_literal) @string
(integer_literal) @number
(real_literal) @number.float
(variable) @variable
((variable) @variable.builtin
(#any-of? @variable.builtin
"$$" "$?" "$^" "$_" "$args" "$ConsoleFileName" "$EnabledExperimentalFeatures" "$Error" "$Event"
"$EventArgs" "$EventSubscriber" "$ExecutionContext" "$false" "$foreach" "$HOME" "$Host" "$input"
"$IsCoreCLR" "$IsLinux" "$IsMacOS" "$IsWindows" "$LASTEXITCODE" "$Matches" "$MyInvocation"
"$NestedPromptLevel" "$null" "$PID" "$PROFILE" "$PSBoundParameters" "$PSCmdlet" "$PSCommandPath"
"$PSCulture" "$PSDebugContext" "$PSEdition" "$PSHOME" "$PSItem" "$PSScriptRoot" "$PSSenderInfo"
"$PSUICulture" "$PSVersionTable" "$PWD" "$Sender" "ShellId" "$StackTrace" "$switch" "$this"
"$true"))
((variable) @variable.builtin
(#lua-match? @variable.builtin "^\$env:"))
(data_name
(simple_name) @constant)
(comment) @comment @spell
((program
.
(comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))
; Booleans
;---------
([
(generic_token)
(command_name)
(variable)
(command)
] @boolean
(#any-of? @boolean "True" "False" "$true" "$false"))
; switch -regex
;--------------
(switch_statement
(switch_parameters
(switch_parameter) @_parameter)
(switch_body
(switch_clauses
(switch_clause
(switch_clause_condition
(string_literal) @string.regexp))))
(#eq? @_parameter "-regex")
(#offset! @string.regexp 0 1 0 -1))
; Multiline strings
;------------------
([
(verbatim_here_string_characters)
(expandable_here_string_literal)
] @markup.raw.block
(#offset! @markup.raw.block 0 2 0 -2))
; Type references and definitions
;--------------------------------
(type_spec
(type_name) @type)
(class_statement
(simple_name) @type)
(type_spec
(type_name) @type.builtin
(#any-of? @type.builtin
"bool" "Boolean" "System.Boolean" "char" "Char" "System.Char" "string" "String" "System.String"
"int" "Int32" "System.Int32" "long" "Int64" "System.Int64" "byte" "Byte" "System.Byte" "float"
"Single" "System.Single" "double" "Double" "System.Double" "decimal" "Decimal" "System.Decimal"
"array" "Array" "System.Array" "regex" "Regex" "System.Text.RegularExpressions.Regex" "ref"
"Management.Automation.PSReference" "System.Management.Automation.PSReference" "scriptblock"
"Management.Automation.ScriptBlock" "System.Management.Automation.ScriptBlock" "datetime"
"DateTime" "System.DateTime" "enum" "Enum" "System.Enum" "IO.DirectoryInfo"
"System.IO.DirectoryInfo" "IO.FileAttributes" "System.IO.FileAttributes" "IO.FileInfo"
"System.IO.FileInfo" "IO.Path" "System.IO.Path" "Text.RegularExpressions.RegexOptions"
"System.Text.RegularExpressions.RegexOptions" "Math" "System.Math" "PSObject" "System.PSObject"
"Object" "System.Object" "ValueType" "System.ValueType" "Hashtable"
"System.Collections.Hashtable" "Collections.Stack" "System.Collections.Generic.Stack"
"Collections.Dictionary" "System.Collections.Dictionary" "Collections.DictionaryEntry"
"System.Collections.DictionaryEntry" "Collections.ArrayList" "System.Collections.ArrayList"
"Management.Automation.SwitchParameter" "System.Management.Automation.SwitchParameter"
"Management.Automation.ActionPreference" "System.Management.Automation.ActionPreference"
"Management.Automation.ConfirmImpact" "System.Management.Automation.ConfirmImpact"
"Management.Automation.CommandInfo" "System.Management.Automation.CommandInfo"
"Management.Automation.ProviderInfo" "System.Management.Automation.ProviderInfo"
"Management.Automation.PSDriveInfo" "System.Management.Automation.PSDriveInfo"
"Management.Automation.PSVariable" "System.Management.Automation.PSVariable"
"Management.Automation.AliasInfo" "System.Management.Automation.AliasInfo"
"Management.Automation.PathInfo" "System.Management.Automation.PathInfo"
"Management.Automation.PathInfoStack" "System.Management.Automation.PathInfoStack"
"Management.Automation.ApplicationInfo" "System.Management.Automation.ApplicationInfo"
"Management.Automation.CmdletInfo" "System.Management.Automation.CmdletInfo"
"Management.Automation.ExternalScriptInfo" "System.Management.Automation.ExternalScriptInfo"
"Management.Automation.FunctionInfo" "System.Management.Automation.FunctionInfo"
"Management.Automation.CommandTypes" "System.Management.CommandTypes"
"Management.Automation.ScopedItemOptions" "System.Management.Automation.ScopedItemOptions"
"Management.Automation.PSTypeName" "System.Management.Automation.PSTypeName"
"Management.Automation.ParameterMetadata" "System.Management.Automation.ParameterMetadata"
"Management.Automation.CommandParameterSetInfo"
"System.Management.Automation.CommandParameterSetInfo"
"Management.Automation.SessionStateEntryVisibility"
"System.Management.Automation.SessionStateEntryVisibility" "Management.Automation.FilterInfo"
"System.Management.Automation.FilterInfo" "Management.Automation.ModuleType"
"System.Management.Automation.ModuleType" "Management.Automation.PSModuleInfo"
"System.Management.Automation.PSModuleInfo" "Management.Automation.PSCustomObject"
"System.Management.Automation.PSCustomObject" "Management.Automation.PSScriptCmdlet"
"System.Management.Automation.PSScriptCmdlet" "Management.Automation.ErrorRecord"
"System.Management.Automation.ErrorRecord" "Management.Automation.PSCredential"
"System.Management.Automation.PSCredential" "Management.Automation.PSMethod"
"System.Management.Automation.PSMethod")
)
; Function definitions
;---------------------
(function_statement
(function_name) @function)
; Classes, fields and methods definitions
;----------------------------------------
(class_property_definition
(variable) @variable.member)
(class_method_definition
(simple_name) @function.method)
(class_statement
(simple_name) @_class_name
(class_method_definition
(simple_name) @constructor)
(#eq? @constructor @_class_name))
(key_expression) @property
; Functions, methods calls and properties access
;--------------------------
(command_invokation_operator) @operator
(invokation_expression
(member_name) @function.call)
(invokation_expression
(member_name) @constructor
(#eq? @constructor "new"))
(member_access
(member_name
[
(simple_name)
(variable)
] @variable.member))
; Commands execution
;-------------------
(command
command_name: (command_name) @function.call)
(command
command_name: (command_name) @function.builtin
(#any-of? @function.builtin
; Locations & Paths
"cd" "cd.." "cd\\" "cd~" "help" "Get-Location" "Pop-Location" "Push-Location" "Set-Location"
"Convert-Path" "Join-Path" "Resolve-Path" "Split-Path" "Test-Path"
; Files & Directories
"Clear-Item" "Clear-ItemProperty" "Copy-Item" "Copy-ItemProperty" "Get-Item" "Get-ItemProperty"
"Get-ItemPropertyValue" "Invoke-Item" "Move-Item" "Move-ItemProperty" "New-Item"
"New-ItemProperty" "Remove-Item" "Remove-ItemProperty" "Rename-Item" "Rename-ItemProperty"
"Set-Item" "Set-ItemProperty"
; Aliases
"New-Alias" "Get-Alias" "Set-Alias" "Remove-Alias" "Import-Alias" "Export-Alias"
; Host (prompt)
"prompt" "cls" "echo" "Clear-Host" "Get-Host" "Out-Host" "Read-Host" "Write-Host" "Out-String"
; Expressions
"Invoke-Expression"
; Objects
"Compare-Object" "ForEach-Object" "Group-Object" "Measure-Object" "New-Object" "Select-Object"
"Sort-Object" "Tee-Object" "Where-Object"
; Modules
"Export-ModuleMember" "Find-Module" "Get-Module" "Import-Module" "Install-Module" "New-Module"
"New-ModuleManifest" "Publish-Module" "Remove-Module" "Save-Module" "Test-ModuleManifest"
"Uninstall-Module" "Update-Module" "Update-ModuleManifest"))
; Parameters and call arguments
;------------------------------
(command_elements
(generic_token) @variable.parameter)
(switch_parameter) @variable.parameter.builtin
(command_parameter) @variable.parameter.builtin
(script_parameter
(variable) @variable.parameter)
(class_method_parameter
(variable) @variable.parameter)
; Document encoding
;------------------
((program
.
(comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "Encoding$"))

View File

@ -0,0 +1,41 @@
(function_statement
"}" @indent.branch) @indent.begin
(param_block
[
"param"
"("
")"
] @indent.branch) @indent.begin
(script_block_expression
"}" @indent.branch) @indent.begin
(statement_block
"}" @indent.branch) @indent.begin
(switch_body
"}" @indent.branch) @indent.begin
(array_expression
")" @indent.branch) @indent.begin
(hash_literal_expression
"}" @indent.branch) @indent.begin
(class_statement
"}" @indent.branch) @indent.begin
(class_method_definition
"}" @indent.branch) @indent.begin
[
"}"
")"
] @indent.end
[
(comment)
(string_literal)
(ERROR)
] @indent.auto

View File

@ -0,0 +1,27 @@
; comments and block-comments
((comment) @injection.content
(#set! injection.language "comment"))
; dynamic invocation like & "$env:ChocolateyInstall\bin\choco.exe"
(command
(command_invokation_operator) @_operator
(command_name_expr
(string_literal) @injection.content)
(#eq? @_operator "&")
(#set! injection.language "powershell")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children))
; switch -regex
(switch_statement
(switch_parameters
(switch_parameter) @_parameter)
(switch_body
(switch_clauses
(switch_clause
(switch_clause_condition
(string_literal) @injection.content))))
(#eq? @_parameter "-regex")
(#set! injection.language "regex")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children))

View File

@ -0,0 +1,85 @@
; Scopes
;-------
(class_statement) @local.scope
(class_method_definition) @local.scope
(statement_block) @local.scope
(function_statement) @local.scope
; Definitions
;------------
(class_statement
(simple_name) @local.definition.type
(#set! definition.var.scope "parent"))
(class_property_definition
(variable) @local.definition.field
(#set! definition.var.scope "parent"))
(class_method_definition
(simple_name) @local.definition.method
(#set! definition.var.scope "parent"))
(function_statement
(function_name) @local.definition.function
(#set! definition.var.scope "parent"))
; function, script block parameters
(parameter_list
(script_parameter
(attribute_list
(attribute
(type_literal
(type_spec) @local.definition.associated)))
(variable) @local.definition.parameter))
; variable assignment
(assignment_expression
(left_assignment_expression
(logical_expression
(bitwise_expression
(comparison_expression
(additive_expression
(multiplicative_expression
(format_expression
(range_expression
(array_literal_expression
(unary_expression
(variable) @local.definition.var)))))))))))
; variable with type assignment
(assignment_expression
(left_assignment_expression
(logical_expression
(bitwise_expression
(comparison_expression
(additive_expression
(multiplicative_expression
(format_expression
(range_expression
(array_literal_expression
(unary_expression
(expression_with_unary_operator
(cast_expression
(type_literal
(type_spec) @local.definition.associated)
(unary_expression
(variable) @local.definition.var))))))))))))))
; data sections
(data_name
(simple_name) @local.definition.var)
; References
;-----------
(variable) @local.reference
(command_name) @local.reference
(invokation_expression
(variable) @_variable
(member_name
(simple_name) @local.reference)
(#eq? @_variable "$this"))

View File

@ -0,0 +1,5 @@
([
(comment)
(developer_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1 @@
; inherits: prolog

View File

@ -0,0 +1,4 @@
; inherits: prolog
(probability_label
_ @attribute)

View File

@ -0,0 +1 @@
; inherits: prolog

View File

@ -0,0 +1 @@
; inherits: prolog

View File

@ -0,0 +1,6 @@
[
(directive_term)
(clause_term)
(arg_list)
(list_notation)
] @fold

View File

@ -0,0 +1,43 @@
(comment) @comment @spell
(atom) @constant
((atom) @boolean
(#any-of? @boolean "true" "false"))
(functional_notation
function: (atom) @function.call)
(integer) @number
(float_number) @number.float
(directive_head) @operator
(operator_notation
operator: _ @operator)
[
(open)
(open_ct)
(close)
(open_list)
"|"
(close_list)
(open_curly)
(close_curly)
] @punctuation.bracket
[
(arg_list_separator)
(comma)
(end)
(list_notation_separator)
] @punctuation.delimiter
(operator_notation
operator: (semicolon) @punctuation.delimiter)
(double_quoted_list_notation) @string
(variable_term) @variable

View File

@ -0,0 +1,16 @@
(directive_term) @indent.zero
(clause_term) @indent.zero
(functional_notation
(atom)
(open_ct) @indent.begin
(close) @indent.end)
(list_notation
(open_list) @indent.begin
(close_list) @indent.end)
(curly_bracketed_notation
(open_curly) @indent.begin
(close_curly) @indent.end)

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,137 @@
(type_identifier) @type
(identifier) @variable
[
(primitive_type)
(alph_token_id)
] @type.builtin
(var_declaration) @variable
(struct_field
(identifier) @variable.member)
(arg_def
(identifier) @variable.parameter)
(event_field
(identifier) @variable.parameter)
(struct_constructor_field
(identifier) @variable.parameter)
[
(hex_num)
(integer)
(typed_num)
] @number
[
(bool)
(bytes)
(address)
] @constant.builtin
(func_id
[
(identifier)
"!"
] @function)
(annotation
[
"@"
(identifier)
] @attribute)
(map_def
(identifier) @variable.parameter)
"fn" @keyword.function
[
"Contract"
"TxScript"
"Interface"
"AssetScript"
"struct"
"enum"
"event"
"mapping"
] @keyword.type
[
"pub"
"Abstract"
(mutable)
] @keyword.modifier
[
"while"
"for"
] @keyword.repeat
"return" @keyword.return
[
"if"
"else"
] @keyword.conditional
[
"const"
"let"
"emit"
"extends"
"embeds"
"implements"
] @keyword
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
"."
","
":"
";"
] @punctuation.delimiter
[
"="
"->"
(op_byte_vec_add)
(op_add)
(op_sub)
(op_mul)
(op_exp)
(op_mod_exp)
(op_div)
(op_mod)
(op_mod_add)
(op_mod_sub)
(op_mod_mul)
(op_shl)
(op_shr)
(op_bit_and)
(op_xor)
(op_bit_or)
(op_eq)
(op_ne)
(op_lt)
(op_le)
(op_gt)
(op_ge)
(op_and)
(op_or)
(op_not)
] @operator
(line_comment) @comment @spell

View File

@ -0,0 +1,2 @@
((line_comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,12 @@
[
(block)
(function)
(module_declaration)
(type_declaration)
(external_declaration)
(call_expression)
(switch_expression)
(parenthesized_expression)
(record)
(include_statement)+
] @fold

View File

@ -0,0 +1,335 @@
(comment) @comment @spell
; Identifiers
;------------
; Escaped identifiers like \"+."
((value_identifier) @constant.macro
(#lua-match? @constant.macro "^%.*$"))
(value_identifier) @variable
[
(type_identifier)
(unit_type)
(list)
(list_pattern)
] @type
((type_identifier) @type.builtin
(#any-of? @type.builtin "int" "char" "string" "float" "bool" "unit"))
[
(variant_identifier)
(polyvar_identifier)
] @constructor
(record_type_field
(property_identifier) @property)
(record_field
(property_identifier) @property)
(object
(field
(property_identifier) @property))
(object_type
(field
(property_identifier) @property))
(module_identifier) @module
(member_expression
(property_identifier) @variable.member)
(value_identifier_path
(module_identifier)
(value_identifier) @variable)
(record_pattern
(value_identifier_path
(value_identifier) @variable.member))
(record_pattern
(value_identifier) @variable)
(labeled_argument
label: (value_identifier) @variable.parameter)
; Parameters
;----------------
(list_pattern
(value_identifier) @variable.parameter)
(spread_pattern
(value_identifier) @variable.parameter)
; String literals
;----------------
[
(string)
(template_string)
] @string
(character) @character
(escape_sequence) @string.escape
; Other literals
;---------------
[
(true)
(false)
] @boolean
(number) @number
(polyvar) @constructor
(polyvar_string) @constructor
; Functions
;----------
; parameter(s) in parens
(parameter
(value_identifier) @variable.parameter)
(labeled_parameter
(value_identifier) @variable.parameter)
; single parameter with no parens
(function
parameter: (value_identifier) @variable.parameter)
(parameter
(tuple_pattern
(tuple_item_pattern
(value_identifier) @variable.parameter)))
(parameter
(array_pattern
(value_identifier) @variable.parameter))
(parameter
(record_pattern
(value_identifier) @variable.parameter))
; function identifier in let binding
(let_binding
pattern: (value_identifier) @function
body: (function))
; function calls
(call_expression
function: (value_identifier_path
(value_identifier) @function.method.call .))
(call_expression
function: (value_identifier) @function.call)
; highlight the right-hand side of a pipe operator as a function call
(pipe_expression
(value_identifier) @function.call .)
(pipe_expression
(value_identifier_path
(value_identifier) @function.method.call .) .)
; Meta
;-----
(decorator_identifier) @attribute
(extension_identifier) @keyword
"%" @keyword
; Misc
;-----
(polyvar_type_pattern
"#" @constructor)
[
"include"
"open"
] @keyword.import
[
"private"
"mutable"
"rec"
] @keyword.modifier
"type" @keyword.type
[
"and"
"with"
"as"
] @keyword.operator
[
"export"
"external"
"let"
"module"
"assert"
"await"
"lazy"
"constraint"
] @keyword
"await" @keyword.coroutine
(function
"async" @keyword.coroutine)
(module_unpack
"unpack" @keyword)
[
"if"
"else"
"switch"
"when"
] @keyword.conditional
[
"exception"
"try"
"catch"
] @keyword.exception
(call_expression
function: (value_identifier) @keyword.exception
(#eq? @keyword.exception "raise"))
[
"for"
"in"
"to"
"downto"
"while"
] @keyword.repeat
[
"."
","
"|"
":"
] @punctuation.delimiter
[
"++"
"+"
"+."
"-"
"-."
"*"
"**"
"*."
"/."
"<="
"=="
"==="
"!"
"!="
"!=="
">="
"&&"
"||"
"="
":="
"->"
"|>"
":>"
"+="
"=>"
(uncurry)
] @operator
; Explicitly enclose these operators with binary_expression
; to avoid confusion with JSX tag delimiters
(binary_expression
[
"<"
">"
"/"
] @operator)
[
"("
")"
"{"
"}"
"["
"]"
"<"
">"
] @punctuation.bracket
(unit
[
"("
")"
] @constant.builtin)
(template_substitution
"${" @punctuation.special
"}" @punctuation.special) @none
(polyvar_type
[
"["
"[>"
"[<"
"]"
] @punctuation.bracket)
[
"~"
"?"
".."
"..."
] @punctuation.special
(ternary_expression
[
"?"
":"
] @keyword.conditional.ternary)
; JSX
;----------
(jsx_identifier) @tag
(jsx_element
open_tag: (jsx_opening_element
[
"<"
">"
] @tag.delimiter))
(jsx_element
close_tag: (jsx_closing_element
[
"<"
"/"
">"
] @tag.delimiter))
(jsx_self_closing_element
[
"/"
">"
"<"
] @tag.delimiter)
(jsx_fragment
[
">"
"<"
"/"
] @tag.delimiter)
(jsx_attribute
(property_identifier) @tag.attribute)

View File

@ -0,0 +1,36 @@
[
(block)
(record_type)
(record)
(parenthesized_expression)
(call_expression)
(function_type_parameters)
(function)
(switch_match)
(let_declaration)
(jsx_element)
(jsx_fragment)
(jsx_self_closing_element)
(object_type)
] @indent.begin
[
"}"
")"
(jsx_closing_element)
] @indent.branch @indent.end
(jsx_self_closing_element
"/" @indent.branch
">"? @indent.end)
; </> is captured as 3 different anonymous nodes
(jsx_fragment
"<"
"<" @indent.branch)
(jsx_fragment
">"
">" @indent.end)
(comment) @indent.auto

View File

@ -0,0 +1,33 @@
((comment) @injection.content
(#set! injection.language "comment"))
(extension_expression
(extension_identifier) @_name
(#eq? @_name "re")
(expression_statement
(_) @injection.content
(#set! injection.language "regex")))
(extension_expression
(extension_identifier) @_name
(#eq? @_name "raw")
(expression_statement
(_
(_) @injection.content
(#set! injection.language "javascript"))))
(extension_expression
(extension_identifier) @_name
(#eq? @_name "graphql")
(expression_statement
(_
(_) @injection.content
(#set! injection.language "graphql"))))
(extension_expression
(extension_identifier) @_name
(#eq? @_name "relay")
(expression_statement
(_
(_) @injection.content
(#set! injection.language "graphql"))))

View File

@ -0,0 +1,9 @@
(switch_expression) @local.scope
; Definitions
;------------
(type_declaration) @local.definition.type
(let_binding) @local.definition.var
(module_declaration) @local.definition.namespace

View File

@ -0,0 +1,5 @@
([
(comment)
(extra_text)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,7 @@
(comment) @comment @spell
(directive) @property
(value) @string
":" @punctuation.delimiter

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((single_line_comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,5 @@
([
(comment)
(documentation_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,5 @@
([
(comment)
(multiline_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,23 @@
[
(seq_block)
(function_body_declaration)
(task_body_declaration)
(generate_block)
(always_construct)
(property_declaration)
(checker_declaration)
(class_declaration)
(config_declaration)
(covergroup_declaration)
(clocking_declaration)
(interface_declaration)
(module_declaration)
(package_declaration)
(module_instantiation)
(program_declaration)
(specify_block)
(generate_region)
(package_import_declaration)
(text_macro_definition)
(include_compiler_directive)+
] @fold

View File

@ -0,0 +1,595 @@
; Keywords
[
"begin"
"end"
"generate"
"endgenerate"
(module_keyword)
"endmodule"
"program"
"endprogram"
"package"
"endpackage"
"checker"
"endchecker"
"config"
"endconfig"
"pure"
"virtual"
"extends"
"implements"
"super"
(class_item_qualifier)
"parameter"
"localparam"
"defparam"
"assign"
"modport"
"fork"
"join"
"join_none"
"join_any"
"default"
"break"
"tagged"
"extern"
"alias"
"posedge"
"negedge"
"bind"
"expect"
"type"
"void"
"coverpoint"
"cross"
"nettype"
"export"
"force"
"release"
"timeunit"
"timeprecision"
"sequence"
"endsequence"
"property"
"endproperty"
"clocking"
"endclocking"
"covergroup"
"endgroup"
"specify"
"endspecify"
"primitive"
"endprimitive"
"wait"
"wait_order"
"const"
"constraint"
"unique"
"do"
"genvar"
"inside"
"rand"
"continue"
"randc"
"event"
"global"
"ref"
"initial"
(unique_priority)
(bins_keyword)
(always_keyword)
] @keyword
[
"class"
"endclass"
"interface"
"endinterface"
"enum"
"struct"
"union"
"typedef"
] @keyword.type
[
"function"
"endfunction"
"task"
"endtask"
] @keyword.function
"return" @keyword.return
[
"for"
"foreach"
"repeat"
"forever"
"while"
] @keyword.repeat
; for
(loop_generate_construct
(generate_block
[
"begin"
"end"
] @keyword.conditional))
; foreach
(loop_statement
(statement
(statement_item
(seq_block
[
"begin"
"end"
] @keyword.conditional))))
; repeat forever while
(loop_statement
(statement_or_null
(statement
(statement_item
(seq_block
[
"begin"
"end"
] @keyword.conditional)))))
[
"if"
"else"
"iff"
(case_keyword)
"endcase"
] @keyword.conditional
[
"="
"-"
"+"
"/"
"*"
"^"
"&"
"|"
"&&"
"||"
"<="
"=="
"!="
"==="
"!=="
"-:"
"<"
">"
">="
"%"
">>"
"<<"
"|="
"|=>"
"|->"
">>>"
"<<<"
"->>"
"->"
"=>"
"*>"
".*"
(unary_operator)
(inc_or_dec_operator)
(queue_dimension)
] @operator
"#" @constructor
[
";"
"::"
","
"."
":"
] @punctuation.delimiter
(conditional_expression
[
"?"
":"
] @keyword.conditional.ternary)
[
"["
"]"
"("
")"
"{"
"}"
"'{"
] @punctuation.bracket
[
"or"
"and"
] @keyword.operator
[
"input"
"output"
"inout"
"signed"
"unsigned"
"assert"
"cover"
"assume"
"disable"
"automatic"
"static"
(dpi_function_import_property)
(dpi_task_import_property)
] @keyword.modifier
[
"include"
"import"
"directive_include"
] @keyword.import
(comment) @comment @spell
[
"@"
(cycle_delay_range)
(delay_control)
(cycle_delay)
(attribute_instance)
] @attribute
(attribute_instance
(attr_spec
(simple_identifier) @property))
[
(integral_number)
(unbased_unsized_literal)
(fixed_point_number)
(unsigned_number)
] @number
[
(net_type)
(data_type)
(time_unit)
] @type.builtin
; variable
(list_of_variable_decl_assignments
(variable_decl_assignment
name: (simple_identifier) @variable))
(hierarchical_identifier
(simple_identifier) @variable)
(tf_port_item
(simple_identifier) @variable)
port_name: (simple_identifier) @variable
(port
(simple_identifier) @variable)
(list_of_port_identifiers
(simple_identifier) @variable)
(net_lvalue
(simple_identifier) @variable)
(sequence_port_item
(simple_identifier) @variable)
(property_port_item
(simple_identifier) @variable)
(net_decl_assignment
(simple_identifier) @variable)
(ERROR
(simple_identifier) @variable)
; variable.member
(hierarchical_identifier
(simple_identifier)
(simple_identifier) @variable.member)
(select
(simple_identifier) @variable.member)
(named_port_connection
port_name: (simple_identifier) @variable.member)
(ordered_port_connection
(expression
(primary
(hierarchical_identifier
(simple_identifier) @variable.member))))
(coverage_option
(simple_identifier) @variable.member)
; variable.builtin
(method_call_body
arguments: (list_of_arguments
(expression) @variable.builtin
(#any-of? @variable.builtin "this")))
(implicit_class_handle) @variable.builtin
; variable.parameter
(named_parameter_assignment
(simple_identifier) @variable.parameter)
(parameter_declaration
(list_of_param_assignments
(param_assignment
(simple_identifier) @variable.parameter)))
(local_parameter_declaration
(list_of_param_assignments
(param_assignment
(simple_identifier) @variable.parameter)))
; function builtin
[
(simulation_control_task)
(system_tf_identifier)
(severity_system_task)
(randomize_call)
(array_or_queue_method_name)
"new"
] @function.builtin
; declaration
(task_body_declaration
.
name: (simple_identifier) @function
(simple_identifier)? @label)
(function_body_declaration
.
name: (simple_identifier) @function
(simple_identifier)? @label)
(function_body_declaration
.
(data_type_or_void)
name: (simple_identifier) @function
(simple_identifier)? @label)
(clocking_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(sequence_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(property_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(class_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(interface_class_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(covergroup_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(package_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(checker_declaration
.
name: (simple_identifier) @constructor
(simple_identifier)? @label)
(interface_declaration
.
[
(simple_identifier) @constructor
(interface_nonansi_header
(simple_identifier) @constructor)
(interface_ansi_header
(simple_identifier) @constructor)
]
(simple_identifier)? @label)
(module_declaration
.
[
(simple_identifier) @constructor
(module_nonansi_header
(simple_identifier) @constructor)
(module_ansi_header
(simple_identifier) @constructor)
]
(simple_identifier)? @label)
(program_declaration
.
[
(simple_identifier) @constructor
(program_nonansi_header
(simple_identifier) @constructor)
(program_ansi_header
(simple_identifier) @constructor)
]
(simple_identifier)? @label)
; function.call
(method_call_body
name: (simple_identifier) @function.call)
(tf_call
(hierarchical_identifier
(simple_identifier) @function.call))
; instance
(module_instantiation
instance_type: (simple_identifier) @constructor)
(name_of_instance
instance_name: (simple_identifier) @module)
(sequence_instance
(hierarchical_identifier
(simple_identifier) @module))
(udp_instantiation
(simple_identifier) @constructor)
(ansi_port_declaration
(interface_port_header
interface_name: (simple_identifier) @variable
modport_name: (simple_identifier) @variable.member)
port_name: (simple_identifier) @variable)
; bind
(bind_directive
(bind_target_scope
(simple_identifier) @constructor))
(bind_target_instance
(hierarchical_identifier
(simple_identifier) @module))
; assertion
(concurrent_assertion_item
(simple_identifier) @label)
; converge
(cover_point
name: (simple_identifier) @label)
(cover_cross
name: (simple_identifier) @module)
(list_of_cross_items
(simple_identifier) @constructor)
;package
(package_import_item
(simple_identifier) @constructor)
; label
(seq_block
(simple_identifier) @label)
(statement
block_name: (simple_identifier) @label)
; dpi
(dpi_spec_string) @string
c_name: (c_identifier) @function
(dpi_import_export
name: (simple_identifier) @function)
; type def
(class_type
(simple_identifier) @constructor)
(class_type
(simple_identifier)
(simple_identifier) @type)
(data_type
(class_scope
(class_type
(simple_identifier) @constructor)))
(task_prototype
name: (simple_identifier) @function)
(function_prototype
name: (simple_identifier) @function)
(type_assignment
name: (simple_identifier) @type.definition)
(interface_class_type
(simple_identifier) @type.definition)
(package_scope
(simple_identifier) @constructor)
(data_declaration
(type_declaration
type_name: (simple_identifier) @type.definition))
(net_declaration
(simple_identifier) @type)
(constraint_declaration
(simple_identifier) @constructor)
(method_call
(primary
(hierarchical_identifier
(simple_identifier) @constructor)))
(string_literal
(quoted_string) @string)
; include
(include_statement
(file_path_spec) @string.special.path)
; directive
[
"directive_define"
"directive_default_nettype"
"directive_resetall"
"directive_timescale"
"directive_undef"
"directive_undefineall"
"directive_ifdef"
"directive_elsif"
"directive_endif"
"directive_else"
] @keyword.directive.define
(include_compiler_directive
(quoted_string) @string.special.path)
(include_compiler_directive
(system_lib_string) @string)
(default_nettype_compiler_directive
(default_nettype_value) @type.builtin)
(text_macro_definition
(text_macro_name
(simple_identifier) @keyword.directive))
(text_macro_usage) @keyword.directive
(ifdef_condition
(simple_identifier) @keyword.directive)
(undefine_compiler_directive
(simple_identifier) @keyword.directive)

View File

@ -0,0 +1,5 @@
((comment) @injection.content
(#set! injection.language "comment"))
((macro_text) @injection.content
(#set! injection.language "systemverilog"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,15 @@
[
(component_block)
(css_declaration)
(script_declaration)
(element)
(style_element)
(script_element)
(component_switch_statement)
(field_declaration_list)
(block)
(interface_type)
(comment)
(const_declaration)
(var_declaration)
] @fold

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,46 @@
[
(block_comment)
(architecture_definition)
(architecture_head)
(concurrent_block)
(configuration_declaration)
(component_instantiation_statement)
(generic_map_aspect)
(port_map_aspect)
(process_statement)
(process_head)
(sequential_block)
(block_configuration)
(block_statement)
(block_head)
(component_declaration)
(component_configuration)
(generic_clause)
(port_clause)
(entity_declaration)
(entity_head)
(entity_body)
(package_declaration)
(package_definition)
(function_specification)
(subprogram_declaration)
(subprogram_definition)
(subprogram_head)
(procedure_specification)
(sequential_block)
(loop_statement)
(if_statement_block)
(if_statement)
(elsif_statement)
(else_statement)
(case_statement)
(case_statement_alternative)
(for_generate_statement)
(if_generate_statement)
(if_generate)
(elsif_generate)
(else_generate)
(case_generate_statement)
(case_generate_alternative)
(type_declaration)
] @fold

View File

@ -0,0 +1,427 @@
(line_comment
(comment_content) @spell) @comment
(block_comment
(comment_content) @spell) @comment.documentation
(identifier) @variable
[
"access"
"after"
"alias"
"architecture"
"array"
; "assume"
"attribute"
"block"
"body"
"component"
"configuration"
"context"
; "cover"
"disconnect"
"entity"
; "fairness"
"file"
"force"
"generate"
"generic"
"group"
"label"
"literal"
"map"
"new"
"package"
"parameter"
"port"
"property"
"range"
"reject"
"release"
; "restrict"
"sequence"
"transport"
"unaffected"
"view"
; "vmode"
; "vpkg"
; "vprop"
"vunit"
] @keyword
[
(ALL)
(OTHERS)
"<>"
(DEFAULT)
(OPEN)
] @constant.builtin
[
"is"
"begin"
"end"
] @keyword
(parameter_specification
"in" @keyword)
[
"process"
"wait"
"on"
"until"
] @keyword.coroutine
(end_process
"end" @keyword.coroutine)
(timeout_clause
"for" @keyword.coroutine)
[
"function"
"procedure"
] @keyword.function
(subprogram_end
"end" @keyword.function)
[
"to"
"downto"
"of"
] @keyword.operator
[
"library"
"use"
] @keyword.import
[
"subtype"
"type"
"record"
"units"
"constant"
"signal"
"variable"
] @keyword.type
[
"protected"
"private"
"pure"
"impure"
"inertial"
"postponed"
; "strong"
"guarded"
"out"
"inout"
"linkage"
"buffer"
"register"
"bus"
"shared"
] @keyword.modifier
(mode
"in" @keyword.modifier)
(force_mode
"in" @keyword.modifier)
[
"while"
"loop"
"next"
"exit"
] @keyword.repeat
(end_loop
"end" @keyword.repeat)
(for_loop
"for" @keyword.repeat)
(block_configuration
"for" @keyword)
(configuration_specification
"for" @keyword)
(component_configuration
"for" @keyword)
(end_for
"for" @keyword)
"return" @keyword.return
[
"assert"
"report"
"severity"
] @keyword.debug
[
"if"
"then"
"elsif"
"case"
] @keyword.conditional
(end_if
"end" @keyword.conditional)
(end_case
"end" @keyword.conditional)
(when_element
"when" @keyword.conditional)
(case_generate_alternative
"when" @keyword.conditional)
(else_statement
"else" @keyword.conditional)
(else_generate
"else" @keyword.conditional)
[
"with"
"select"
] @keyword.conditional.ternary
(when_expression
"when" @keyword.conditional.ternary)
(else_expression
"else" @keyword.conditional.ternary)
(else_waveform
"else" @keyword.conditional.ternary)
(else_expression_or_unaffected
"else" @keyword.conditional.ternary)
"null" @constant.builtin
(user_directive) @keyword.directive
(protect_directive) @keyword.directive
(warning_directive) @keyword.directive
(error_directive) @keyword.directive
(if_conditional_analysis
"if" @keyword.directive)
(if_conditional_analysis
"then" @keyword.directive)
(elsif_conditional_analysis
"elsif" @keyword.directive)
(else_conditional_analysis
"else" @keyword.directive)
(end_conditional_analysis
"end" @keyword.directive)
(end_conditional_analysis
"if" @keyword.directive)
(directive_body) @keyword.directive
(directive_constant_builtin) @constant.macro
(directive_error) @comment.error
(directive_protect) @keyword.directive
(directive_warning) @comment.warning
[
(condition_conversion)
(relational_operator)
(sign)
(adding_operator)
(exponentiate)
(variable_assignment)
(signal_assignment)
"*"
"/"
":"
"=>"
] @operator
[
(unary_operator)
(logical_operator)
(shift_operator)
"mod"
"not"
"rem"
] @keyword.operator
[
"'"
","
"."
";"
] @punctuation.delimiter
[
"("
")"
"["
"]"
"<<"
">>"
] @punctuation.bracket
"@" @punctuation.special
[
(decimal_integer)
(string_literal_std_logic)
] @number
(decimal_float) @number.float
(bit_string_length) @property
(bit_string_base) @type.builtin
(bit_string_value) @number
(based_literal
(based_base) @type.builtin
(based_integer) @number)
(based_literal
(based_base) @type.builtin
(based_float) @number.float)
(string_literal) @string @spell
(character_literal) @character
(library_constant_std_logic) @constant.builtin
(library_constant) @constant.builtin
(library_function) @function.builtin
(library_constant_boolean) @boolean
(library_constant_character) @character
(library_constant_debug) @keyword.debug
(unit) @keyword.modifier
(library_constant_unit) @keyword.modifier
(label) @label
(generic_map_aspect
"generic" @constructor
"map" @constructor)
(port_map_aspect
"port" @constructor
"map" @constructor)
(selection
(identifier) @variable.member)
(_
view: (_) @type)
(_
type: (_) @type)
(_
library: (_) @module)
(_
package: (_) @module)
(_
entity: (_) @module)
(_
component: (_) @module)
(_
configuration: (_) @property)
(_
architecture: (_) @property)
(_
function: (_) @function)
(_
procedure: (_) @function.method)
(_
attribute: (_) @attribute)
(_
constant: (_) @constant)
(_
generic: (_) @variable.parameter)
(_
view: (name
(_)) @type)
(_
type: (name
(_)) @type)
(_
entity: (name
(_)) @module)
(_
component: (name
(_)) @module)
(_
configuration: (name
(_)) @module)
(library_type) @type.builtin
[
(attribute_function)
(attribute_impure_function)
(attribute_mode_view)
(attribute_pure_function)
(attribute_range)
(attribute_signal)
(attribute_subtype)
(attribute_type)
(attribute_value)
(library_attribute)
] @attribute.builtin
(library_namespace) @module.builtin
(subtype_declaration
(identifier) @type.definition)
(type_declaration
(identifier) @type.definition)
(mode_view_declaration
(identifier) @type.definition)

View File

@ -0,0 +1,7 @@
(line_comment
(comment_content) @injection.content
(#set! injection.language "comment"))
(block_comment
(comment_content) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,6 @@
[
(block)
(object)
(array)
(arguments)
] @fold

View File

@ -0,0 +1,108 @@
(comment) @comment @spell
(null) @constant.builtin
(timestamp) @constant
(closure_variables
(ident) @variable.parameter)
(integer) @number
(float) @number.float
[
(string)
(raw_string)
] @string
[
(raw_string_escape_sequence)
(escape_sequence)
(regex_escape_sequence)
] @string.escape
(string_template
"{{" @punctuation.special
(_)
"}}" @punctuation.special)
(regex) @string.regexp
(boolean) @boolean
(ident) @variable
(noop) @variable.builtin
(function_call
(ident) @function.call)
; VRL queries
(query
[
(event)
(metadata)
] @variable.builtin)
(query
(path
[
(field) @variable
(string) @string
(index) @number
"." @punctuation.delimiter
]))
"return" @keyword.return
"abort" @keyword.exception
[
"if"
"else"
] @keyword.conditional
[
"="
"=="
"!="
"|="
">"
">="
"<"
"<="
"+"
"-"
"*"
"/"
"&&"
"||"
"??"
"|"
"!"
] @operator
[
"->"
":"
";"
","
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(closure_variables
"|" @punctuation.bracket)
(function_call
(ident) @keyword.exception
"!"
(#any-of? @keyword.exception "assert" "assert_eq"))

View File

@ -0,0 +1,24 @@
[
(block)
(object)
(array)
(arguments)
] @indent.begin
(block
"}" @indent.end)
(object
"}" @indent.end)
(array
"]" @indent.end)
(arguments
")" @indent.end)
[
")"
"]"
"}"
] @indent.branch

View File

@ -0,0 +1,6 @@
((comment) @injection.content
(#set! injection.language "comment"))
((regex) @injection.content
(#offset! @injection.content 0 2 0 -1)
(#set! injection.language "regex"))

View File

@ -0,0 +1,16 @@
(closure_variables
(ident) @local.definition.parameter)
[
(ident)
(metadata)
] @local.reference
(query
(event) @local.reference)
[
(block)
(closure)
(if_statement)
] @local.scope

View File

@ -0,0 +1,5 @@
([
(line_comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,12 @@
[
(world_items)
(world_body)
(interface_items)
(interface_body)
] @fold
(world_items
[
(use_item)
(import_item)
])+ @fold

View File

@ -0,0 +1,9 @@
@defer (on viewport) {
<calendar-cmp />
} @placeholder (minimum 100ms) {
<small-component />
} @loading (after 100s; minimum 200ms){
<loading-spinner />
} @error {
<error-message />
}

View File

@ -0,0 +1,5 @@
@for (item of items; track item.id) {
<li>{{ item.name }}</li>
} @empty {
<p>No items</p>
}

View File

@ -0,0 +1,15 @@
@if (someCondition) {
<p>someCondition is true</p>
} @else {
<p>someCondition is false</p>
}
<div>
@if (someOther) {
<span>True</span>
@if (nestedCondition) {
<span>Nested</span>
}
}
</div>

View File

@ -0,0 +1,13 @@
<div>
@switch (obj.property) {
@case (1) {
<p>Case 1</p>
}
@case (2) {
<p>Case 2</p>
}
@default {
<p>Default</p>
}
}
</div>

View File

@ -0,0 +1,70 @@
local Runner = require("tests.indent.common").Runner
local runner = Runner:new(it, "tests/indent/angular", {
tabstop = 2,
shiftwidth = 2,
expandtab = true,
filetype = "htmlangular",
})
describe("indent HTML Angular:", function()
describe("whole file:", function()
runner:whole_file "."
end)
describe("new line:", function()
for _, info in ipairs {
{ 1, 2 },
{ 2, 2 },
{ 3, 2 },
{ 4, 2 },
{ 6, 0 },
{ 7, 2 },
{ 8, 4 },
{ 10, 4 },
{ 11, 6 },
{ 12, 6 },
{ 13, 4 },
{ 14, 2 },
} do
runner:new_line("if-else.html", { on_line = info[1], text = "//", indent = info[2] })
end
for _, info in ipairs {
{ 1, 2 },
{ 2, 4 },
{ 3, 6 },
{ 4, 6 },
{ 6, 6 },
{ 7, 6 },
{ 9, 6 },
{ 10, 6 },
{ 12, 2 },
} do
runner:new_line("switch-case.html", { on_line = info[1], text = "//", indent = info[2] })
end
for _, info in ipairs {
{ 1, 2 },
{ 2, 2 },
{ 3, 2 },
{ 4, 2 },
{ 5, 0 },
} do
runner:new_line("for.html", { on_line = info[1], text = "//", indent = info[2] })
end
for _, info in ipairs {
{ 1, 2 },
{ 2, 2 },
{ 3, 2 },
{ 4, 2 },
{ 5, 2 },
{ 6, 2 },
{ 7, 2 },
{ 8, 2 },
{ 9, 0 },
} do
runner:new_line("defer.html", { on_line = info[1], text = "//", indent = info[2] })
end
end)
end)

View File

@ -0,0 +1,134 @@
{ lib }:
with lib.lists;
with lib.types;
with lib.attrsets;
with lib.strings; {
doubleFromSystem = { cpu, kernel, abi, ... }:
if abi == abis.cygnus then
"${cpu.name}-cygwin"
else if kernel.families ? darwin then
"${cpu.name}-darwin"
else
"${cpu.name}-${kernelName kernel}";
tripleFromSystem = { cpu, vendor, kernel, abi, ... }@sys:
assert isSystem sys;
let
optExecFormat = lib.optionalString (kernel.name == "netbsd"
&& gnuNetBSDDefaultExecFormat cpu != kernel.execFormat)
kernel.execFormat.name;
optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}";
in "${cpu.name}-${vendor.name}-${
kernelName kernel
}${optExecFormat}${optAbi}";
mkSystemFromSkeleton = { cpu,
# Optional, but fallback too complex for here.
# Inferred below instead.
vendor ? assert false; null, kernel,
# Also inferred below
abi ? assert false; null, }@args:
let
getCpu = name: cpuTypes.${name} or (throw "Unknown CPU type: ${name}");
getVendor = name: vendors.${name} or (throw "Unknown vendor: ${name}");
getKernel = name: kernels.${name} or (throw "Unknown kernel: ${name}");
getAbi = name: abis.${name} or (throw "Unknown ABI: ${name}");
parsed = {
cpu = getCpu args.cpu;
vendor = if args ? vendor then
getVendor args.vendor
else if isDarwin parsed then
vendors.apple
else if isWindows parsed then
vendors.pc
else
vendors.unknown;
kernel = if hasPrefix "darwin" args.kernel then
getKernel "darwin"
else if hasPrefix "netbsd" args.kernel then
getKernel "netbsd"
else
getKernel args.kernel;
abi = if args ? abi then
getAbi args.abi
else if isLinux parsed || isWindows parsed then
if isAarch32 parsed then
if lib.versionAtLeast (parsed.cpu.version or "0") "6" then
abis.gnueabihf
else
abis.gnueabi
else if isPower64 parsed && isBigEndian parsed then
abis.gnuabielfv2
else
abis.gnu
else
abis.unknown;
};
in mkSystem parsed;
mkSkeletonFromList = l:
{
"1" = if elemAt l 0 == "avr" then {
cpu = elemAt l 0;
kernel = "none";
abi = "unknown";
} else
throw "Target specification with 1 components is ambiguous";
"2" = # We only do 2-part hacks for things Nix already supports
if elemAt l 1 == "cygwin" then {
cpu = elemAt l 0;
kernel = "windows";
abi = "cygnus";
} else if elemAt l 1 == "windows" then {
cpu = elemAt l 0;
kernel = "windows";
abi = "msvc";
} else if (elemAt l 1) == "elf" then {
cpu = elemAt l 0;
vendor = "unknown";
kernel = "none";
abi = elemAt l 1;
} else {
cpu = elemAt l 0;
kernel = elemAt l 1;
};
"3" =
# cpu-kernel-environment
if elemAt l 1 == "linux"
|| elem (elemAt l 2) [ "eabi" "eabihf" "elf" "gnu" ] then {
cpu = elemAt l 0;
kernel = elemAt l 1;
abi = elemAt l 2;
vendor = "unknown";
} else if elemAt l 1 == "apple"
|| elem (elemAt l 2) [ "wasi" "redox" "mmixware" "ghcjs" "mingw32" ]
|| hasPrefix "freebsd" (elemAt l 2) || hasPrefix "netbsd" (elemAt l 2)
|| hasPrefix "genode" (elemAt l 2) then {
cpu = elemAt l 0;
vendor = elemAt l 1;
kernel = if elemAt l 2 == "mingw32" then
"windows" # autotools breaks on -gnu for window
else
elemAt l 2;
} else
throw "Target specification with 3 components is ambiguous";
"4" = {
cpu = elemAt l 0;
vendor = elemAt l 1;
kernel = elemAt l 2;
abi = elemAt l 3;
};
}.${toString (length l)} or (throw
"system string has invalid number of hyphen-separated components");
# GNU build systems assume that older NetBSD architectures are using a.out.
gnuNetBSDDefaultExecFormat = cpu:
if (cpu.family == "arm" && cpu.bits == 32)
|| (cpu.family == "sparc" && cpu.bits == 32)
|| (cpu.family == "m68k" && cpu.bits == 32)
|| (cpu.family == "x86" && cpu.bits == 32) then
execFormats.aout
else
execFormats.elf;
}

Some files were not shown because too many files have changed in this diff Show More