lsp-sample в репозитории https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample показывает, как реализовать onCompletion
сервер слушает только буквы [az], а не точку (.) У меня есть видел, что это контролируется с triggerCharacters
, но мне не ясно, где их установить. Кажется логичным, что это нужно сделать в клиентской части, но, похоже, я могу зарегистрировать только другой обработчик onCompletion
. Кто-нибудь может пролить свет?
Это код на стороне сервера:
// This handler provides the initial list of the completion items.
connection.onCompletion(
(_textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
// The pass parameter contains the position of the text document in
// which code complete got requested. For the example we ignore this
// info and always provide the same completion items.
return [
{
label: 'TypeScript',
kind: CompletionItemKind.Text,
data: 1
},
{
label: 'JavaScript',
kind: CompletionItemKind.Text,
data: 2
}
];
}
);