Updated multi root example to API changes

This commit is contained in:
Dirk Baeumer
2017-10-11 08:30:40 +02:00
parent cb2b2a6d8b
commit 92e282f8be
2 changed files with 11 additions and 6 deletions

View File

@ -7,18 +7,23 @@ import {
createConnection, TextDocuments, ProposedFeatures, TextDocumentSyncKind
} from 'vscode-languageserver';
// Creates the LSP connection
let connection = createConnection(ProposedFeatures.all);
// Create a manager for open text documents
let documents = new TextDocuments();
let rootUri: string;
// The workspace folder this server is operating on
let workspaceFolder: string;
documents.onDidOpen((event) => {
connection.console.log(`[Server ${rootUri}] Document opened: ${event.document.uri}`);
connection.console.log(`[Server ${workspaceFolder}] Document opened: ${event.document.uri}`);
})
documents.listen(connection);
connection.onInitialize((params) => {
rootUri = params.rootUri;
connection.console.log(`Server started for folder: ${rootUri}`);
workspaceFolder = params.rootUri;
connection.console.log(`Server started for folder: ${workspaceFolder}`);
return {
capabilities: {
textDocumentSync: {