vscode-css-languageserver-bin
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -13,2 +13,3 @@ #!/usr/bin/env node | ||
var languageModelCache_1 = require("./languageModelCache"); | ||
var errors_1 = require("./utils/errors"); | ||
// Create a connection for the server. | ||
@@ -18,2 +19,5 @@ var connection = vscode_languageserver_1.createConnection(); | ||
console.error = connection.console.error.bind(connection.console); | ||
process.on('unhandledRejection', function (e) { | ||
connection.console.error(errors_1.formatError("Unhandled exception", e)); | ||
}); | ||
// Create a simple text document manager. The text document manager | ||
@@ -105,3 +109,3 @@ // supports full document sync only | ||
var pendingValidationRequests = {}; | ||
var validationDelayMs = 200; | ||
var validationDelayMs = 500; | ||
// The content of a text document has changed. This event is emitted | ||
@@ -138,61 +142,83 @@ // when the text document first opened or when its content has changed. | ||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics: diagnostics }); | ||
}, function (e) { | ||
connection.console.error(errors_1.formatError("Error while validating " + textDocument.uri, e)); | ||
}); | ||
} | ||
connection.onCompletion(function (textDocumentPosition) { | ||
var document = documents.get(textDocumentPosition.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheet); /* TODO: remove ! once LS has null annotations */ | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(textDocumentPosition.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).doComplete(document, textDocumentPosition.position, stylesheet); /* TODO: remove ! once LS has null annotations */ | ||
}, null, "Error while computing completions for " + textDocumentPosition.textDocument.uri); | ||
}); | ||
connection.onHover(function (textDocumentPosition) { | ||
var document = documents.get(textDocumentPosition.textDocument.uri); | ||
var styleSheet = stylesheets.get(document); | ||
return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet); /* TODO: remove ! once LS has null annotations */ | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(textDocumentPosition.textDocument.uri); | ||
var styleSheet = stylesheets.get(document); | ||
return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet); /* TODO: remove ! once LS has null annotations */ | ||
}, null, "Error while computing hover for " + textDocumentPosition.textDocument.uri); | ||
}); | ||
connection.onDocumentSymbol(function (documentSymbolParams) { | ||
var document = documents.get(documentSymbolParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDocumentSymbols(document, stylesheet); | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(documentSymbolParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDocumentSymbols(document, stylesheet); | ||
}, [], "Error while computing document symbols for " + documentSymbolParams.textDocument.uri); | ||
}); | ||
connection.onDefinition(function (documentSymbolParams) { | ||
var document = documents.get(documentSymbolParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDefinition(document, documentSymbolParams.position, stylesheet); | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(documentSymbolParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDefinition(document, documentSymbolParams.position, stylesheet); | ||
}, null, "Error while computing definitions for " + documentSymbolParams.textDocument.uri); | ||
}); | ||
connection.onDocumentHighlight(function (documentSymbolParams) { | ||
var document = documents.get(documentSymbolParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDocumentHighlights(document, documentSymbolParams.position, stylesheet); | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(documentSymbolParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDocumentHighlights(document, documentSymbolParams.position, stylesheet); | ||
}, [], "Error while computing document highlights for " + documentSymbolParams.textDocument.uri); | ||
}); | ||
connection.onReferences(function (referenceParams) { | ||
var document = documents.get(referenceParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findReferences(document, referenceParams.position, stylesheet); | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(referenceParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findReferences(document, referenceParams.position, stylesheet); | ||
}, [], "Error while computing references for " + referenceParams.textDocument.uri); | ||
}); | ||
connection.onCodeAction(function (codeActionParams) { | ||
var document = documents.get(codeActionParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).doCodeActions(document, codeActionParams.range, codeActionParams.context, stylesheet); | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(codeActionParams.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).doCodeActions(document, codeActionParams.range, codeActionParams.context, stylesheet); | ||
}, [], "Error while computing code actions for " + codeActionParams.textDocument.uri); | ||
}); | ||
connection.onRequest(protocol_colorProvider_proposed_1.DocumentColorRequest.type, function (params) { | ||
var document = documents.get(params.textDocument.uri); | ||
if (document) { | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDocumentColors(document, stylesheet); | ||
} | ||
return []; | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(params.textDocument.uri); | ||
if (document) { | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).findDocumentColors(document, stylesheet); | ||
} | ||
return []; | ||
}, [], "Error while computing document colors for " + params.textDocument.uri); | ||
}); | ||
connection.onRequest(protocol_colorProvider_proposed_1.ColorPresentationRequest.type, function (params) { | ||
var document = documents.get(params.textDocument.uri); | ||
if (document) { | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).getColorPresentations(document, stylesheet, params.color, params.range); | ||
} | ||
return []; | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(params.textDocument.uri); | ||
if (document) { | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).getColorPresentations(document, stylesheet, params.color, params.range); | ||
} | ||
return []; | ||
}, [], "Error while computing color presentations for " + params.textDocument.uri); | ||
}); | ||
connection.onRenameRequest(function (renameParameters) { | ||
var document = documents.get(renameParameters.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).doRename(document, renameParameters.position, renameParameters.newName, stylesheet); | ||
return errors_1.runSafe(function () { | ||
var document = documents.get(renameParameters.textDocument.uri); | ||
var stylesheet = stylesheets.get(document); | ||
return getLanguageService(document).doRename(document, renameParameters.position, renameParameters.newName, stylesheet); | ||
}, null, "Error while computing renames for " + renameParameters.textDocument.uri); | ||
}); | ||
// Listen on the connection | ||
connection.listen(); |
{ | ||
"name": "vscode-css-languageserver-bin", | ||
"description": "CSS/LESS/SCSS language server", | ||
"version": "1.1.0", | ||
"author": "Microsoft Corporation", | ||
"description": "Binary version published on npm of vscode-css-languageserver extracted from VSCode tree", | ||
"version": "1.2.0", | ||
"author": "VSCode Langservers", | ||
"license": "MIT", | ||
@@ -11,3 +11,3 @@ "engines": { | ||
"dependencies": { | ||
"vscode-css-languageservice": "^3.0.1", | ||
"vscode-css-languageservice": "^3.0.3", | ||
"vscode-languageserver": "^3.5.0" | ||
@@ -14,0 +14,0 @@ }, |
16374
4
330