Skip to content

Commit fab8e57

Browse files
authored
Fix common prefix completion issue (#2146)
1 parent 378d475 commit fab8e57

4 files changed

Lines changed: 87 additions & 67 deletions

File tree

package-lock.json

Lines changed: 66 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/langium/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"dependencies": {
6868
"@chevrotain/regexp-to-ast": "~12.0.0",
6969
"chevrotain": "~12.0.0",
70-
"chevrotain-allstar": "~0.4.1",
70+
"chevrotain-allstar": "~0.4.2",
7171
"vscode-languageserver": "~9.0.1",
7272
"vscode-languageserver-textdocument": "~1.0.12",
7373
"vscode-uri": "~3.1.0"

packages/langium/test/lsp/completion-provider.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,4 +709,23 @@ describe('Completion for optional elements', async () => {
709709
});
710710
});
711711

712+
test('Should complete correctly if alternative content is only partially present', async () => {
713+
const grammar = `
714+
grammar Test
715+
716+
entry Document: value=(RuleA | RuleB);
717+
718+
RuleA: 'hello' 'world';
719+
RuleB: 'hello' 'world' 'and' 'you';
720+
721+
hidden terminal WS: /\\s+/;
722+
`;
723+
const services = await createServicesForGrammar({ grammar });
724+
const completion = expectCompletion(services);
725+
await completion({
726+
text: 'hello world and <|>',
727+
index: 0,
728+
expectedItems: ['you']
729+
});
730+
});
712731
});

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"ES2020",
1212
"DOM"
1313
],
14+
"types": ["node"],
1415
// Generates corresponding '.d.ts' file.
1516
"declaration": true,
1617
// Generates a sourcemap for each corresponding '.d.ts' file.

0 commit comments

Comments
 (0)