🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

typescript-language-server

Package Overview
Dependencies
Maintainers
2
Versions
137
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

to
0.3.0-next.a6cf729

lib/organize-imports.d.ts

1

lib/commands.d.ts

@@ -9,2 +9,3 @@ /**

const APPLY_REFACTORING = "_typescript.applyRefactoring";
const ORGANIZE_IMPORTS = "_typescript.organizeImports";
/** Commands below should be implemented by the client */

@@ -11,0 +12,0 @@ const APPLY_COMPLETION_CODE_ACTION = "_typescript.applyCompletionCodeAction";

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

Commands.APPLY_REFACTORING = "_typescript.applyRefactoring";
Commands.ORGANIZE_IMPORTS = '_typescript.organizeImports';
/** Commands below should be implemented by the client */

@@ -20,0 +21,0 @@ Commands.APPLY_COMPLETION_CODE_ACTION = "_typescript.applyCompletionCodeAction";

2

lib/lsp-server.d.ts

@@ -56,3 +56,3 @@ import * as lsp from 'vscode-languageserver';

executeCommand(arg: lsp.ExecuteCommandParams): Promise<void>;
protected applyFileCodeEdits(edits: tsp.FileCodeEdits[]): Promise<boolean>;
protected applyFileCodeEdits(edits: ReadonlyArray<tsp.FileCodeEdits>): Promise<boolean>;
documentHighlight(arg: lsp.TextDocumentPositionParams): Promise<lsp.DocumentHighlight[]>;

@@ -59,0 +59,0 @@ private rootPath;

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

const refactor_1 = require("./refactor");
const organize_imports_1 = require("./organize-imports");
class LspServer {

@@ -106,3 +107,4 @@ constructor(options) {

commands_1.Commands.APPLY_CODE_ACTION,
commands_1.Commands.APPLY_REFACTORING
commands_1.Commands.APPLY_REFACTORING,
commands_1.Commands.ORGANIZE_IMPORTS
]

@@ -459,4 +461,7 @@ },

