Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
- Ensure column-index is 1-based to avoid error
- Make properties of optional options also optional
- Mark test case as failing
  • Loading branch information
martin-fleck-at committed Sep 6, 2024
1 parent 14abdc4 commit a4d2cb3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/langium/src/parser/indentation-aware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class IndentationAwareTokenBuilder<Terminals extends string = string, Key
offset,
length: match?.[0]?.length ?? 0,
line: this.getLineNumber(text, offset),
column: 0
column: 1
});
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/langium/src/parser/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface LexerResult {
export type TokenizeMode = 'full' | 'partial';

export interface TokenizeOptions {
mode: TokenizeMode;
mode?: TokenizeMode;
}

export const DEFAULT_TOKENIZE_OPTIONS: TokenizeOptions = { mode: 'full' };
Expand Down
3 changes: 2 additions & 1 deletion packages/langium/test/parser/indentation-aware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe('IndentationAware parsing', () => {
expect(return2.value).toBe(true);
});

test('should offer correct auto-completion parsing', async () => {
test.fails('should offer correct auto-completion parsing', async () => {
const text = expandToString`
<|>if true:
<|>return true
Expand All @@ -415,6 +415,7 @@ describe('IndentationAware parsing', () => {
const services = await createIndentationAwareServices(sampleGrammar);
const completion = expectCompletion(services);
await completion({ text, index: 0, expectedItems: ['if', 'return'] });
// PR 1669: the lines below currently fail as the completion provider may wrongly assumes that all whitespace tokens are hidden
await completion({ text, index: 1, expectedItems: ['if', 'return'] });
await completion({ text, index: 2, expectedItems: ['else'] });
await completion({ text, index: 3, expectedItems: ['if', 'return'] });
Expand Down

0 comments on commit a4d2cb3

Please sign in to comment.