Lsp-sample в репозитории https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample показывает, как реализовать onCompletion
сервер слушает только буквы [a-z], а не точку (.) Я видел, что это контролируется с помощью 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
}
];
}
);