return __awaiter(this, void 0, void 0, function* () {
const path = protocol_translation_1.uriToPath(params.textDocument.uri);
this.logger.log('documentFormatting', params, path);
const file = protocol_translation_1.uriToPath(params.textDocument.uri);
this.logger.log('documentFormatting', params, file);
if (!file) {
return [];
}
let opts = Object.assign({}, params.options);

@@ -481,3 +486,3 @@ // translate

const response = yield this.tspClient.request("format" /* Format */, {
file: path,
file,
line: 1,

@@ -536,2 +541,3 @@ offset: 1,

refactor_1.provideRefactors(yield this.getRefactors(args), codeActions, args);
organize_imports_1.provideOrganizeImports(file, params.context, codeActions);
return codeActions;

@@ -565,3 +571,3 @@ });

const edit = arg.arguments[0];
this.options.lspClient.applyWorkspaceEdit({
yield this.options.lspClient.applyWorkspaceEdit({
edit

@@ -603,2 +609,12 @@ });

}
else if (arg.command === commands_1.Commands.ORGANIZE_IMPORTS && arg.arguments) {
const file = arg.arguments[0];
const { body } = yield this.tspClient.request("organizeImports" /* OrganizeImports */, {
scope: {
type: 'file',
args: { file }
}
});
yield this.applyFileCodeEdits(body);
}
else {

@@ -626,8 +642,11 @@ this.logger.error(`Unknown command ${arg.command}.`);

return __awaiter(this, void 0, void 0, function* () {
this.logger.log('documentHighlight', arg);
const file = protocol_translation_1.uriToPath(arg.textDocument.uri);
this.logger.log('documentHighlight', arg, file);
if (!file) {
return [];
}
let response;
const file = protocol_translation_1.uriToPath(arg.textDocument.uri);
try {
response = yield this.tspClient.request("documentHighlights" /* DocumentHighlights */, {
file: file,
file,
line: arg.position.line + 1,

@@ -634,0 +653,0 @@ offset: arg.position.character + 1,

@@ -12,2 +12,35 @@ import * as protocol from 'typescript/lib/protocol';

}
interface TypeScriptRequestTypes {
'geterr': [protocol.GeterrRequestArgs, any];
'documentHighlights': [protocol.DocumentHighlightsRequestArgs, protocol.DocumentHighlightsResponse];
'applyCodeActionCommand': [protocol.ApplyCodeActionCommandRequestArgs, protocol.ApplyCodeActionCommandResponse];
'completionEntryDetails': [protocol.CompletionDetailsRequestArgs, protocol.CompletionDetailsResponse];
'completionInfo': [protocol.CompletionsRequestArgs, protocol.CompletionInfoResponse];
'completions': [protocol.CompletionsRequestArgs, protocol.CompletionsResponse];
'configure': [protocol.ConfigureRequestArguments, protocol.ConfigureResponse];
'definition': [protocol.FileLocationRequestArgs, protocol.DefinitionResponse];
'definitionAndBoundSpan': [protocol.FileLocationRequestArgs, protocol.DefinitionInfoAndBoundSpanReponse];
'docCommentTemplate': [protocol.FileLocationRequestArgs, protocol.DocCommandTemplateResponse];
'format': [protocol.FormatRequestArgs, protocol.FormatResponse];
'formatonkey': [protocol.FormatOnKeyRequestArgs, protocol.FormatResponse];
'getApplicableRefactors': [protocol.GetApplicableRefactorsRequestArgs, protocol.GetApplicableRefactorsResponse];
'getCodeFixes': [protocol.CodeFixRequestArgs, protocol.GetCodeFixesResponse];
'getCombinedCodeFix': [protocol.GetCombinedCodeFixRequestArgs, protocol.GetCombinedCodeFixResponse];
'getEditsForFileRename': [protocol.GetEditsForFileRenameRequestArgs, protocol.GetEditsForFileRenameResponse];
'getEditsForRefactor': [protocol.GetEditsForRefactorRequestArgs, protocol.GetEditsForRefactorResponse];
'getOutliningSpans': [protocol.FileRequestArgs, protocol.OutliningSpansResponse];
'getSupportedCodeFixes': [null, protocol.GetSupportedCodeFixesResponse];
'implementation': [protocol.FileLocationRequestArgs, protocol.ImplementationResponse];
'jsxClosingTag': [protocol.JsxClosingTagRequestArgs, protocol.JsxClosingTagResponse];
'navto': [protocol.NavtoRequestArgs, protocol.NavtoResponse];
'navtree': [protocol.FileRequestArgs, protocol.NavTreeResponse];
'occurrences': [protocol.FileLocationRequestArgs, protocol.OccurrencesResponse];
'organizeImports': [protocol.OrganizeImportsRequestArgs, protocol.OrganizeImportsResponse];
'projectInfo': [protocol.ProjectInfoRequestArgs, protocol.ProjectInfoResponse];
'quickinfo': [protocol.FileLocationRequestArgs, protocol.QuickInfoResponse];
'references': [protocol.FileLocationRequestArgs, protocol.ReferencesResponse];
'rename': [protocol.RenameRequestArgs, protocol.RenameResponse];
'signatureHelp': [protocol.SignatureHelpRequestArgs, protocol.SignatureHelpResponse];
'typeDefinition': [protocol.FileLocationRequestArgs, protocol.TypeDefinitionResponse];
}
export declare class TspClient {

@@ -30,23 +63,3 @@ private options;

notify(command: CommandTypes.Change, args: protocol.ChangeRequestArgs): any;
request(command: CommandTypes.GetEditsForRefactor, args: protocol.GetEditsForRefactorRequestArgs): Promise<protocol.GetEditsForRefactorResponse>;
request(command: CommandTypes.ApplyCodeActionCommand, args: protocol.ApplyCodeActionCommandRequestArgs): Promise<protocol.ApplyCodeActionCommandResponse>;
request(command: CommandTypes.Configure, args: protocol.ConfigureRequestArguments): Promise<protocol.ConfigureResponse>;
request(command: CommandTypes.Definition, args: protocol.FileLocationRequestArgs): Promise<protocol.DefinitionResponse>;
request(command: CommandTypes.Implementation, args: protocol.FileLocationRequestArgs): Promise<protocol.ImplementationResponse>;
request(command: CommandTypes.TypeDefinition, args: protocol.FileLocationRequestArgs): Promise<protocol.TypeDefinitionResponse>;
request(command: CommandTypes.Format, args: protocol.FormatRequestArgs): Promise<protocol.FormatResponse>;
request(command: CommandTypes.GetApplicableRefactors, args: protocol.GetApplicableRefactorsRequestArgs): Promise<protocol.GetApplicableRefactorsResponse>;
request(command: CommandTypes.GetCodeFixes, args: protocol.CodeFixRequestArgs): Promise<protocol.GetCodeFixesResponse>;
request(command: CommandTypes.Geterr, args: protocol.GeterrRequestArgs, token?: CancellationToken): Promise<protocol.RequestCompletedEvent>;
request(command: CommandTypes.GeterrForProject, args: protocol.GeterrForProjectRequestArgs): Promise<protocol.RequestCompletedEvent>;
request(command: CommandTypes.Navto, args: protocol.NavtoRequestArgs): Promise<protocol.NavtoResponse>;
request(command: CommandTypes.NavTree, args: protocol.FileRequestArgs): Promise<protocol.NavTreeResponse>;
request(command: CommandTypes.Completions, args: protocol.CompletionsRequestArgs): Promise<protocol.CompletionsResponse>;
request(command: CommandTypes.CompletionDetails, args: protocol.CompletionDetailsRequestArgs): Promise<protocol.CompletionDetailsResponse>;
request(command: CommandTypes.DocumentHighlights, args: protocol.DocumentHighlightsRequestArgs): Promise<protocol.DocumentHighlightsResponse>;
request(command: CommandTypes.Quickinfo, args: protocol.FileLocationRequestArgs): Promise<protocol.QuickInfoResponse>;
request(command: CommandTypes.Rename, args: protocol.RenameRequestArgs): Promise<protocol.RenameResponse>;
request(command: CommandTypes.References, args: protocol.FileLocationRequestArgs): Promise<protocol.ReferencesResponse>;
request(command: CommandTypes.SignatureHelp, args: protocol.SignatureHelpRequestArgs): Promise<protocol.SignatureHelpResponse>;
request(command: CommandTypes.GetOutliningSpans, args: protocol.FileRequestArgs): Promise<protocol.OutliningSpansResponse>;
request<K extends keyof TypeScriptRequestTypes>(command: K, args: TypeScriptRequestTypes[K][0], token?: CancellationToken): Promise<TypeScriptRequestTypes[K][1]>;
protected sendMessage(command: string, notification: boolean, args?: any): void;

@@ -59,2 +72,3 @@ protected processMessage(untrimmedMessageString: string): void;

}
export {};
//# sourceMappingURL=tsp-client.d.ts.map
{
"name": "typescript-language-server",
"version": "0.3.0-next.5dc5868",
"version": "0.3.0-next.a6cf729",
"description": "Language Server Protocol (LSP) implementation for TypeScript using tsserver",

@@ -37,3 +37,3 @@ "author": "TypeFox and others",

},
"gitHead": "5dc5868226e1039f672b290f5c7ac7aa3ecba1db"
"gitHead": "a6cf729248ddd5c33ef7b16d29aa03fc751b4293"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet