typescript-language-server 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/LICENSE +39 -0
- package/README.md +15 -0
- package/lib/completion.d.ts +1 -1
- package/lib/completion.d.ts.map +1 -1
- package/lib/completion.js +10 -3
- package/lib/completion.js.map +1 -1
- package/lib/configuration-manager.d.ts +3 -10
- package/lib/configuration-manager.d.ts.map +1 -1
- package/lib/configuration-manager.js +23 -3
- package/lib/configuration-manager.js.map +1 -1
- package/lib/features/inlay-hints.js +2 -2
- package/lib/features/inlay-hints.js.map +1 -1
- package/lib/lsp-server.d.ts +2 -4
- package/lib/lsp-server.d.ts.map +1 -1
- package/lib/lsp-server.js +48 -86
- package/lib/lsp-server.js.map +1 -1
- package/lib/lsp-server.spec.js +84 -6
- package/lib/lsp-server.spec.js.map +1 -1
- package/lib/refactor.d.ts +2 -1
- package/lib/refactor.d.ts.map +1 -1
- package/lib/refactor.js +17 -7
- package/lib/refactor.js.map +1 -1
- package/lib/test-utils.d.ts +16 -0
- package/lib/test-utils.d.ts.map +1 -1
- package/lib/test-utils.js +5 -4
- package/lib/test-utils.js.map +1 -1
- package/lib/ts-protocol.d.ts +3 -1
- package/lib/ts-protocol.d.ts.map +1 -1
- package/lib/tsServer/callbackMap.d.ts +17 -0
- package/lib/tsServer/callbackMap.d.ts.map +1 -0
- package/lib/tsServer/callbackMap.js +47 -0
- package/lib/tsServer/callbackMap.js.map +1 -0
- package/lib/tsServer/cancellation.d.ts +19 -0
- package/lib/tsServer/cancellation.d.ts.map +1 -0
- package/lib/tsServer/cancellation.js +52 -0
- package/lib/tsServer/cancellation.js.map +1 -0
- package/lib/tsServer/requestQueue.d.ts +34 -0
- package/lib/tsServer/requestQueue.d.ts.map +1 -0
- package/lib/tsServer/requestQueue.js +74 -0
- package/lib/tsServer/requestQueue.js.map +1 -0
- package/lib/tsServer/requests.d.ts +68 -0
- package/lib/tsServer/requests.d.ts.map +1 -0
- package/lib/tsServer/requests.js +28 -0
- package/lib/tsServer/requests.js.map +1 -0
- package/lib/tsServer/server.d.ts +93 -0
- package/lib/tsServer/server.d.ts.map +1 -0
- package/lib/tsServer/server.js +208 -0
- package/lib/tsServer/server.js.map +1 -0
- package/lib/tsServer/serverError.d.ts +18 -0
- package/lib/tsServer/serverError.d.ts.map +1 -0
- package/lib/tsServer/serverError.js +53 -0
- package/lib/tsServer/serverError.js.map +1 -0
- package/lib/tsServer/serverProcess.d.ts +7 -0
- package/lib/tsServer/serverProcess.d.ts.map +1 -0
- package/lib/tsServer/serverProcess.js +238 -0
- package/lib/tsServer/serverProcess.js.map +1 -0
- package/lib/tsServer/spawner.d.ts +14 -0
- package/lib/tsServer/spawner.d.ts.map +1 -0
- package/lib/tsServer/spawner.js +122 -0
- package/lib/tsServer/spawner.js.map +1 -0
- package/lib/{utils → tsServer}/versionProvider.d.ts +2 -2
- package/lib/tsServer/versionProvider.d.ts.map +1 -0
- package/lib/{utils → tsServer}/versionProvider.js +2 -2
- package/lib/tsServer/versionProvider.js.map +1 -0
- package/lib/tsp-client.d.ts +17 -52
- package/lib/tsp-client.d.ts.map +1 -1
- package/lib/tsp-client.js +186 -139
- package/lib/tsp-client.js.map +1 -1
- package/lib/tsp-client.spec.js +11 -6
- package/lib/tsp-client.spec.js.map +1 -1
- package/lib/utils/api.d.ts +1 -0
- package/lib/utils/api.d.ts.map +1 -1
- package/lib/utils/api.js +1 -0
- package/lib/utils/api.js.map +1 -1
- package/lib/utils/modules-resolver.spec.js +1 -1
- package/lib/utils/modules-resolver.spec.js.map +1 -1
- package/package.json +8 -8
- package/lib/utils/versionProvider.d.ts.map +0 -1
- package/lib/utils/versionProvider.js.map +0 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (C) 2022 TypeFox and others.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*/
|
|
11
|
+
import ChildProcess from 'node:child_process';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import API from '../utils/api.js';
|
|
14
|
+
export class NodeTsServerProcessFactory {
|
|
15
|
+
fork(version, args, kind, configuration) {
|
|
16
|
+
const tsServerPath = version.tsServerPath;
|
|
17
|
+
const useIpc = version.version?.gte(API.v460);
|
|
18
|
+
const runtimeArgs = [...args];
|
|
19
|
+
if (useIpc) {
|
|
20
|
+
runtimeArgs.push('--useNodeIpc');
|
|
21
|
+
}
|
|
22
|
+
const childProcess = ChildProcess.fork(tsServerPath, runtimeArgs, {
|
|
23
|
+
silent: true,
|
|
24
|
+
cwd: undefined,
|
|
25
|
+
env: generatePatchedEnv(process.env, tsServerPath),
|
|
26
|
+
execArgv: getExecArgv(kind, configuration),
|
|
27
|
+
stdio: useIpc ? ['pipe', 'pipe', 'pipe', 'ipc'] : undefined,
|
|
28
|
+
});
|
|
29
|
+
return useIpc ? new IpcChildServerProcess(childProcess) : new StdioChildServerProcess(childProcess);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function generatePatchedEnv(env, modulePath) {
|
|
33
|
+
const newEnv = Object.assign({}, env);
|
|
34
|
+
newEnv.NODE_PATH = path.join(modulePath, '..', '..', '..');
|
|
35
|
+
// Ensure we always have a PATH set
|
|
36
|
+
newEnv.PATH = newEnv.PATH || process.env.PATH;
|
|
37
|
+
return newEnv;
|
|
38
|
+
}
|
|
39
|
+
function getExecArgv(kind, configuration) {
|
|
40
|
+
const args = [];
|
|
41
|
+
const debugPort = getDebugPort(kind);
|
|
42
|
+
if (debugPort) {
|
|
43
|
+
const inspectFlag = getTssDebugBrk() ? '--inspect-brk' : '--inspect';
|
|
44
|
+
args.push(`${inspectFlag}=${debugPort}`);
|
|
45
|
+
}
|
|
46
|
+
if (configuration.maxTsServerMemory) {
|
|
47
|
+
args.push(`--max-old-space-size=${configuration.maxTsServerMemory}`);
|
|
48
|
+
}
|
|
49
|
+
return args;
|
|
50
|
+
}
|
|
51
|
+
function getDebugPort(kind) {
|
|
52
|
+
if (kind === "syntax" /* TsServerProcessKind.Syntax */) {
|
|
53
|
+
// We typically only want to debug the main semantic server
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const value = getTssDebugBrk() || getTssDebug();
|
|
57
|
+
if (value) {
|
|
58
|
+
const port = parseInt(value);
|
|
59
|
+
if (!isNaN(port)) {
|
|
60
|
+
return port;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
function getTssDebug() {
|
|
66
|
+
return process.env.TSS_DEBUG;
|
|
67
|
+
}
|
|
68
|
+
function getTssDebugBrk() {
|
|
69
|
+
return process.env.TSS_DEBUG_BRK;
|
|
70
|
+
}
|
|
71
|
+
class IpcChildServerProcess {
|
|
72
|
+
constructor(_process) {
|
|
73
|
+
this._process = _process;
|
|
74
|
+
}
|
|
75
|
+
write(serverRequest) {
|
|
76
|
+
this._process.send(serverRequest);
|
|
77
|
+
}
|
|
78
|
+
onData(handler) {
|
|
79
|
+
this._process.on('message', handler);
|
|
80
|
+
}
|
|
81
|
+
onExit(handler) {
|
|
82
|
+
this._process.on('exit', handler);
|
|
83
|
+
}
|
|
84
|
+
onError(handler) {
|
|
85
|
+
this._process.on('error', handler);
|
|
86
|
+
}
|
|
87
|
+
kill() {
|
|
88
|
+
this._process.kill();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
class StdioChildServerProcess {
|
|
92
|
+
constructor(_process) {
|
|
93
|
+
this._process = _process;
|
|
94
|
+
this._reader = new Reader(this._process.stdout);
|
|
95
|
+
}
|
|
96
|
+
get reader() {
|
|
97
|
+
return this._reader;
|
|
98
|
+
}
|
|
99
|
+
write(serverRequest) {
|
|
100
|
+
this._process.stdin.write(JSON.stringify(serverRequest) + '\r\n', 'utf8');
|
|
101
|
+
}
|
|
102
|
+
onData(handler) {
|
|
103
|
+
this.reader.onData(handler);
|
|
104
|
+
}
|
|
105
|
+
onExit(handler) {
|
|
106
|
+
this._process.on('exit', handler);
|
|
107
|
+
}
|
|
108
|
+
onError(handler) {
|
|
109
|
+
this._process.on('error', handler);
|
|
110
|
+
this.reader.onError(handler);
|
|
111
|
+
}
|
|
112
|
+
kill() {
|
|
113
|
+
this._process.kill();
|
|
114
|
+
this.reader.dispose();
|
|
115
|
+
this._reader = null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
class Reader {
|
|
119
|
+
constructor(readable) {
|
|
120
|
+
this.buffer = new ProtocolBuffer();
|
|
121
|
+
this.nextMessageLength = -1;
|
|
122
|
+
this._onError = (_error) => { };
|
|
123
|
+
this._onData = (_data) => { };
|
|
124
|
+
this.isDisposed = false;
|
|
125
|
+
readable.on('data', data => this.onLengthData(data));
|
|
126
|
+
}
|
|
127
|
+
dispose() {
|
|
128
|
+
this.isDisposed = true;
|
|
129
|
+
this._onError = (_error) => { };
|
|
130
|
+
this._onData = (_data) => { };
|
|
131
|
+
}
|
|
132
|
+
onError(handler) {
|
|
133
|
+
this._onError = handler;
|
|
134
|
+
}
|
|
135
|
+
onData(handler) {
|
|
136
|
+
this._onData = handler;
|
|
137
|
+
}
|
|
138
|
+
onLengthData(data) {
|
|
139
|
+
if (this.isDisposed) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
this.buffer.append(data);
|
|
144
|
+
// eslint-disable-next-line no-constant-condition
|
|
145
|
+
while (true) {
|
|
146
|
+
if (this.nextMessageLength === -1) {
|
|
147
|
+
this.nextMessageLength = this.buffer.tryReadContentLength();
|
|
148
|
+
if (this.nextMessageLength === -1) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const msg = this.buffer.tryReadContent(this.nextMessageLength);
|
|
153
|
+
if (msg === null) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.nextMessageLength = -1;
|
|
157
|
+
const json = JSON.parse(msg);
|
|
158
|
+
this._onData(json);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
this._onError(e);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const defaultSize = 8192;
|
|
167
|
+
const contentLength = 'Content-Length: ';
|
|
168
|
+
const contentLengthSize = Buffer.byteLength(contentLength, 'utf8');
|
|
169
|
+
const blank = Buffer.from(' ', 'utf8')[0];
|
|
170
|
+
const backslashR = Buffer.from('\r', 'utf8')[0];
|
|
171
|
+
const backslashN = Buffer.from('\n', 'utf8')[0];
|
|
172
|
+
class ProtocolBuffer {
|
|
173
|
+
constructor() {
|
|
174
|
+
this.index = 0;
|
|
175
|
+
this.buffer = Buffer.allocUnsafe(defaultSize);
|
|
176
|
+
}
|
|
177
|
+
append(data) {
|
|
178
|
+
let toAppend = null;
|
|
179
|
+
if (Buffer.isBuffer(data)) {
|
|
180
|
+
toAppend = data;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
toAppend = Buffer.from(data, 'utf8');
|
|
184
|
+
}
|
|
185
|
+
if (this.buffer.length - this.index >= toAppend.length) {
|
|
186
|
+
toAppend.copy(this.buffer, this.index, 0, toAppend.length);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const newSize = (Math.ceil((this.index + toAppend.length) / defaultSize) + 1) * defaultSize;
|
|
190
|
+
if (this.index === 0) {
|
|
191
|
+
this.buffer = Buffer.allocUnsafe(newSize);
|
|
192
|
+
toAppend.copy(this.buffer, 0, 0, toAppend.length);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
this.index += toAppend.length;
|
|
199
|
+
}
|
|
200
|
+
tryReadContentLength() {
|
|
201
|
+
let result = -1;
|
|
202
|
+
let current = 0;
|
|
203
|
+
// we are utf8 encoding...
|
|
204
|
+
while (current < this.index && (this.buffer[current] === blank || this.buffer[current] === backslashR || this.buffer[current] === backslashN)) {
|
|
205
|
+
current++;
|
|
206
|
+
}
|
|
207
|
+
if (this.index < current + contentLengthSize) {
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
current += contentLengthSize;
|
|
211
|
+
const start = current;
|
|
212
|
+
while (current < this.index && this.buffer[current] !== backslashR) {
|
|
213
|
+
current++;
|
|
214
|
+
}
|
|
215
|
+
if (current + 3 >= this.index || this.buffer[current + 1] !== backslashN || this.buffer[current + 2] !== backslashR || this.buffer[current + 3] !== backslashN) {
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
const data = this.buffer.toString('utf8', start, current);
|
|
219
|
+
result = parseInt(data);
|
|
220
|
+
this.buffer = this.buffer.slice(current + 4);
|
|
221
|
+
this.index = this.index - (current + 4);
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
tryReadContent(length) {
|
|
225
|
+
if (this.index < length) {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
const result = this.buffer.toString('utf8', 0, length);
|
|
229
|
+
let sourceStart = length;
|
|
230
|
+
while (sourceStart < this.index && (this.buffer[sourceStart] === backslashR || this.buffer[sourceStart] === backslashN)) {
|
|
231
|
+
sourceStart++;
|
|
232
|
+
}
|
|
233
|
+
this.buffer.copy(this.buffer, 0, sourceStart);
|
|
234
|
+
this.index = this.index - sourceStart;
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=serverProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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,GAAG,CAAC,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,cAAc,CAAC,MAAc;QAChC,IAAI,IAAI,CAAC,KAAK,GAAG,MAAM,EAAE;YACrB,OAAO,IAAI,CAAC;SACf;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACvD,IAAI,WAAW,GAAG,MAAM,CAAC;QACzB,OAAO,WAAW,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC,EAAE;YACrH,WAAW,EAAE,CAAC;SACjB;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;QACtC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import API from '../utils/api.js';
|
|
2
|
+
import { Logger } from '../logger.js';
|
|
3
|
+
import type { TspClientOptions } from '../tsp-client.js';
|
|
4
|
+
import { ITypeScriptServer } from './server.js';
|
|
5
|
+
import type { TypeScriptVersion } from './versionProvider.js';
|
|
6
|
+
export declare class TypeScriptServerSpawner {
|
|
7
|
+
private readonly _apiVersion;
|
|
8
|
+
private readonly _logger;
|
|
9
|
+
constructor(_apiVersion: API, _logger: Logger);
|
|
10
|
+
spawn(version: TypeScriptVersion, configuration: TspClientOptions): ITypeScriptServer;
|
|
11
|
+
private kindToServerType;
|
|
12
|
+
private getTsServerArgs;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=spawner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawner.d.ts","sourceRoot":"","sources":["../../src/tsServer/spawner.ts"],"names":[],"mappings":"AAWA,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAA6C,MAAM,aAAa,CAAC;AAE3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,qBAAa,uBAAuB;IAE5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAE5B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,WAAW,EAAE,GAAG,EAEhB,OAAO,EAAE,MAAM;IAG7B,KAAK,CACR,OAAO,EAAE,iBAAiB,EAC1B,aAAa,EAAE,gBAAgB,GAChC,iBAAiB;IAkBpB,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,eAAe;CA2F1B"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (C) 2017, 2018 TypeFox and others.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*/
|
|
11
|
+
import API from '../utils/api.js';
|
|
12
|
+
import { ServerType } from './requests.js';
|
|
13
|
+
import { nodeRequestCancellerFactory } from './cancellation.js';
|
|
14
|
+
import { ProcessBasedTsServer } from './server.js';
|
|
15
|
+
import { NodeTsServerProcessFactory } from './serverProcess.js';
|
|
16
|
+
export class TypeScriptServerSpawner {
|
|
17
|
+
constructor(_apiVersion,
|
|
18
|
+
// private readonly _logDirectoryProvider: ILogDirectoryProvider,
|
|
19
|
+
_logger) {
|
|
20
|
+
this._apiVersion = _apiVersion;
|
|
21
|
+
this._logger = _logger;
|
|
22
|
+
}
|
|
23
|
+
spawn(version, configuration) {
|
|
24
|
+
const kind = "main" /* TsServerProcessKind.Main */;
|
|
25
|
+
const processFactory = new NodeTsServerProcessFactory();
|
|
26
|
+
const canceller = nodeRequestCancellerFactory.create( /*kind, this._tracer*/);
|
|
27
|
+
const { args, tsServerLogFile } = this.getTsServerArgs("main" /* TsServerProcessKind.Main */, configuration, this._apiVersion, canceller.cancellationPipeName);
|
|
28
|
+
const process = processFactory.fork(version, args, "main" /* TsServerProcessKind.Main */, configuration);
|
|
29
|
+
this._logger.log('Starting tsserver');
|
|
30
|
+
return new ProcessBasedTsServer(kind, this.kindToServerType(kind), process, tsServerLogFile, canceller, version);
|
|
31
|
+
}
|
|
32
|
+
kindToServerType(kind) {
|
|
33
|
+
switch (kind) {
|
|
34
|
+
case "syntax" /* TsServerProcessKind.Syntax */:
|
|
35
|
+
return ServerType.Syntax;
|
|
36
|
+
case "main" /* TsServerProcessKind.Main */:
|
|
37
|
+
case "semantic" /* TsServerProcessKind.Semantic */:
|
|
38
|
+
case "diagnostics" /* TsServerProcessKind.Diagnostics */:
|
|
39
|
+
default:
|
|
40
|
+
return ServerType.Semantic;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
getTsServerArgs(kind, configuration,
|
|
44
|
+
// currentVersion: TypeScriptVersion,
|
|
45
|
+
apiVersion, cancellationPipeName) {
|
|
46
|
+
const args = [];
|
|
47
|
+
let tsServerLogFile;
|
|
48
|
+
let tsServerTraceDirectory;
|
|
49
|
+
if (kind === "syntax" /* TsServerProcessKind.Syntax */) {
|
|
50
|
+
if (apiVersion.gte(API.v401)) {
|
|
51
|
+
args.push('--serverMode', 'partialSemantic');
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
args.push('--syntaxOnly');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (apiVersion.gte(API.v250)) {
|
|
58
|
+
args.push('--useInferredProjectPerProjectRoot');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
args.push('--useSingleInferredProject');
|
|
62
|
+
}
|
|
63
|
+
const { disableAutomaticTypingAcquisition, globalPlugins, locale, logFile, logVerbosity, npmLocation, pluginProbeLocations, } = configuration;
|
|
64
|
+
if (disableAutomaticTypingAcquisition || kind === "syntax" /* TsServerProcessKind.Syntax */ || kind === "diagnostics" /* TsServerProcessKind.Diagnostics */) {
|
|
65
|
+
args.push('--disableAutomaticTypingAcquisition');
|
|
66
|
+
}
|
|
67
|
+
// if (kind === TsServerProcessKind.Semantic || kind === TsServerProcessKind.Main) {
|
|
68
|
+
// args.push('--enableTelemetry');
|
|
69
|
+
// }
|
|
70
|
+
if (cancellationPipeName) {
|
|
71
|
+
args.push('--cancellationPipeName', cancellationPipeName + '*');
|
|
72
|
+
}
|
|
73
|
+
// if (TspClient.isLoggingEnabled(configuration)) {
|
|
74
|
+
// const logDir = this._logDirectoryProvider.getNewLogDirectory();
|
|
75
|
+
// if (logDir) {
|
|
76
|
+
// tsServerLogFile = path.join(logDir, 'tsserver.log');
|
|
77
|
+
// args.push('--logVerbosity', TsServerLogLevel.toString(configuration.tsServerLogLevel));
|
|
78
|
+
// args.push('--logFile', tsServerLogFile);
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
if (logFile) {
|
|
82
|
+
args.push('--logFile', logFile);
|
|
83
|
+
}
|
|
84
|
+
if (logVerbosity) {
|
|
85
|
+
args.push('--logVerbosity', logVerbosity);
|
|
86
|
+
}
|
|
87
|
+
// if (configuration.enableTsServerTracing) {
|
|
88
|
+
// tsServerTraceDirectory = this._logDirectoryProvider.getNewLogDirectory();
|
|
89
|
+
// if (tsServerTraceDirectory) {
|
|
90
|
+
// args.push('--traceDirectory', tsServerTraceDirectory);
|
|
91
|
+
// }
|
|
92
|
+
// }
|
|
93
|
+
// const pluginPaths = this._pluginPathsProvider.getPluginPaths();
|
|
94
|
+
// if (pluginManager.plugins.length) {
|
|
95
|
+
// args.push('--globalPlugins', pluginManager.plugins.map(x => x.name).join(','));
|
|
96
|
+
// const isUsingBundledTypeScriptVersion = currentVersion.path === this._versionProvider.defaultVersion.path;
|
|
97
|
+
// for (const plugin of pluginManager.plugins) {
|
|
98
|
+
// if (isUsingBundledTypeScriptVersion || plugin.enableForWorkspaceTypeScriptVersions) {
|
|
99
|
+
// pluginPaths.push(isWeb() ? plugin.uri.toString() : plugin.uri.fsPath);
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
102
|
+
// }
|
|
103
|
+
// if (pluginPaths.length !== 0) {
|
|
104
|
+
// args.push('--pluginProbeLocations', pluginPaths.join(','));
|
|
105
|
+
// }
|
|
106
|
+
if (globalPlugins && globalPlugins.length) {
|
|
107
|
+
args.push('--globalPlugins', globalPlugins.join(','));
|
|
108
|
+
}
|
|
109
|
+
if (pluginProbeLocations && pluginProbeLocations.length) {
|
|
110
|
+
args.push('--pluginProbeLocations', pluginProbeLocations.join(','));
|
|
111
|
+
}
|
|
112
|
+
if (npmLocation) {
|
|
113
|
+
this._logger.info(`using npm from ${npmLocation}`);
|
|
114
|
+
args.push('--npmLocation', `"${npmLocation}"`);
|
|
115
|
+
}
|
|
116
|
+
args.push('--locale', locale || 'en');
|
|
117
|
+
// args.push('--noGetErrOnBackgroundUpdate');
|
|
118
|
+
args.push('--validateDefaultNpmLocation');
|
|
119
|
+
return { args, tsServerLogFile, tsServerTraceDirectory };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=spawner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawner.js","sourceRoot":"","sources":["../../src/tsServer/spawner.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AAEH,OAAO,GAAG,MAAM,iBAAiB,CAAC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AY,CAAC,CAAC;SAC7C;QACD,6CAA6C;QAC7C,gFAAgF;QAChF,oCAAoC;QACpC,iEAAiE;QACjE,QAAQ;QACR,IAAI;QACJ,kEAAkE;QAClE,sCAAsC;QACtC,sFAAsF;QACtF,iHAAiH;QACjH,oDAAoD;QACpD,gGAAgG;QAChG,qFAAqF;QACrF,YAAY;QACZ,QAAQ;QACR,IAAI;QACJ,kCAAkC;QAClC,kEAAkE;QAClE,IAAI;QACJ,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,EAAE;YACvC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SACzD;QACD,IAAI,oBAAoB,IAAI,oBAAoB,CAAC,MAAM,EAAE;YACrD,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SACvE;QACD,IAAI,WAAW,EAAE;YACb,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,WAAW,EAAE,CAAC,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,WAAW,GAAG,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC;QACtC,6CAA6C;QAC7C,IAAI,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC1C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;IAC7D,CAAC;CACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import API from '
|
|
2
|
-
import { IServerOptions } from '
|
|
1
|
+
import API from '../utils/api.js';
|
|
2
|
+
import type { IServerOptions } from '../utils/configuration.js';
|
|
3
3
|
import type { Logger } from '../logger.js';
|
|
4
4
|
export declare const enum TypeScriptVersionSource {
|
|
5
5
|
Bundled = "bundled",
|
|
@@ -0,0 +1 @@
|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AI;CAcpD"}
|
|
@@ -7,8 +7,8 @@ import { createRequire } from 'node:module';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import which from 'which';
|
|
9
9
|
import { pkgUpSync } from 'pkg-up';
|
|
10
|
-
import API from '
|
|
11
|
-
import { findPathToModule } from '
|
|
10
|
+
import API from '../utils/api.js';
|
|
11
|
+
import { findPathToModule } from '../utils/modules-resolver.js';
|
|
12
12
|
export class TypeScriptVersion {
|
|
13
13
|
constructor(source, path, _pathLabel, logger) {
|
|
14
14
|
this.source = source;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionProvider.js","sourceRoot":"","sources":["../../src/tsServer/versionProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAShE,MAAM,OAAO,iBAAiB;IAE1B,YACoB,MAA+B,EAC/B,IAAY,EACX,UAAmB,EACnB,MAAe;QAHhB,WAAM,GAAN,MAAM,CAAyB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QACX,eAAU,GAAV,UAAU,CAAS;QACnB,WAAM,GAAN,MAAM,CAAS;QAEhC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAED,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;I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AAO,CAAC,YAAY,CAAC,CAAC;YAC3C,MAAM,cAAc,GAAG,IAAI,iBAAiB,kDAExC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAClB,EAAE,CAAC,CAAC;YACR,OAAO,cAAc,CAAC;SACzB;QAAC,OAAO,CAAC,EAAE;YACR,sEAAsE;YACtE,OAAO,IAAI,CAAC;SACf;IACL,CAAC;CACJ"}
|
package/lib/tsp-client.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type tsp from 'typescript/lib/protocol.d.js';
|
|
3
|
-
import { CancellationToken } from 'vscode-jsonrpc';
|
|
3
|
+
import type { CancellationToken } from 'vscode-jsonrpc';
|
|
4
4
|
import { CommandTypes } from './tsp-command-types.js';
|
|
5
5
|
import { Logger } from './logger.js';
|
|
6
6
|
import API from './utils/api.js';
|
|
7
|
+
import { ExecConfig, ServerResponse, TypeScriptRequestTypes } from './tsServer/requests.js';
|
|
8
|
+
import type { TypeScriptVersion } from './tsServer/versionProvider.js';
|
|
9
|
+
import type { LspClient } from './lsp-client.js';
|
|
7
10
|
export interface TspClientOptions {
|
|
8
|
-
|
|
11
|
+
lspClient: LspClient;
|
|
12
|
+
typescriptVersion: TypeScriptVersion;
|
|
9
13
|
logger: Logger;
|
|
10
|
-
tsserverPath: string;
|
|
11
14
|
logFile?: string;
|
|
12
15
|
logVerbosity?: string;
|
|
13
16
|
disableAutomaticTypingAcquisition?: boolean;
|
|
@@ -19,65 +22,27 @@ export interface TspClientOptions {
|
|
|
19
22
|
onEvent?: (event: tsp.Event) => void;
|
|
20
23
|
onExit?: (exitCode: number | null, signal: NodeJS.Signals | null) => void;
|
|
21
24
|
}
|
|
22
|
-
interface TypeScriptRequestTypes {
|
|
23
|
-
[CommandTypes.ApplyCodeActionCommand]: [tsp.ApplyCodeActionCommandRequestArgs, tsp.ApplyCodeActionCommandResponse];
|
|
24
|
-
[CommandTypes.CompilerOptionsForInferredProjects]: [tsp.SetCompilerOptionsForInferredProjectsArgs, tsp.SetCompilerOptionsForInferredProjectsResponse];
|
|
25
|
-
[CommandTypes.CompletionDetails]: [tsp.CompletionDetailsRequestArgs, tsp.CompletionDetailsResponse];
|
|
26
|
-
[CommandTypes.CompletionInfo]: [tsp.CompletionsRequestArgs, tsp.CompletionInfoResponse];
|
|
27
|
-
[CommandTypes.Configure]: [tsp.ConfigureRequestArguments, tsp.ConfigureResponse];
|
|
28
|
-
[CommandTypes.Definition]: [tsp.FileLocationRequestArgs, tsp.DefinitionResponse];
|
|
29
|
-
[CommandTypes.DefinitionAndBoundSpan]: [tsp.FileLocationRequestArgs, tsp.DefinitionInfoAndBoundSpanResponse];
|
|
30
|
-
[CommandTypes.DocCommentTemplate]: [tsp.FileLocationRequestArgs, tsp.DocCommandTemplateResponse];
|
|
31
|
-
[CommandTypes.DocumentHighlights]: [tsp.DocumentHighlightsRequestArgs, tsp.DocumentHighlightsResponse];
|
|
32
|
-
[CommandTypes.EncodedSemanticClassificationsFull]: [tsp.EncodedSemanticClassificationsRequestArgs, tsp.EncodedSemanticClassificationsResponse];
|
|
33
|
-
[CommandTypes.FindSourceDefinition]: [tsp.FileLocationRequestArgs, tsp.DefinitionResponse];
|
|
34
|
-
[CommandTypes.Format]: [tsp.FormatRequestArgs, tsp.FormatResponse];
|
|
35
|
-
[CommandTypes.Formatonkey]: [tsp.FormatOnKeyRequestArgs, tsp.FormatResponse];
|
|
36
|
-
[CommandTypes.GetApplicableRefactors]: [tsp.GetApplicableRefactorsRequestArgs, tsp.GetApplicableRefactorsResponse];
|
|
37
|
-
[CommandTypes.GetCodeFixes]: [tsp.CodeFixRequestArgs, tsp.CodeFixResponse];
|
|
38
|
-
[CommandTypes.GetCombinedCodeFix]: [tsp.GetCombinedCodeFixRequestArgs, tsp.GetCombinedCodeFixResponse];
|
|
39
|
-
[CommandTypes.GetEditsForFileRename]: [tsp.GetEditsForFileRenameRequestArgs, tsp.GetEditsForFileRenameResponse];
|
|
40
|
-
[CommandTypes.GetEditsForRefactor]: [tsp.GetEditsForRefactorRequestArgs, tsp.GetEditsForRefactorResponse];
|
|
41
|
-
[CommandTypes.Geterr]: [tsp.GeterrRequestArgs, any];
|
|
42
|
-
[CommandTypes.GetOutliningSpans]: [tsp.FileRequestArgs, tsp.OutliningSpansResponse];
|
|
43
|
-
[CommandTypes.GetSupportedCodeFixes]: [null, tsp.GetSupportedCodeFixesResponse];
|
|
44
|
-
[CommandTypes.Implementation]: [tsp.FileLocationRequestArgs, tsp.ImplementationResponse];
|
|
45
|
-
[CommandTypes.JsxClosingTag]: [tsp.JsxClosingTagRequestArgs, tsp.JsxClosingTagResponse];
|
|
46
|
-
[CommandTypes.Navto]: [tsp.NavtoRequestArgs, tsp.NavtoResponse];
|
|
47
|
-
[CommandTypes.NavTree]: [tsp.FileRequestArgs, tsp.NavTreeResponse];
|
|
48
|
-
[CommandTypes.OrganizeImports]: [tsp.OrganizeImportsRequestArgs, tsp.OrganizeImportsResponse];
|
|
49
|
-
[CommandTypes.ProjectInfo]: [tsp.ProjectInfoRequestArgs, tsp.ProjectInfoResponse];
|
|
50
|
-
[CommandTypes.ProvideInlayHints]: [tsp.InlayHintsRequestArgs, tsp.InlayHintsResponse];
|
|
51
|
-
[CommandTypes.Quickinfo]: [tsp.FileLocationRequestArgs, tsp.QuickInfoResponse];
|
|
52
|
-
[CommandTypes.References]: [tsp.FileLocationRequestArgs, tsp.ReferencesResponse];
|
|
53
|
-
[CommandTypes.Rename]: [tsp.RenameRequestArgs, tsp.RenameResponse];
|
|
54
|
-
[CommandTypes.SignatureHelp]: [tsp.SignatureHelpRequestArgs, tsp.SignatureHelpResponse];
|
|
55
|
-
[CommandTypes.TypeDefinition]: [tsp.FileLocationRequestArgs, tsp.TypeDefinitionResponse];
|
|
56
|
-
}
|
|
57
25
|
export declare class TspClient {
|
|
58
26
|
private options;
|
|
59
27
|
apiVersion: API;
|
|
60
|
-
private
|
|
61
|
-
private readlineInterface;
|
|
62
|
-
private seq;
|
|
63
|
-
private readonly deferreds;
|
|
28
|
+
private primaryTsServer;
|
|
64
29
|
private logger;
|
|
65
30
|
private tsserverLogger;
|
|
66
|
-
private
|
|
31
|
+
private loadingIndicator;
|
|
67
32
|
constructor(options: TspClientOptions);
|
|
68
33
|
start(): boolean;
|
|
34
|
+
private serviceExited;
|
|
35
|
+
private dispatchEvent;
|
|
69
36
|
shutdown(): void;
|
|
70
37
|
notify(command: CommandTypes.Open, args: tsp.OpenRequestArgs): void;
|
|
71
38
|
notify(command: CommandTypes.Close, args: tsp.FileRequestArgs): void;
|
|
72
|
-
notify(command: CommandTypes.Saveto, args: tsp.SavetoRequestArgs): void;
|
|
73
39
|
notify(command: CommandTypes.Change, args: tsp.ChangeRequestArgs): void;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
private
|
|
80
|
-
private
|
|
40
|
+
requestGeterr(args: tsp.GeterrRequestArgs, token: CancellationToken): Promise<any>;
|
|
41
|
+
request<K extends keyof TypeScriptRequestTypes>(command: K, args: TypeScriptRequestTypes[K][0], token?: CancellationToken, config?: ExecConfig): Promise<TypeScriptRequestTypes[K][1]>;
|
|
42
|
+
execute(command: keyof TypeScriptRequestTypes, args: any, token?: CancellationToken, config?: ExecConfig): Promise<ServerResponse.Response<tsp.Response>>;
|
|
43
|
+
executeWithoutWaitingForResponse(command: keyof TypeScriptRequestTypes, args: any): void;
|
|
44
|
+
executeAsync(command: keyof TypeScriptRequestTypes, args: tsp.GeterrRequestArgs, token: CancellationToken): Promise<ServerResponse.Response<tsp.Response>>;
|
|
45
|
+
private executeImpl;
|
|
46
|
+
private fatalError;
|
|
81
47
|
}
|
|
82
|
-
export {};
|
|
83
48
|
//# sourceMappingURL=tsp-client.d.ts.map
|
package/lib/tsp-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsp-client.d.ts","sourceRoot":"","sources":["../src/t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