Skip to content

Commit

Permalink
Add 'data' to the list of item defaults for completion items. (#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaeumer authored Apr 21, 2023
1 parent 5a2bc36 commit 0b7acc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/common/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class CompletionItemFeature extends TextDocumentLanguageFeature<Completio
completion.completionItemKind = { valueSet: SupportedCompletionItemKinds };
completion.completionList = {
itemDefaults: [
'commitCharacters', 'editRange', 'insertTextFormat', 'insertTextMode'
'commitCharacters', 'editRange', 'insertTextFormat', 'insertTextMode', 'data'
]
};
}
Expand Down
10 changes: 6 additions & 4 deletions testbed/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
TextEdit, ProposedFeatures, DiagnosticTag, InsertTextFormat, SelectionRangeRequest, SelectionRange, InsertReplaceEdit,
SemanticTokensClientCapabilities, SemanticTokensLegend, SemanticTokensBuilder, SemanticTokensRegistrationType,
SemanticTokensRegistrationOptions, ProtocolNotificationType, ChangeAnnotation, WorkspaceChange, CompletionItemKind, DiagnosticSeverity,
DocumentDiagnosticReportKind, WorkspaceDiagnosticReport, NotebookDocuments
DocumentDiagnosticReportKind, WorkspaceDiagnosticReport, NotebookDocuments, CompletionList, DocumentLinkResolveRequest
} from 'vscode-languageserver/node';

import {
Expand Down Expand Up @@ -126,7 +126,7 @@ connection.onInitialize((params, cancel, progress): Thenable<InitializeResult> |
completionProvider: {
triggerCharacters: ['.'],
allCommitCharacters: [';'],
resolveProvider: false,
resolveProvider: true,
},
signatureHelpProvider: {
},
Expand Down Expand Up @@ -372,7 +372,7 @@ connection.languages.diagnostics.onWorkspace(async (params, token, _, resultProg
return { items: [] };
});

connection.onCompletion((params, token): CompletionItem[] => {
connection.onCompletion((params, token): CompletionList => {
const result: CompletionItem[] = [];
let item = CompletionItem.create('foo');
result.push(item);
Expand Down Expand Up @@ -407,7 +407,9 @@ connection.onCompletion((params, token): CompletionItem[] => {
item.kind = CompletionItemKind.Field;
result.push(item);

return result;
const list = CompletionList.create(result, true);
list.itemDefaults = { data: 'abc' };
return list;
});

connection.onCompletionResolve((item): CompletionItem => {
Expand Down

0 comments on commit 0b7acc1

Please sign in to comment.