Skip to content

Commit

Permalink
feat: support block completions (#1937)
Browse files Browse the repository at this point in the history
Two changes are necessary to support autocompletion of block keywords:
1. The `@` keyword causes immediate completion
2. The new block completion item kind maps onto the keyword icon
  • Loading branch information
dylhunn authored Oct 10, 2023
1 parent 9442292 commit d53ce2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions server/src/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {lspPositionToTsPosition, tsTextSpanToLspRange} from './utils';
// TODO: Move this to `@angular/language-service`.
enum CompletionKind {
attribute = 'attribute',
block = 'block',
htmlAttribute = 'html attribute',
property = 'property',
component = 'component',
Expand Down Expand Up @@ -90,6 +91,8 @@ function ngCompletionKindToLspCompletionItemKind(kind: CompletionKind): lsp.Comp
case CompletionKind.reference:
case CompletionKind.variable:
return lsp.CompletionItemKind.Variable;
case CompletionKind.block:
return lsp.CompletionItemKind.Keyword;
case CompletionKind.entity:
default:
return lsp.CompletionItemKind.Text;
Expand Down
2 changes: 1 addition & 1 deletion server/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export class Session {
codeLensProvider: {resolveProvider: true},
textDocumentSync: lsp.TextDocumentSyncKind.Incremental,
completionProvider:
{resolveProvider: true, triggerCharacters: ['<', '.', '*', '[', '(', '$', '|']},
{resolveProvider: true, triggerCharacters: ['<', '.', '*', '[', '(', '$', '|', '@']},
definitionProvider: true,
typeDefinitionProvider: true,
referencesProvider: true,
Expand Down

0 comments on commit d53ce2e

Please sign in to comment.