diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-11-05 19:17:30 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-11-05 19:17:30 +0100 |
commit | 10df138d6084000659626aaf50afb16e6b674b25 (patch) | |
tree | 6769f681ff339e0796e2ca43525df3e58b6fc6db /language-web/src/main/js/language | |
parent | fix(lang): make default and scope non-contextual (diff) | |
download | refinery-10df138d6084000659626aaf50afb16e6b674b25.tar.gz refinery-10df138d6084000659626aaf50afb16e6b674b25.tar.zst refinery-10df138d6084000659626aaf50afb16e6b674b25.zip |
chore(web): implicit completion info in grammar
Move information about which tokens should support implicit completions
into the Lezer grammar.
Diffstat (limited to 'language-web/src/main/js/language')
-rw-r--r-- | language-web/src/main/js/language/problem.grammar | 10 | ||||
-rw-r--r-- | language-web/src/main/js/language/props.ts | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/language-web/src/main/js/language/problem.grammar b/language-web/src/main/js/language/problem.grammar index 86cc7722..8e39243f 100644 --- a/language-web/src/main/js/language/problem.grammar +++ b/language-web/src/main/js/language/problem.grammar | |||
@@ -1,3 +1,7 @@ | |||
1 | @detectDelim | ||
2 | |||
3 | @external prop implicitCompletion from '../../../../src/main/js/language/props.ts' | ||
4 | |||
1 | @top Problem { statement* } | 5 | @top Problem { statement* } |
2 | 6 | ||
3 | statement { | 7 | statement { |
@@ -89,11 +93,11 @@ VariableName { QualifiedName } | |||
89 | 93 | ||
90 | NodeName { QualifiedName } | 94 | NodeName { QualifiedName } |
91 | 95 | ||
92 | QualifiedName { identifier ("::" identifier)* } | 96 | QualifiedName[implicitCompletion=true] { identifier ("::" identifier)* } |
93 | 97 | ||
94 | kw<term> { @specialize[@name={term}]<identifier, term> } | 98 | kw<term> { @specialize[@name={term},implicitCompletion=true]<identifier, term> } |
95 | 99 | ||
96 | ckw<term> { @extend[@name={term}]<identifier, term> } | 100 | ckw<term> { @extend[@name={term},implicitCompletion=true]<identifier, term> } |
97 | 101 | ||
98 | ParameterList<content> { "(" sep<",", content> ")" } | 102 | ParameterList<content> { "(" sep<",", content> ")" } |
99 | 103 | ||
diff --git a/language-web/src/main/js/language/props.ts b/language-web/src/main/js/language/props.ts new file mode 100644 index 00000000..8e488bf5 --- /dev/null +++ b/language-web/src/main/js/language/props.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { NodeProp } from '@lezer/common'; | ||
2 | |||
3 | export const implicitCompletion = new NodeProp({ | ||
4 | deserialize(s: string) { | ||
5 | return s === 'true'; | ||
6 | }, | ||
7 | }); | ||