Skip to content

Commit ff83f99

Browse files
committed
feat: support for varied casing on ID/Id
1 parent c07015e commit ff83f99

File tree

6 files changed

+235
-25
lines changed

6 files changed

+235
-25
lines changed

grammars/apex.tmLanguage

Lines changed: 86 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@
309309
<key>include</key>
310310
<string>#comment</string>
311311
</dict>
312+
<dict>
313+
<key>include</key>
314+
<string>#dml-expression</string>
315+
</dict>
312316
<dict>
313317
<key>include</key>
314318
<string>#merge-expression</string>
@@ -693,6 +697,32 @@
693697
</dict>
694698
</array>
695699
</dict>
700+
<key>dml-expression</key>
701+
<dict>
702+
<key>begin</key>
703+
<string>\b(delete|insert|undelete|update|upsert)\b\s+(?!new\b)</string>
704+
<key>beginCaptures</key>
705+
<dict>
706+
<key>1</key>
707+
<dict>
708+
<key>name</key>
709+
<string>support.function.apex</string>
710+
</dict>
711+
</dict>
712+
<key>end</key>
713+
<string>(?&lt;=\;)</string>
714+
<key>patterns</key>
715+
<array>
716+
<dict>
717+
<key>include</key>
718+
<string>#expression</string>
719+
</dict>
720+
<dict>
721+
<key>include</key>
722+
<string>#punctuation-semicolon</string>
723+
</dict>
724+
</array>
725+
</dict>
696726
<key>merge-expression</key>
697727
<dict>
698728
<key>begin</key>
@@ -1328,22 +1358,49 @@
13281358
<key>extends-class</key>
13291359
<dict>
13301360
<key>begin</key>
1331-
<string>(extends)\b\s+([_[:alpha:]][_[:alnum:]]*)</string>
1361+
<string>(extends)\b\s+</string>
13321362
<key>beginCaptures</key>
13331363
<dict>
13341364
<key>1</key>
13351365
<dict>
13361366
<key>name</key>
13371367
<string>keyword.other.extends.apex</string>
13381368
</dict>
1339-
<key>2</key>
1340-
<dict>
1341-
<key>name</key>
1342-
<string>entity.name.type.extends.apex</string>
1343-
</dict>
13441369
</dict>
13451370
<key>end</key>
13461371
<string>(?={|implements)</string>
1372+
<key>patterns</key>
1373+
<array>
1374+
<dict>
1375+
<key>begin</key>
1376+
<string>(?=[_[:alpha:]][_[:alnum:]]*\s*\.)</string>
1377+
<key>end</key>
1378+
<string>(?={|implements)</string>
1379+
<key>patterns</key>
1380+
<array>
1381+
<dict>
1382+
<key>include</key>
1383+
<string>#support-type</string>
1384+
</dict>
1385+
<dict>
1386+
<key>include</key>
1387+
<string>#type</string>
1388+
</dict>
1389+
</array>
1390+
</dict>
1391+
<dict>
1392+
<key>match</key>
1393+
<string>([_[:alpha:]][_[:alnum:]]*)</string>
1394+
<key>captures</key>
1395+
<dict>
1396+
<key>1</key>
1397+
<dict>
1398+
<key>name</key>
1399+
<string>entity.name.type.extends.apex</string>
1400+
</dict>
1401+
</dict>
1402+
</dict>
1403+
</array>
13471404
</dict>
13481405
<key>implements-class</key>
13491406
<dict>
@@ -1359,6 +1416,23 @@
13591416
</dict>
13601417
<key>patterns</key>
13611418
<array>
1419+
<dict>
1420+
<key>begin</key>
1421+
<string>(?=[_[:alpha:]][_[:alnum:]]*\s*\.)</string>
1422+
<key>end</key>
1423+
<string>(?={|extends|,)</string>
1424+
<key>patterns</key>
1425+
<array>
1426+
<dict>
1427+
<key>include</key>
1428+
<string>#support-type</string>
1429+
</dict>
1430+
<dict>
1431+
<key>include</key>
1432+
<string>#type</string>
1433+
</dict>
1434+
</array>
1435+
</dict>
13621436
<dict>
13631437
<key>match</key>
13641438
<string>([_[:alpha:]][_[:alnum:]]*)\b\s*(,)?</string>
@@ -1376,6 +1450,10 @@
13761450
</dict>
13771451
</dict>
13781452
</dict>
1453+
<dict>
1454+
<key>include</key>
1455+
<string>#punctuation-comma</string>
1456+
</dict>
13791457
</array>
13801458
<key>end</key>
13811459
<string>(?={|extends)</string>
@@ -4251,7 +4329,7 @@
42514329
<dict>
42524330
<key>match</key>
42534331
<string>(?x)
4254-
(?:(?:\b(this)\b)\s+)?
4332+
(?:(?:\b(this|final)\b)\s+)?
42554333
(?&lt;type_name&gt;
42564334
(?:
42574335
(?:ref\s+)? # ref return
@@ -4438,7 +4516,7 @@
44384516
<key>type-builtin</key>
44394517
<dict>
44404518
<key>match</key>
4441-
<string>\b(Blob|Boolean|byte|Date|Datetime|Decimal|Double|ID|Integer|Long|Object|String|Time|void)\b</string>
4519+
<string>\b(Blob|Boolean|byte|Date|Datetime|Decimal|Double|Id|ID|Integer|Long|Object|String|Time|void)\b</string>
44424520
<key>captures</key>
44434521
<dict>
44444522
<key>1</key>

grammars/apex.tmLanguage.cson

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ repository:
215215
{
216216
include: '#comment'
217217
}
218+
{
219+
include: '#dml-expression'
220+
}
218221
{
219222
include: '#merge-expression'
220223
}
@@ -433,6 +436,20 @@ repository:
433436
include: '#punctuation-comma'
434437
}
435438
]
439+
'dml-expression':
440+
begin: '\\b(delete|insert|undelete|update|upsert)\\b\\s+(?!new\\b)'
441+
beginCaptures:
442+
'1':
443+
name: 'support.function.apex'
444+
end: '(?<=\\;)'
445+
patterns: [
446+
{
447+
include: '#expression'
448+
}
449+
{
450+
include: '#punctuation-semicolon'
451+
}
452+
]
436453
'merge-expression':
437454
begin: '(merge)\\b\\s+'
438455
beginCaptures:
@@ -797,19 +814,49 @@ repository:
797814
}
798815
]
799816
'extends-class':
800-
begin: '(extends)\\b\\s+([_[:alpha:]][_[:alnum:]]*)'
817+
begin: '(extends)\\b\\s+'
801818
beginCaptures:
802819
'1':
803820
name: 'keyword.other.extends.apex'
804-
'2':
805-
name: 'entity.name.type.extends.apex'
806821
end: '(?={|implements)'
822+
patterns: [
823+
{
824+
begin: '(?=[_[:alpha:]][_[:alnum:]]*\\s*\\.)'
825+
end: '(?={|implements)'
826+
patterns: [
827+
{
828+
include: '#support-type'
829+
}
830+
{
831+
include: '#type'
832+
}
833+
]
834+
}
835+
{
836+
match: '([_[:alpha:]][_[:alnum:]]*)'
837+
captures:
838+
'1':
839+
name: 'entity.name.type.extends.apex'
840+
}
841+
]
807842
'implements-class':
808843
begin: '(implements)\\b'
809844
beginCaptures:
810845
'1':
811846
name: 'keyword.other.implements.apex'
812847
patterns: [
848+
{
849+
begin: '(?=[_[:alpha:]][_[:alnum:]]*\\s*\\.)'
850+
end: '(?={|extends|,)'
851+
patterns: [
852+
{
853+
include: '#support-type'
854+
}
855+
{
856+
include: '#type'
857+
}
858+
]
859+
}
813860
{
814861
match: '([_[:alpha:]][_[:alnum:]]*)\\b\\s*(,)?'
815862
captures:
@@ -818,6 +865,9 @@ repository:
818865
'2':
819866
name: 'punctuation.separator.comma.apex'
820867
}
868+
{
869+
include: '#punctuation-comma'
870+
}
821871
]
822872
end: '(?={|extends)'
823873
'soql-query-expression':
@@ -2533,7 +2583,7 @@ repository:
25332583
parameter:
25342584
match: '''
25352585
(?x)
2536-
(?:(?:\\b(this)\\b)\\s+)?
2586+
(?:(?:\\b(this|final)\\b)\\s+)?
25372587
(?<type_name>
25382588
(?:
25392589
(?:ref\\s+)? # ref return
@@ -2644,7 +2694,7 @@ repository:
26442694
}
26452695
]
26462696
'type-builtin':
2647-
match: '\\b(Blob|Boolean|byte|Date|Datetime|Decimal|Double|ID|Integer|Long|Object|String|Time|void)\\b'
2697+
match: '\\b(Blob|Boolean|byte|Date|Datetime|Decimal|Double|Id|ID|Integer|Long|Object|String|Time|void)\\b'
26482698
captures:
26492699
'1':
26502700
name: 'keyword.type.apex'

0 commit comments

Comments
 (0)