New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typescript-language-server

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-language-server - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

29

lib/server.js

@@ -27,2 +27,3 @@ "use strict";

this.connection.onReferences(this.onReferences.bind(this));
this.connection.onRenameRequest(this.onRename.bind(this));
this.connection.onWorkspaceSymbol(this.onWorkspaceSymbol.bind(this));

@@ -54,2 +55,3 @@ }

hoverProvider: true,
renameProvider: true,
referencesProvider: true,

@@ -160,2 +162,29 @@ workspaceSymbolProvider: true

}
onRename(params) {
const path = utils.uriToPath(params.textDocument.uri);
this.logger.info('Server.onRename()', params, path);
return this.tsServerClient.sendRename(path, params.position.line + 1, params.position.character + 1)
.then(result => {
if (!result.body || !result.body.info.canRename || result.body.locs.length == 0) {
return {};
}
const workspaceEdit = {
changes: {}
};
result.body.locs
.forEach((spanGroup) => {
const uri = utils.pathToUri(spanGroup.file), textEdits = workspaceEdit.changes[uri] || (workspaceEdit.changes[uri] = []);
spanGroup.locs.forEach((textSpan) => {
textEdits.push({
newText: params.newName,
range: {
start: utils.tsServerLocationToLspPosition(textSpan.start),
end: utils.tsServerLocationToLspPosition(textSpan.end)
}
});
});
});
return workspaceEdit;
});
}
onReferences(params) {

@@ -162,0 +191,0 @@ const path = utils.uriToPath(params.textDocument.uri);

@@ -154,2 +154,7 @@ "use strict";

}
sendRename(file, line, offset) {
const args = { file, line, offset };
this.logger.info('TsServerClient.sendRename()', args);
return this.sendRequest('rename', false, args);
}
sendReferences(file, line, offset) {

@@ -156,0 +161,0 @@ const args = { file, line, offset };

2

package.json
{
"name": "typescript-language-server",
"version": "0.0.15",
"version": "0.0.16",
"description": "Language Server Protocol (LSP) implementation for TypeScript using tsserver",

@@ -5,0 +5,0 @@ "scripts": {

@@ -49,2 +49,3 @@ # typescript-language-server

* textDocument/hover
* textDocument/rename
* textDocument/references

@@ -51,0 +52,0 @@ * workspace/symbol

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc