Files
vscode-extension-samples/lsp-multi-server-sample/server/src/server.ts
Pine Wu b72fae94fa Revert "Pretter for each ts file"
This reverts commit 23674b2cfe.
2018-10-23 22:14:56 -07:00

36 lines
1.1 KiB
TypeScript

/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
'use strict';
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();
// The workspace folder this server is operating on
let workspaceFolder: string;
documents.onDidOpen((event) => {
connection.console.log(`[Server(${process.pid}) ${workspaceFolder}] Document opened: ${event.document.uri}`);
})
documents.listen(connection);
connection.onInitialize((params) => {
workspaceFolder = params.rootUri;
connection.console.log(`[Server(${process.pid}) ${workspaceFolder}] Started and initialize received`);
return {
capabilities: {
textDocumentSync: {
openClose: true,
change: TextDocumentSyncKind.None
}
}
}
});
connection.listen();