@sshadows/tree-sitter-al 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,193 @@
1
+ ; AL Language (v2) - Tree-sitter Indentation Queries
2
+ ; Compatible with Neovim (nvim-treesitter) and Helix editor
3
+
4
+ ; =============================================================================
5
+ ; Indent Begin - nodes that increase indentation
6
+ ; =============================================================================
7
+
8
+ ; Object declarations (all use { ... })
9
+ [
10
+ (table_declaration)
11
+ (tableextension_declaration)
12
+ (page_declaration)
13
+ (pageextension_declaration)
14
+ (pagecustomization_declaration)
15
+ (codeunit_declaration)
16
+ (report_declaration)
17
+ (reportextension_declaration)
18
+ (query_declaration)
19
+ (xmlport_declaration)
20
+ (enum_declaration)
21
+ (enumextension_declaration)
22
+ (interface_declaration)
23
+ (controladdin_declaration)
24
+ (dotnet_declaration)
25
+ (profile_declaration)
26
+ (profileextension_declaration)
27
+ (permissionset_declaration)
28
+ (permissionsetextension_declaration)
29
+ (entitlement_declaration)
30
+ ] @indent.begin
31
+
32
+ ; Code blocks (begin ... end)
33
+ (code_block) @indent.begin
34
+
35
+ ; Sections that use { ... }
36
+ [
37
+ (fields_section)
38
+ (keys_section)
39
+ (fieldgroups_section)
40
+ (layout_section)
41
+ (actions_section)
42
+ (dataset_section)
43
+ (elements_section)
44
+ (labels_section)
45
+ (rendering_section)
46
+ (requestpage_section)
47
+ (views_section)
48
+ (schema_section)
49
+ ] @indent.begin
50
+
51
+ ; Layout elements
52
+ [
53
+ (area_section)
54
+ (group_section)
55
+ (repeater_section)
56
+ (cuegroup_section)
57
+ (fixed_section)
58
+ (grid_section)
59
+ (part_section)
60
+ (systempart_section)
61
+ (usercontrol_section)
62
+ ] @indent.begin
63
+
64
+ ; Action sections
65
+ [
66
+ (action_area_section)
67
+ (action_group_section)
68
+ (action_declaration)
69
+ (customaction_declaration)
70
+ (systemaction_declaration)
71
+ (fileuploadaction_declaration)
72
+ (actionref_declaration)
73
+ ] @indent.begin
74
+
75
+ ; Report sections
76
+ [
77
+ (report_dataitem)
78
+ (report_column)
79
+ (rendering_layout)
80
+ (label_section)
81
+ ] @indent.begin
82
+
83
+ ; Query sections
84
+ [
85
+ (query_dataitem)
86
+ (query_column)
87
+ (query_filter)
88
+ ] @indent.begin
89
+
90
+ ; XMLport elements
91
+ [
92
+ (xmlport_element)
93
+ (xmlport_attribute)
94
+ ] @indent.begin
95
+
96
+ ; Declarations with bodies
97
+ [
98
+ (field_declaration)
99
+ (enum_value_declaration)
100
+ (key_declaration)
101
+ (view_definition)
102
+ (assembly_declaration)
103
+ ] @indent.begin
104
+
105
+ ; Triggers
106
+ (trigger_declaration) @indent.begin
107
+
108
+ ; Var sections
109
+ (var_section) @indent.begin
110
+
111
+ ; Control flow (bodies are indented)
112
+ [
113
+ (if_statement)
114
+ (case_statement)
115
+ (case_branch)
116
+ (case_else_branch)
117
+ (for_statement)
118
+ (foreach_statement)
119
+ (while_statement)
120
+ (repeat_statement)
121
+ (with_statement)
122
+ ] @indent.begin
123
+
124
+ ; Modification blocks
125
+ [
126
+ (addafter_modification)
127
+ (addbefore_modification)
128
+ (addfirst_modification)
129
+ (addlast_modification)
130
+ (modify_modification)
131
+ (moveafter_modification)
132
+ (movebefore_modification)
133
+ (movefirst_modification)
134
+ (movelast_modification)
135
+ (addafter_action_modification)
136
+ (addbefore_action_modification)
137
+ (addfirst_action_modification)
138
+ (addlast_action_modification)
139
+ (modify_action_modification)
140
+ (addafter_dataset_modification)
141
+ (addbefore_dataset_modification)
142
+ (addfirst_dataset_modification)
143
+ (addlast_dataset_modification)
144
+ (add_dataset_modification)
145
+ (addfirst_fieldgroup_modification)
146
+ (addlast_fieldgroup_modification)
147
+ (addafter_views_modification)
148
+ (addbefore_views_modification)
149
+ (addfirst_views_modification)
150
+ (addlast_views_modification)
151
+ ] @indent.begin
152
+
153
+ ; Preprocessor conditionals
154
+ [
155
+ (preproc_conditional)
156
+ (preproc_conditional_actions)
157
+ (preproc_conditional_case)
158
+ (preproc_conditional_controladdin)
159
+ (preproc_conditional_dataset)
160
+ (preproc_conditional_fieldgroups)
161
+ (preproc_conditional_fields)
162
+ (preproc_conditional_keys)
163
+ (preproc_conditional_layout)
164
+ (preproc_conditional_object)
165
+ (preproc_conditional_query)
166
+ (preproc_conditional_report)
167
+ (preproc_conditional_statement)
168
+ (preproc_conditional_var)
169
+ (preproc_conditional_var_block)
170
+ (preproc_conditional_xmlport)
171
+ ] @indent.begin
172
+
173
+ ; Argument and parameter lists
174
+ (argument_list) @indent.begin
175
+ (parameter_list) @indent.begin
176
+
177
+ ; =============================================================================
178
+ ; Indent End - tokens that signal end of indentation
179
+ ; =============================================================================
180
+
181
+ "}" @indent.end
182
+ ")" @indent.end
183
+ "]" @indent.end
184
+
185
+ ; =============================================================================
186
+ ; Indent Branch - closing tokens that should dedent to match their opener
187
+ ; =============================================================================
188
+
189
+ [
190
+ "}"
191
+ ")"
192
+ "]"
193
+ ] @indent.branch
@@ -0,0 +1,110 @@
1
+ ; AL Language (v2) - Tree-sitter Scope and Local Variable Tracking
2
+ ; See: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
3
+
4
+ ; =============================================================================
5
+ ; Scope Definitions
6
+ ; =============================================================================
7
+
8
+ ; Object declarations create scopes
9
+ [
10
+ (table_declaration)
11
+ (tableextension_declaration)
12
+ (page_declaration)
13
+ (pageextension_declaration)
14
+ (pagecustomization_declaration)
15
+ (codeunit_declaration)
16
+ (report_declaration)
17
+ (reportextension_declaration)
18
+ (query_declaration)
19
+ (xmlport_declaration)
20
+ (enum_declaration)
21
+ (enumextension_declaration)
22
+ (interface_declaration)
23
+ (controladdin_declaration)
24
+ (profile_declaration)
25
+ (profileextension_declaration)
26
+ (permissionset_declaration)
27
+ (permissionsetextension_declaration)
28
+ (entitlement_declaration)
29
+ (dotnet_declaration)
30
+ ] @local.scope
31
+
32
+ ; Procedures and triggers create scopes
33
+ (procedure) @local.scope
34
+ (trigger_declaration) @local.scope
35
+ (event_declaration) @local.scope
36
+ (interface_procedure) @local.scope
37
+ (preproc_split_procedure) @local.scope
38
+
39
+ ; Code blocks create scopes
40
+ (code_block) @local.scope
41
+
42
+ ; Control flow statements with bodies create scopes
43
+ (if_statement) @local.scope
44
+ (case_statement) @local.scope
45
+ (case_branch) @local.scope
46
+ (for_statement) @local.scope
47
+ (foreach_statement) @local.scope
48
+ (while_statement) @local.scope
49
+ (repeat_statement) @local.scope
50
+ (with_statement) @local.scope
51
+
52
+ ; =============================================================================
53
+ ; Local Definitions
54
+ ; =============================================================================
55
+
56
+ ; Variable declarations define local variables
57
+ (variable_declaration
58
+ name: (identifier) @local.definition)
59
+ (variable_declaration
60
+ name: (quoted_identifier) @local.definition)
61
+
62
+ ; Parameters define local variables
63
+ (parameter
64
+ name: (identifier) @local.definition)
65
+ (parameter
66
+ name: (quoted_identifier) @local.definition)
67
+
68
+ ; Return values define local variables
69
+ (procedure
70
+ return_value: (identifier) @local.definition)
71
+ (procedure
72
+ return_value: (quoted_identifier) @local.definition)
73
+ (trigger_declaration
74
+ return_value: (identifier) @local.definition)
75
+ (trigger_declaration
76
+ return_value: (quoted_identifier) @local.definition)
77
+
78
+ ; Label declarations
79
+ (label_declaration
80
+ name: (identifier) @local.definition)
81
+
82
+ ; Field declarations (in tables)
83
+ (field_declaration
84
+ name: [(identifier) (quoted_identifier)] @local.definition)
85
+
86
+ ; Enum value declarations
87
+ (enum_value_declaration
88
+ value_name: [(identifier) (quoted_identifier)] @local.definition)
89
+
90
+ ; Key declarations
91
+ (key_declaration
92
+ name: [(identifier) (quoted_identifier)] @local.definition)
93
+
94
+ ; For loop variables
95
+ (for_statement
96
+ variable: (identifier) @local.definition)
97
+
98
+ ; Foreach loop variables
99
+ (foreach_statement
100
+ variable: (identifier) @local.definition)
101
+
102
+ ; =============================================================================
103
+ ; References
104
+ ; =============================================================================
105
+
106
+ ; Identifiers are references
107
+ (identifier) @local.reference
108
+
109
+ ; Quoted identifiers are references
110
+ (quoted_identifier) @local.reference
@@ -0,0 +1,226 @@
1
+ ; AL Language (v2) - Tree-sitter Tags for Code Navigation
2
+ ; See: https://tree-sitter.github.io/tree-sitter/4-code-navigation.html
3
+
4
+ ; =============================================================================
5
+ ; Object Definitions
6
+ ; =============================================================================
7
+
8
+ (table_declaration
9
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
10
+
11
+ (page_declaration
12
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
13
+
14
+ (codeunit_declaration
15
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
16
+
17
+ (report_declaration
18
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
19
+
20
+ (query_declaration
21
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
22
+
23
+ (xmlport_declaration
24
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
25
+
26
+ (enum_declaration
27
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
28
+
29
+ (interface_declaration
30
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.interface
31
+
32
+ (controladdin_declaration
33
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
34
+
35
+ ; =============================================================================
36
+ ; Extension Definitions
37
+ ; =============================================================================
38
+
39
+ (tableextension_declaration
40
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
41
+
42
+ (pageextension_declaration
43
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
44
+
45
+ (enumextension_declaration
46
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
47
+
48
+ (reportextension_declaration
49
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
50
+
51
+ (profileextension_declaration
52
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
53
+
54
+ (permissionsetextension_declaration
55
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
56
+
57
+ ; =============================================================================
58
+ ; Other Object Types
59
+ ; =============================================================================
60
+
61
+ (profile_declaration
62
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
63
+
64
+ (permissionset_declaration
65
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
66
+
67
+ (entitlement_declaration
68
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
69
+
70
+ (pagecustomization_declaration
71
+ object_name: [(identifier) (quoted_identifier)] @name) @definition.class
72
+
73
+ ; =============================================================================
74
+ ; Procedure and Trigger Definitions
75
+ ; =============================================================================
76
+
77
+ ; Procedure definitions
78
+ (procedure
79
+ name: [(identifier) (quoted_identifier)] @name) @definition.method
80
+
81
+ ; Event declarations
82
+ (event_declaration
83
+ name: [(identifier) (quoted_identifier)] @name) @definition.method
84
+
85
+ ; Trigger declarations
86
+ (trigger_declaration
87
+ name: [(identifier) (quoted_identifier)] @name) @definition.method
88
+
89
+ ; Interface procedures
90
+ (interface_procedure
91
+ name: [(identifier) (quoted_identifier)] @name) @definition.method
92
+
93
+ ; Split procedures (preprocessor-split)
94
+ (preproc_split_procedure
95
+ name: [(identifier) (quoted_identifier)] @name) @definition.method
96
+
97
+ ; =============================================================================
98
+ ; Parameter Definitions
99
+ ; =============================================================================
100
+
101
+ (parameter
102
+ name: (identifier) @name) @definition.parameter
103
+
104
+ (parameter
105
+ name: (quoted_identifier) @name) @definition.parameter
106
+
107
+ ; =============================================================================
108
+ ; Field Definitions
109
+ ; =============================================================================
110
+
111
+ ; Table field definitions
112
+ (field_declaration
113
+ name: [(identifier) (quoted_identifier)] @name) @definition.field
114
+
115
+ ; Enum value definitions
116
+ (enum_value_declaration
117
+ value_name: [(identifier) (quoted_identifier)] @name) @definition.constant
118
+
119
+ ; Key definitions
120
+ (key_declaration
121
+ name: [(identifier) (quoted_identifier)] @name) @definition.field
122
+
123
+ ; Fieldgroup definitions
124
+ (fieldgroup_declaration
125
+ name: [(identifier) (quoted_identifier)] @name) @definition.field
126
+
127
+ ; =============================================================================
128
+ ; Variable and Label Definitions
129
+ ; =============================================================================
130
+
131
+ ; Variable declarations
132
+ (variable_declaration
133
+ name: (identifier) @name) @definition.variable
134
+
135
+ (variable_declaration
136
+ name: (quoted_identifier) @name) @definition.variable
137
+
138
+ ; Label declarations
139
+ (label_declaration
140
+ name: (identifier) @name) @definition.constant
141
+
142
+ ; Return value definitions
143
+ (procedure
144
+ return_value: (identifier) @name) @definition.variable
145
+
146
+ (procedure
147
+ return_value: (quoted_identifier) @name) @definition.variable
148
+
149
+ ; =============================================================================
150
+ ; Action Definitions
151
+ ; =============================================================================
152
+
153
+ (action_declaration
154
+ name: [(identifier) (quoted_identifier)] @name) @definition.function
155
+
156
+ (customaction_declaration
157
+ name: [(identifier) (quoted_identifier)] @name) @definition.function
158
+
159
+ (systemaction_declaration
160
+ name: [(identifier) (quoted_identifier)] @name) @definition.function
161
+
162
+ (fileuploadaction_declaration
163
+ name: [(identifier) (quoted_identifier)] @name) @definition.function
164
+
165
+ (actionref_declaration
166
+ action_name: [(identifier) (quoted_identifier)] @name) @definition.function
167
+
168
+ ; =============================================================================
169
+ ; Module/Namespace Definitions
170
+ ; =============================================================================
171
+
172
+ (namespace_declaration
173
+ name: (namespace_name) @name) @definition.module
174
+
175
+ ; =============================================================================
176
+ ; View Definitions
177
+ ; =============================================================================
178
+
179
+ (view_definition
180
+ name: [(identifier) (quoted_identifier)] @name) @definition.field
181
+
182
+ ; =============================================================================
183
+ ; Function/Method References
184
+ ; =============================================================================
185
+
186
+ ; Direct function calls
187
+ (call_expression
188
+ function: (identifier) @name) @reference.call
189
+
190
+ ; Method calls on objects
191
+ (call_expression
192
+ function: (member_expression
193
+ member: (identifier) @name)) @reference.call
194
+
195
+ ; =============================================================================
196
+ ; Type References
197
+ ; =============================================================================
198
+
199
+ ; Record type references
200
+ (record_type
201
+ reference: [(identifier) (quoted_identifier)] @name) @reference.type
202
+
203
+ ; Object reference type references
204
+ (object_reference_type
205
+ reference: [(identifier) (quoted_identifier) (integer)] @name) @reference.type
206
+
207
+ ; Database references
208
+ (database_reference
209
+ table_name: [(identifier) (quoted_identifier)] @name) @reference.class
210
+
211
+ ; =============================================================================
212
+ ; Interface References
213
+ ; =============================================================================
214
+
215
+ (implements_clause
216
+ interface: [(identifier) (quoted_identifier)] @name) @reference.implementation
217
+
218
+ ; =============================================================================
219
+ ; Enum Value References
220
+ ; =============================================================================
221
+
222
+ (qualified_enum_value
223
+ enum_type: [(identifier) (quoted_identifier)] @name) @reference.class
224
+
225
+ (qualified_enum_value
226
+ value: [(identifier) (quoted_identifier)] @name) @reference.constant