2017-08-23 16:40:19 +02:00
|
|
|
/*---------------------------------------------------------
|
|
|
|
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
|
|
|
*--------------------------------------------------------*/
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
import {
|
2017-09-08 15:32:55 +02:00
|
|
|
createConnection, TextDocuments, ProposedFeatures, TextDocumentSyncKind
|
2017-08-23 16:40:19 +02:00
|
|
|
} from 'vscode-languageserver';
|
|
|
|
|
|
2017-10-11 08:30:40 +02:00
|
|
|
// Creates the LSP connection
|
2017-09-08 15:32:55 +02:00
|
|
|
let connection = createConnection(ProposedFeatures.all);
|
2017-10-11 08:30:40 +02:00
|
|
|
|
2018-02-20 11:01:40 +01:00
|
|
|
// Create a manager for open text documents
|
2017-08-23 16:40:19 +02:00
|
|
|
let documents = new TextDocuments();
|
2017-10-11 08:30:40 +02:00
|
|
|
|
|
|
|
|
// The workspace folder this server is operating on
|
|
|
|
|
let workspaceFolder: string;
|
2017-08-23 16:40:19 +02:00
|
|
|
|
|
|
|
|
documents.onDidOpen((event) => {
|
2017-10-31 10:34:06 +01:00
|
|
|
connection.console.log(`[Server(${process.pid}) ${workspaceFolder}] Document opened: ${event.document.uri}`);
|
2017-08-23 16:40:19 +02:00
|
|
|
})
|
|
|
|
|
documents.listen(connection);
|
|
|
|
|
|
|
|
|
|
connection.onInitialize((params) => {
|
2017-10-11 08:30:40 +02:00
|
|
|
workspaceFolder = params.rootUri;
|
2017-10-31 10:34:06 +01:00
|
|
|
connection.console.log(`[Server(${process.pid}) ${workspaceFolder}] Started and initialize received`);
|
2017-08-23 16:40:19 +02:00
|
|
|
return {
|
|
|
|
|
capabilities: {
|
|
|
|
|
textDocumentSync: {
|
|
|
|
|
openClose: true,
|
|
|
|
|
change: TextDocumentSyncKind.None
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
connection.listen();
|