![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
typescript-language-server
Advanced tools
Language Server Protocol (LSP) implementation for TypeScript using tsserver
The typescript-language-server is an implementation of the Language Server Protocol (LSP) for TypeScript. It provides a range of features to enhance the development experience in editors and IDEs by offering functionalities like auto-completion, go-to-definition, and more.
Auto-completion
This code sets up a basic TypeScript Language Server that provides auto-completion suggestions. When the user types, the server can suggest completions like 'console.log'.
const { createConnection, TextDocuments } = require('vscode-languageserver');
const connection = createConnection();
const documents = new TextDocuments();
connection.onInitialize(() => {
return {
capabilities: {
textDocumentSync: documents.syncKind,
completionProvider: {
resolveProvider: true
}
}
};
});
connection.onCompletion(() => {
return [
{
label: 'console.log',
kind: 1,
data: 1
}
];
});
connection.listen();
Go-to-definition
This code sets up a TypeScript Language Server that provides go-to-definition functionality. When the user requests the definition of a symbol, the server responds with the location of the definition.
const { createConnection, TextDocuments } = require('vscode-languageserver');
const connection = createConnection();
const documents = new TextDocuments();
connection.onInitialize(() => {
return {
capabilities: {
textDocumentSync: documents.syncKind,
definitionProvider: true
}
};
});
connection.onDefinition((params) => {
return {
uri: params.textDocument.uri,
range: {
start: { line: 0, character: 0 },
end: { line: 0, character: 10 }
}
};
});
connection.listen();
Diagnostics
This code sets up a TypeScript Language Server that provides diagnostics. It scans the document for 'TODO' comments and reports them as warnings.
const { createConnection, TextDocuments, Diagnostic, DiagnosticSeverity } = require('vscode-languageserver');
const connection = createConnection();
const documents = new TextDocuments();
connection.onInitialize(() => {
return {
capabilities: {
textDocumentSync: documents.syncKind
}
};
});
documents.onDidChangeContent((change) => {
const diagnostics = [];
const text = change.document.getText();
const pattern = /TODO/g;
let match;
while ((match = pattern.exec(text))) {
diagnostics.push({
severity: DiagnosticSeverity.Warning,
range: {
start: change.document.positionAt(match.index),
end: change.document.positionAt(match.index + match[0].length)
},
message: `TODO found: ${match[0]}`,
source: 'ex'
});
}
connection.sendDiagnostics({ uri: change.document.uri, diagnostics });
});
connection.listen();
The vscode-json-languageserver is a Language Server Protocol implementation for JSON. It provides similar functionalities like auto-completion, go-to-definition, and diagnostics but is specifically tailored for JSON files. Compared to typescript-language-server, it is focused on JSON rather than TypeScript.
The vscode-css-languageserver-bin is a Language Server Protocol implementation for CSS. It offers features like auto-completion, go-to-definition, and diagnostics for CSS files. While typescript-language-server is for TypeScript, this package is specialized for CSS.
The vscode-html-languageserver-bin is a Language Server Protocol implementation for HTML. It provides functionalities such as auto-completion, go-to-definition, and diagnostics for HTML files. This package is similar to typescript-language-server but is designed for HTML.
Language Server Protocol implementation for Typescript via tsserver.cmd
WIP
npm install -g typescript-language-server
typescript-language-server --stdio
FAQs
Language Server Protocol (LSP) implementation for TypeScript using tsserver
The npm package typescript-language-server receives a total of 87,470 weekly downloads. As such, typescript-language-server popularity was classified as popular.
We found that typescript-language-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.