Skip to content

Commit

Permalink
fix: only tokenize public at line start as kw
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Apr 23, 2024
1 parent 0735fb8 commit 663bf8d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion grammars/julia.cson
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ repository:
name: 'keyword.control.export.julia'
}
{
match: '\\b(?<![:_])(?:public)\\b'
match: '^(?:public)\\b'
name: 'keyword.control.public.julia'
}
{
Expand Down
2 changes: 1 addition & 1 deletion grammars/julia.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"name": "keyword.control.export.julia"
},
{
"match": "\\b(?<![:_])(?:public)\\b",
"match": "^(?:public)\\b",
"name": "keyword.control.public.julia"
},
{
Expand Down
2 changes: 1 addition & 1 deletion grammars/julia.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"name": "keyword.control.export.julia"
},
{
"match": "\\b(?<![:_])(?:public)\\b",
"match": "^(?:public)\\b",
"name": "keyword.control.public.julia"
},
{
Expand Down
2 changes: 1 addition & 1 deletion grammars/julia_vscode.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"name": "keyword.control.export.julia"
},
{
"match": "\\b(?<![:_])(?:public)\\b",
"match": "^(?:public)\\b",
"name": "keyword.control.public.julia"
},
{
Expand Down
21 changes: 21 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,27 @@ describe('Julia grammar', function () {
},
])
})
it("does not tokenize public in non-toplevel scopes", function () {
const tokens = tokenize(grammar, "2 + public")
compareTokens(tokens, [
{
value: "2",
scopes: ["constant.numeric.julia"]
},
{
value: " ",
scopes: []
},
{
value: "+",
scopes: ["keyword.operator.arithmetic.julia"]
},
{
value: " public",
scopes: []
},
])
})
it("tokenizes symbols", function () {
const tokens = tokenize(grammar, ":à_b9!")
compareTokens(tokens, [
Expand Down

0 comments on commit 663bf8d

Please sign in to comment.