Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .cursor/skills/deploy-apex-grammar/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: deploy-apex-grammar
description: Build apex-tmLanguage grammars and deploy them to all Salesforce extensions in the IDE. Use when deploying grammar changes, testing syntax highlighting, or when the user asks to deploy/copy grammars to the IDE.
---

# Deploy Apex Grammar to IDE

## Workflow

1. **Build**: Run `yarn install && yarn build` from the apex-tmLanguage project root.
2. **Deploy**: Run `bash .cursor/skills/deploy-apex-grammar/scripts/deploy.sh` from the project root.
3. **Reload**: Tell the user to reload the window (Command Palette → "Developer: Reload Window").

## Deploy targets

The script copies to all Salesforce extensions that use these grammars:

| Extension | Path | Files |
|-----------|------|-------|
| salesforcedx-vscode-apex | grammars/ | apex, soql |
| apex-language-server-extension | grammars/ | apex, soql |
| salesforcedx-vscode-soql | grammars/ | soql |

Searches both `~/.cursor/extensions/` and `~/.vscode/extensions/`.

## One-liner

```bash
yarn install && yarn build && bash .cursor/skills/deploy-apex-grammar/scripts/deploy.sh
```
18 changes: 18 additions & 0 deletions .cursor/skills/deploy-apex-grammar/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Deploy apex/soql grammars to all Salesforce extensions in Cursor or VS Code.
set -e
for base in "$HOME/.cursor/extensions" "$HOME/.vscode/extensions"; do
[ ! -d "$base" ] && continue
# Base Apex (grammars/)
for d in "$base"/salesforce.salesforcedx-vscode-apex-*; do
[ -f "$d/grammars/apex.tmLanguage" ] && cp grammars/apex.tmLanguage grammars/soql.tmLanguage "$d/grammars/" && echo "→ $d/grammars"
done 2>/dev/null
# Apex language server
for d in "$base"/salesforce.apex-language-server-extension-*; do
[ -d "$d/grammars" ] && cp grammars/apex.tmLanguage grammars/soql.tmLanguage "$d/grammars/" && echo "→ $d/grammars"
done 2>/dev/null
# SOQL standalone
for d in "$base"/salesforce.salesforcedx-vscode-soql-*; do
[ -d "$d/grammars" ] && cp grammars/soql.tmLanguage "$d/grammars/" && echo "→ $d/grammars"
done 2>/dev/null
done
80 changes: 79 additions & 1 deletion grammars/apex.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3588,6 +3588,10 @@
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#multiline-string-literal</string>
</dict>
<dict>
<key>include</key>
<string>#string-literal</string>
Expand Down Expand Up @@ -3679,12 +3683,48 @@
</dict>
</array>
</dict>
<key>multiline-string-literal</key>
<dict>
<key>name</key>
<string>string.quoted.single.multiline.apex</string>
<key>begin</key>
<string>'''</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.apex</string>
</dict>
</dict>
<key>end</key>
<string>'''</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.apex</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string-character-escape</string>
</dict>
<dict>
<key>include</key>
<string>#string-template-expression</string>
</dict>
</array>
</dict>
<key>string-literal</key>
<dict>
<key>name</key>
<string>string.quoted.single.apex</string>
<key>begin</key>
<string>'</string>
<string>\'(?!'')</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
Expand Down Expand Up @@ -3714,6 +3754,10 @@
<key>include</key>
<string>#string-character-escape</string>
</dict>
<dict>
<key>include</key>
<string>#string-template-expression</string>
</dict>
</array>
</dict>
<key>string-character-escape</key>
Expand All @@ -3723,6 +3767,40 @@
<key>match</key>
<string>\\.</string>
</dict>
<key>string-template-expression</key>
<dict>
<key>name</key>
<string>meta.template-expression.apex</string>
<key>begin</key>
<string>\$\{</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.template-expression.begin.apex</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.template-expression.end.apex</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>variable.other.readwrite.apex</string>
<key>match</key>
<string>@?[_[:alpha:]][_[:alnum:]]*</string>
</dict>
</array>
</dict>
<key>expression-operators</key>
<dict>
<key>patterns</key>
Expand Down
42 changes: 41 additions & 1 deletion grammars/apex.tmLanguage.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2117,6 +2117,9 @@ repository:
{
include: '#numeric-literal'
}
{
include: '#multiline-string-literal'
}
{
include: '#string-literal'
}
Expand Down Expand Up @@ -2174,9 +2177,27 @@ repository:
match: '\\b[0-9_]+(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?\\b'
}
]
'multiline-string-literal':
name: 'string.quoted.single.multiline.apex'
begin: "'''"
beginCaptures:
'0':
name: 'punctuation.definition.string.begin.apex'
end: "'''"
endCaptures:
'0':
name: 'punctuation.definition.string.end.apex'
patterns: [
{
include: '#string-character-escape'
}
{
include: '#string-template-expression'
}
]
'string-literal':
name: 'string.quoted.single.apex'
begin: "'"
begin: "\\'(?!'')"
beginCaptures:
'0':
name: 'punctuation.definition.string.begin.apex'
Expand All @@ -2190,10 +2211,29 @@ repository:
{
include: '#string-character-escape'
}
{
include: '#string-template-expression'
}
]
'string-character-escape':
name: 'constant.character.escape.apex'
match: '\\\\.'
'string-template-expression':
name: 'meta.template-expression.apex'
begin: '\\$\\{'
beginCaptures:
'0':
name: 'punctuation.definition.template-expression.begin.apex'
end: '\\}'
endCaptures:
'0':
name: 'punctuation.definition.template-expression.end.apex'
patterns: [
{
name: 'variable.other.readwrite.apex'
match: '@?[_[:alpha:]][_[:alnum:]]*'
}
]
'expression-operators':
patterns: [
{
Expand Down
80 changes: 79 additions & 1 deletion grammars/soql.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3570,6 +3570,10 @@
<key>include</key>
<string>#numeric-literal</string>
</dict>
<dict>
<key>include</key>
<string>#multiline-string-literal</string>
</dict>
<dict>
<key>include</key>
<string>#string-literal</string>
Expand Down Expand Up @@ -3661,12 +3665,48 @@
</dict>
</array>
</dict>
<key>multiline-string-literal</key>
<dict>
<key>name</key>
<string>string.quoted.single.multiline.apex</string>
<key>begin</key>
<string>'''</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.apex</string>
</dict>
</dict>
<key>end</key>
<string>'''</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.apex</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string-character-escape</string>
</dict>
<dict>
<key>include</key>
<string>#string-template-expression</string>
</dict>
</array>
</dict>
<key>string-literal</key>
<dict>
<key>name</key>
<string>string.quoted.single.apex</string>
<key>begin</key>
<string>'</string>
<string>\'(?!'')</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
Expand Down Expand Up @@ -3696,6 +3736,10 @@
<key>include</key>
<string>#string-character-escape</string>
</dict>
<dict>
<key>include</key>
<string>#string-template-expression</string>
</dict>
</array>
</dict>
<key>string-character-escape</key>
Expand All @@ -3705,6 +3749,40 @@
<key>match</key>
<string>\\.</string>
</dict>
<key>string-template-expression</key>
<dict>
<key>name</key>
<string>meta.template-expression.apex</string>
<key>begin</key>
<string>\$\{</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.template-expression.begin.apex</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.template-expression.end.apex</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>variable.other.readwrite.apex</string>
<key>match</key>
<string>@?[_[:alpha:]][_[:alnum:]]*</string>
</dict>
</array>
</dict>
<key>expression-operators</key>
<dict>
<key>patterns</key>
Expand Down
Loading
Loading