feat: comprehensive query files for all block types and VAR sections (Phase 3)
Update all 5 tree-sitter query files to cover the full grammar: highlights.scm: - Add highlights for new literals (binary, octal, date, bool, typed_int, wstring, char) - Add highlights for block names (organization_block, function_block, function, data_block, type_definition) - Add highlights for return_statement, goto_statement, title_statement - Add highlights for bit_access, method_callee - Add compound assignment operators (+=, -=, *=, /=, etc.) indents.scm: - Add function, type_definition, data_block to @indent.begin - Add all var_*_declaration variants to @indent.begin - Add struct_type to @indent.begin - Add END_FUNCTION, END_TYPE, END_DATA_BLOCK, END_STRUCT to @indent.end folds.scm: - Add function, type_definition, data_block to @fold - Add all var_*_declaration variants to @fold - Add struct_type to @fold locals.scm: - Add function, type_definition, data_block as @local.scope - Add all var_*_declaration variants as @local.scope - Add struct_type as @local.scope - Add block name definitions (@definition.function, @definition.class, @definition.type) - Narrow @reference to prefixed_identifier only (reduces noise) tags.scm: - Add function, data_block, type_definition tags - Add FB call references - Add region_statement as @definition.module
This commit is contained in:
@@ -3,12 +3,21 @@
|
|||||||
[
|
[
|
||||||
(organization_block)
|
(organization_block)
|
||||||
(function_block)
|
(function_block)
|
||||||
|
(function)
|
||||||
|
(type_definition)
|
||||||
|
(data_block)
|
||||||
(var_declaration)
|
(var_declaration)
|
||||||
|
(var_temp_declaration)
|
||||||
|
(var_constant_declaration)
|
||||||
|
(var_retain_declaration)
|
||||||
|
(var_non_retain_declaration)
|
||||||
|
(var_db_specific_declaration)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(case_statement)
|
(case_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
(while_statement)
|
(while_statement)
|
||||||
(repeat_statement)
|
(repeat_statement)
|
||||||
(region_statement)
|
(region_statement)
|
||||||
|
(struct_type)
|
||||||
(block_comment)
|
(block_comment)
|
||||||
] @fold
|
] @fold
|
||||||
|
|||||||
+58
-11
@@ -1,66 +1,99 @@
|
|||||||
; SCL highlights
|
; SCL highlights
|
||||||
|
|
||||||
|
; Comments
|
||||||
(line_comment) @comment
|
(line_comment) @comment
|
||||||
(block_comment) @comment
|
(block_comment) @comment
|
||||||
(c_style_comment) @comment
|
(c_style_comment) @comment
|
||||||
|
|
||||||
|
; Literals
|
||||||
(number) @number
|
(number) @number
|
||||||
(hex_number) @number
|
(hex_number) @number
|
||||||
(string) @string
|
(binary_number) @number
|
||||||
|
(octal_number) @number
|
||||||
(time_value) @number
|
(time_value) @number
|
||||||
|
(date_literal) @number
|
||||||
|
(bool_literal) @constant.builtin
|
||||||
|
(typed_int_literal) @number
|
||||||
|
(wstring_literal) @string
|
||||||
|
(char_literal) @character
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
; Prefix
|
||||||
(prefix) @punctuation.special
|
(prefix) @punctuation.special
|
||||||
|
|
||||||
|
; Variables and identifiers
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
; FB instance calls - highlight instance name as type
|
; FB instance calls
|
||||||
(fb_call
|
(fb_call
|
||||||
instance: (prefixed_identifier
|
instance: (prefixed_identifier
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
(fb_call
|
(fb_call
|
||||||
instance: (identifier) @type)
|
instance: (identifier) @type)
|
||||||
|
|
||||||
; FB parameter names (IN :=, PT :=, etc.)
|
; FB parameter names
|
||||||
(fb_parameter
|
(fb_parameter
|
||||||
name: (identifier) @property)
|
name: (identifier) @property)
|
||||||
|
|
||||||
; Function call names
|
; Function call names
|
||||||
(function_call
|
(function_call
|
||||||
(identifier) @function)
|
(identifier) @function)
|
||||||
|
(function_call
|
||||||
|
(string) @function)
|
||||||
|
|
||||||
|
; Method call names
|
||||||
|
(method_callee
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
; Variable declarations
|
; Variable declarations
|
||||||
(var_item
|
(var_item
|
||||||
name: (identifier) @variable)
|
name: (identifier) @variable)
|
||||||
|
|
||||||
; Type references in declarations
|
; Type references
|
||||||
(type
|
(type
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
(type_builtin) @type.builtin
|
(type_builtin) @type.builtin
|
||||||
|
|
||||||
|
; Keywords and operators
|
||||||
(keyword) @keyword
|
(keyword) @keyword
|
||||||
(constant) @constant.builtin
|
(constant) @constant.builtin
|
||||||
(operator) @operator
|
(operator) @operator
|
||||||
|
|
||||||
(assignment) @operator
|
; Block names
|
||||||
(binary_expression) @operator
|
(organization_block
|
||||||
(unary_expression) @operator
|
name: (string) @type)
|
||||||
|
(function_block
|
||||||
|
name: (string) @type)
|
||||||
|
(function
|
||||||
|
name: (string) @function)
|
||||||
|
(data_block
|
||||||
|
name: (string) @type)
|
||||||
|
(type_definition
|
||||||
|
name: (string) @type)
|
||||||
|
|
||||||
|
; Access
|
||||||
(field_access
|
(field_access
|
||||||
"."
|
"."
|
||||||
(identifier) @property)
|
(identifier) @property)
|
||||||
|
|
||||||
(array_access) @property
|
(array_access) @property
|
||||||
|
(bit_access) @property
|
||||||
|
|
||||||
|
; Attributes
|
||||||
(attribute_list) @attribute
|
(attribute_list) @attribute
|
||||||
(attribute) @attribute
|
(attribute) @attribute
|
||||||
(attribute_value) @string
|
(attribute_value) @string
|
||||||
|
|
||||||
(var_item) @property
|
; Statements
|
||||||
|
(assignment) @operator
|
||||||
|
(binary_expression) @operator
|
||||||
|
(unary_expression) @operator
|
||||||
|
(chained_assignment) @operator
|
||||||
|
|
||||||
|
; Function/FB calls
|
||||||
(function_call) @function.call
|
(function_call) @function.call
|
||||||
(fb_call) @function.call
|
(fb_call) @function.call
|
||||||
|
|
||||||
|
; Control flow
|
||||||
(if_statement) @conditional
|
(if_statement) @conditional
|
||||||
(elsif_clause) @conditional
|
(elsif_clause) @conditional
|
||||||
(else_clause) @conditional
|
(else_clause) @conditional
|
||||||
@@ -71,6 +104,13 @@
|
|||||||
(while_statement) @repeat
|
(while_statement) @repeat
|
||||||
(repeat_statement) @repeat
|
(repeat_statement) @repeat
|
||||||
|
|
||||||
|
(return_statement) @keyword
|
||||||
|
(goto_statement) @keyword
|
||||||
|
|
||||||
|
; Title
|
||||||
|
(title_statement) @comment
|
||||||
|
|
||||||
|
; Punctuation
|
||||||
";" @punctuation.delimiter
|
";" @punctuation.delimiter
|
||||||
":" @punctuation.delimiter
|
":" @punctuation.delimiter
|
||||||
"," @punctuation.delimiter
|
"," @punctuation.delimiter
|
||||||
@@ -80,15 +120,22 @@
|
|||||||
"]" @punctuation.bracket
|
"]" @punctuation.bracket
|
||||||
"." @punctuation.delimiter
|
"." @punctuation.delimiter
|
||||||
|
|
||||||
|
; Operators
|
||||||
":=" @operator
|
":=" @operator
|
||||||
"=>" @operator
|
"=>" @operator
|
||||||
|
"+=" @operator
|
||||||
|
"-=" @operator
|
||||||
|
"*=" @operator
|
||||||
|
"/=" @operator
|
||||||
|
"&=" @operator
|
||||||
|
"|=" @operator
|
||||||
|
"^=" @operator
|
||||||
"=" @operator
|
"=" @operator
|
||||||
"<>" @operator
|
"<>" @operator
|
||||||
"<" @operator
|
"<" @operator
|
||||||
">" @operator
|
">" @operator
|
||||||
"<=" @operator
|
"<=" @operator
|
||||||
">=" @operator
|
">=" @operator
|
||||||
|
|
||||||
"+" @operator
|
"+" @operator
|
||||||
"-" @operator
|
"-" @operator
|
||||||
"*" @operator
|
"*" @operator
|
||||||
|
|||||||
+26
-2
@@ -1,10 +1,26 @@
|
|||||||
; Indentation rules for SCL
|
; Indentation rules for SCL
|
||||||
|
|
||||||
; Indent after block keywords
|
; Indent after block definitions
|
||||||
[
|
[
|
||||||
(organization_block)
|
(organization_block)
|
||||||
(function_block)
|
(function_block)
|
||||||
|
(function)
|
||||||
|
(type_definition)
|
||||||
|
(data_block)
|
||||||
|
] @indent.begin
|
||||||
|
|
||||||
|
; Indent after VAR sections
|
||||||
|
[
|
||||||
(var_declaration)
|
(var_declaration)
|
||||||
|
(var_temp_declaration)
|
||||||
|
(var_constant_declaration)
|
||||||
|
(var_retain_declaration)
|
||||||
|
(var_non_retain_declaration)
|
||||||
|
(var_db_specific_declaration)
|
||||||
|
] @indent.begin
|
||||||
|
|
||||||
|
; Indent after control structures
|
||||||
|
[
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(case_statement)
|
(case_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
@@ -13,12 +29,16 @@
|
|||||||
(region_statement)
|
(region_statement)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
; Indent after THEN, DO, etc.
|
; Indent after STRUCT in UDTs and inline structs
|
||||||
|
(struct_type) @indent.begin
|
||||||
|
|
||||||
|
; Indent after THEN, DO, ELSE, ELSIF, BEGIN
|
||||||
[
|
[
|
||||||
"THEN"
|
"THEN"
|
||||||
"DO"
|
"DO"
|
||||||
"ELSE"
|
"ELSE"
|
||||||
"ELSIF"
|
"ELSIF"
|
||||||
|
(keyword) @indent.branch
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
|
|
||||||
; Outdent at end keywords
|
; Outdent at end keywords
|
||||||
@@ -30,8 +50,12 @@
|
|||||||
"END_WHILE"
|
"END_WHILE"
|
||||||
"END_REPEAT"
|
"END_REPEAT"
|
||||||
"END_REGION"
|
"END_REGION"
|
||||||
|
"END_STRUCT"
|
||||||
"END_ORGANIZATION_BLOCK"
|
"END_ORGANIZATION_BLOCK"
|
||||||
"END_FUNCTION_BLOCK"
|
"END_FUNCTION_BLOCK"
|
||||||
|
"END_FUNCTION"
|
||||||
|
"END_TYPE"
|
||||||
|
"END_DATA_BLOCK"
|
||||||
] @indent.end
|
] @indent.end
|
||||||
|
|
||||||
; Outdent for ELSE and ELSIF
|
; Outdent for ELSE and ELSIF
|
||||||
|
|||||||
+30
-6
@@ -1,15 +1,39 @@
|
|||||||
; Local variable scoping for SCL - matches grammar.js structure
|
; Local variable scoping for SCL
|
||||||
|
|
||||||
; Variable declarations define local variables
|
; Variable declarations define local variables
|
||||||
(var_item
|
(var_item
|
||||||
name: (identifier) @definition.var)
|
name: (identifier) @definition.var)
|
||||||
|
|
||||||
; Variable sections create scopes
|
|
||||||
(var_declaration) @local.scope
|
|
||||||
|
|
||||||
; Blocks create scopes
|
; Blocks create scopes
|
||||||
(organization_block) @local.scope
|
(organization_block) @local.scope
|
||||||
(function_block) @local.scope
|
(function_block) @local.scope
|
||||||
|
(function) @local.scope
|
||||||
|
(type_definition) @local.scope
|
||||||
|
(data_block) @local.scope
|
||||||
|
|
||||||
; Identifiers are references
|
; VAR sections create scopes
|
||||||
(identifier) @reference
|
(var_declaration) @local.scope
|
||||||
|
(var_temp_declaration) @local.scope
|
||||||
|
(var_constant_declaration) @local.scope
|
||||||
|
(var_retain_declaration) @local.scope
|
||||||
|
(var_non_retain_declaration) @local.scope
|
||||||
|
(var_db_specific_declaration) @local.scope
|
||||||
|
|
||||||
|
; Struct types create scopes
|
||||||
|
(struct_type) @local.scope
|
||||||
|
|
||||||
|
; Block names are definitions
|
||||||
|
(organization_block
|
||||||
|
name: (string) @definition.function)
|
||||||
|
(function_block
|
||||||
|
name: (string) @definition.function)
|
||||||
|
(function
|
||||||
|
name: (string) @definition.function)
|
||||||
|
(data_block
|
||||||
|
name: (string) @definition.class)
|
||||||
|
(type_definition
|
||||||
|
name: (string) @definition.type)
|
||||||
|
|
||||||
|
; References
|
||||||
|
(prefixed_identifier
|
||||||
|
(identifier) @reference)
|
||||||
|
|||||||
+25
-2
@@ -1,13 +1,25 @@
|
|||||||
; Tag queries for SCL - matches grammar.js structure
|
; Tag queries for SCL - symbol navigation
|
||||||
|
|
||||||
; Organization blocks
|
; Organization blocks
|
||||||
(organization_block
|
(organization_block
|
||||||
name: (string) @name) @definition.function
|
name: (string) @name) @definition.function
|
||||||
|
|
||||||
; Function blocks
|
; Function blocks
|
||||||
(function_block
|
(function_block
|
||||||
name: (string) @name) @definition.function
|
name: (string) @name) @definition.function
|
||||||
|
|
||||||
|
; Functions
|
||||||
|
(function
|
||||||
|
name: (string) @name) @definition.function
|
||||||
|
|
||||||
|
; Data blocks
|
||||||
|
(data_block
|
||||||
|
name: (string) @name) @definition.class
|
||||||
|
|
||||||
|
; Type definitions (UDTs)
|
||||||
|
(type_definition
|
||||||
|
name: (string) @name) @definition.type
|
||||||
|
|
||||||
; Variable definitions within blocks
|
; Variable definitions within blocks
|
||||||
(var_item
|
(var_item
|
||||||
name: (identifier) @name
|
name: (identifier) @name
|
||||||
@@ -25,3 +37,14 @@
|
|||||||
|
|
||||||
(function_call
|
(function_call
|
||||||
(string) @name) @reference.call
|
(string) @name) @reference.call
|
||||||
|
|
||||||
|
; FB calls (references)
|
||||||
|
(fb_call
|
||||||
|
instance: (identifier) @name) @reference.call
|
||||||
|
|
||||||
|
(fb_call
|
||||||
|
instance: (prefixed_identifier
|
||||||
|
(identifier) @name)) @reference.call
|
||||||
|
|
||||||
|
; Region statements
|
||||||
|
(region_statement) @definition.module
|
||||||
|
|||||||
Reference in New Issue
Block a user