Skip to content

Commit

Permalink
Highlight m.top like m. (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron authored Oct 2, 2024
1 parent cc42af0 commit 657ae24
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"sync-launch-settings": "ts-node scripts/sync-launch-settings.ts"
},
"dependencies": {
"@rokucommunity/logger": "^0.3.9",
"@types/request": "^2.48.12",
"@vscode/extension-telemetry": "^0.4.7",
"array-sort": "^1.0.0",
Expand Down
25 changes: 25 additions & 0 deletions src/grammar/brightscript.tmLanguage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ import { standardizePath as s } from 'brighterscript';
const brightscriptTmlanguagePath = s`${__dirname}/../../syntaxes/brightscript.tmLanguage.json`;

describe('brightscript.tmlanguage.json', () => {
it('colors m, m.top, m.global, and super correctly', async () => {
await testGrammar(`
super.doSomething()
'^^^^^ keyword.other.this.brs
`);

await testGrammar(`
this = m
' ^ keyword.other.this.brs
'^^^^ entity.name.variable.local.brs
`);

await testGrammar(`
m.global = true
' ^^^^^^ keyword.other.this.brs
'^ keyword.other.this.brs
`);

await testGrammar(`
m.top.visible = true
' ^^^ keyword.other.this.brs
'^ keyword.other.this.brs
`);
});

it('colors alias statement properly', async () => {
await testGrammar(`
alias alpha = beta
Expand Down
5 changes: 4 additions & 1 deletion syntaxes/brightscript.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,12 @@
"captures": {
"1": {
"name": "keyword.other.this.brs"
},
"2": {
"name": "keyword.other.this.brs"
}
},
"match": "(?i:(?<!\\.)\\b(m|global|super)\\b)"
"match": "(?i:(?<!\\.)\\b(m|super)\\b(?:\\s*\\.\\s*(top|global))?)"
},
"variables_and_params": {
"match": "(?i:(?:\\b(new)\\s)?\\b(?<!\\.)([a-z_][a-z0-9_\\$%!#]*)\\b)",
Expand Down

0 comments on commit 657ae24

Please sign in to comment.