Skip to content

Commit 84c0203

Browse files
authored
Merge pull request #280 from JuliaEditorSupport/sp/better-public
fix: only tokenize public at line start as kw
2 parents 0735fb8 + 663bf8d commit 84c0203

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

grammars/julia.cson

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ repository:
286286
name: 'keyword.control.export.julia'
287287
}
288288
{
289-
match: '\\b(?<![:_])(?:public)\\b'
289+
match: '^(?:public)\\b'
290290
name: 'keyword.control.public.julia'
291291
}
292292
{

grammars/julia.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
"name": "keyword.control.export.julia"
319319
},
320320
{
321-
"match": "\\b(?<![:_])(?:public)\\b",
321+
"match": "^(?:public)\\b",
322322
"name": "keyword.control.public.julia"
323323
},
324324
{

grammars/julia.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
"name": "keyword.control.export.julia"
319319
},
320320
{
321-
"match": "\\b(?<![:_])(?:public)\\b",
321+
"match": "^(?:public)\\b",
322322
"name": "keyword.control.public.julia"
323323
},
324324
{

grammars/julia_vscode.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
"name": "keyword.control.export.julia"
319319
},
320320
{
321-
"match": "\\b(?<![:_])(?:public)\\b",
321+
"match": "^(?:public)\\b",
322322
"name": "keyword.control.public.julia"
323323
},
324324
{

test/test.js

+21
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,27 @@ describe('Julia grammar', function () {
756756
},
757757
])
758758
})
759+
it("does not tokenize public in non-toplevel scopes", function () {
760+
const tokens = tokenize(grammar, "2 + public")
761+
compareTokens(tokens, [
762+
{
763+
value: "2",
764+
scopes: ["constant.numeric.julia"]
765+
},
766+
{
767+
value: " ",
768+
scopes: []
769+
},
770+
{
771+
value: "+",
772+
scopes: ["keyword.operator.arithmetic.julia"]
773+
},
774+
{
775+
value: " public",
776+
scopes: []
777+
},
778+
])
779+
})
759780
it("tokenizes symbols", function () {
760781
const tokens = tokenize(grammar, ":à_b9!")
761782
compareTokens(tokens, [

0 commit comments

Comments
 (0)