@teambit/ts-server 0.0.0-b5e3d30a4fe58fedfeafa7448ff4bad8debf4e32

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.
@@ -0,0 +1,9 @@
1
+ import { server } from 'typescript';
2
+ export type Diagnostic = server.protocol.Diagnostic;
3
+ /**
4
+ * mostly taken from ts repo, src/compiler/program.ts "formatDiagnosticsWithColorAndContext" method.
5
+ * sadly, it's impossible to use that method for the diagnostic format coming from ts-server. it only
6
+ * works with the diagnostic format of "ts" APIs.
7
+ */
8
+ export declare function formatDiagnostics(diagnostics: readonly Diagnostic[], filePath: string): string;
9
+ export declare function formatDiagnostic(diagnostic: Diagnostic, filePath: string): string;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatDiagnostic = formatDiagnostic;
7
+ exports.formatDiagnostics = formatDiagnostics;
8
+ /**
9
+ * mostly taken from ts repo, src/compiler/program.ts "formatDiagnosticsWithColorAndContext" method.
10
+ * sadly, it's impossible to use that method for the diagnostic format coming from ts-server. it only
11
+ * works with the diagnostic format of "ts" APIs.
12
+ */
13
+ function formatDiagnostics(diagnostics, filePath) {
14
+ let output = '';
15
+ for (const diagnostic of diagnostics) {
16
+ output += formatDiagnostic(diagnostic, filePath);
17
+ }
18
+ return output;
19
+ }
20
+ const diagnosticCategoryName = diagnostic => diagnostic.category;
21
+ function formatDiagnostic(diagnostic, filePath) {
22
+ const errorMessage = `${diagnosticCategoryName(diagnostic)} TS${diagnostic.code}: ${flattenDiagnosticMessageText(diagnostic.text, '\n')}${'\n'}`;
23
+ const {
24
+ line,
25
+ offset
26
+ } = diagnostic.start;
27
+ return `${filePath}(${line},${offset}): ${errorMessage}`;
28
+ }
29
+ function flattenDiagnosticMessageText(diag, newLine, indent = 0) {
30
+ if (typeof diag === 'string') {
31
+ return diag;
32
+ }
33
+ if (diag === undefined) {
34
+ return '';
35
+ }
36
+ let result = '';
37
+ if (indent) {
38
+ result += newLine;
39
+ for (let i = 0; i < indent; i += 1) {
40
+ result += ' ';
41
+ }
42
+ }
43
+ result += diag.messageText;
44
+ indent += 1;
45
+ if (diag.next) {
46
+ for (const kid of diag.next) {
47
+ result += flattenDiagnosticMessageText(kid, newLine, indent);
48
+ }
49
+ }
50
+ return result;
51
+ }
52
+
53
+ //# sourceMappingURL=format-diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["formatDiagnostics","diagnostics","filePath","output","diagnostic","formatDiagnostic","diagnosticCategoryName","category","errorMessage","code","flattenDiagnosticMessageText","text","line","offset","start","diag","newLine","indent","undefined","result","i","messageText","next","kid"],"sources":["format-diagnostics.ts"],"sourcesContent":["import { DiagnosticMessageChain, server } from 'typescript';\n\nexport type Diagnostic = server.protocol.Diagnostic;\n\n/**\n * mostly taken from ts repo, src/compiler/program.ts \"formatDiagnosticsWithColorAndContext\" method.\n * sadly, it's impossible to use that method for the diagnostic format coming from ts-server. it only\n * works with the diagnostic format of \"ts\" APIs.\n */\nexport function formatDiagnostics(diagnostics: readonly Diagnostic[], filePath: string): string {\n let output = '';\n\n for (const diagnostic of diagnostics) {\n output += formatDiagnostic(diagnostic, filePath);\n }\n return output;\n}\n\nconst diagnosticCategoryName = (diagnostic: Diagnostic) => diagnostic.category;\n\nexport function formatDiagnostic(diagnostic: Diagnostic, filePath: string): string {\n const errorMessage = `${diagnosticCategoryName(diagnostic)} TS${diagnostic.code}: ${flattenDiagnosticMessageText(\n diagnostic.text,\n '\\n'\n )}${'\\n'}`;\n\n const { line, offset } = diagnostic.start;\n return `${filePath}(${line},${offset}): ${errorMessage}`;\n}\n\nfunction flattenDiagnosticMessageText(\n diag: string | DiagnosticMessageChain | undefined,\n newLine: string,\n indent = 0\n): string {\n if (typeof diag === 'string') {\n return diag;\n }\n if (diag === undefined) {\n return '';\n }\n let result = '';\n if (indent) {\n result += newLine;\n\n for (let i = 0; i < indent; i += 1) {\n result += ' ';\n }\n }\n result += diag.messageText;\n indent += 1;\n if (diag.next) {\n for (const kid of diag.next) {\n result += flattenDiagnosticMessageText(kid, newLine, indent);\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAiBA,CAACC,WAAkC,EAAEC,QAAgB,EAAU;EAC9F,IAAIC,MAAM,GAAG,EAAE;EAEf,KAAK,MAAMC,UAAU,IAAIH,WAAW,EAAE;IACpCE,MAAM,IAAIE,gBAAgB,CAACD,UAAU,EAAEF,QAAQ,CAAC;EAClD;EACA,OAAOC,MAAM;AACf;AAEA,MAAMG,sBAAsB,GAAIF,UAAsB,IAAKA,UAAU,CAACG,QAAQ;AAEvE,SAASF,gBAAgBA,CAACD,UAAsB,EAAEF,QAAgB,EAAU;EACjF,MAAMM,YAAY,GAAG,GAAGF,sBAAsB,CAACF,UAAU,CAAC,MAAMA,UAAU,CAACK,IAAI,KAAKC,4BAA4B,CAC9GN,UAAU,CAACO,IAAI,EACf,IACF,CAAC,GAAG,IAAI,EAAE;EAEV,MAAM;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGT,UAAU,CAACU,KAAK;EACzC,OAAO,GAAGZ,QAAQ,IAAIU,IAAI,IAAIC,MAAM,MAAML,YAAY,EAAE;AAC1D;AAEA,SAASE,4BAA4BA,CACnCK,IAAiD,EACjDC,OAAe,EACfC,MAAM,GAAG,CAAC,EACF;EACR,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI;EACb;EACA,IAAIA,IAAI,KAAKG,SAAS,EAAE;IACtB,OAAO,EAAE;EACX;EACA,IAAIC,MAAM,GAAG,EAAE;EACf,IAAIF,MAAM,EAAE;IACVE,MAAM,IAAIH,OAAO;IAEjB,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,MAAM,EAAEG,CAAC,IAAI,CAAC,EAAE;MAClCD,MAAM,IAAI,IAAI;IAChB;EACF;EACAA,MAAM,IAAIJ,IAAI,CAACM,WAAW;EAC1BJ,MAAM,IAAI,CAAC;EACX,IAAIF,IAAI,CAACO,IAAI,EAAE;IACb,KAAK,MAAMC,GAAG,IAAIR,IAAI,CAACO,IAAI,EAAE;MAC3BH,MAAM,IAAIT,4BAA4B,CAACa,GAAG,EAAEP,OAAO,EAAEC,MAAM,CAAC;IAC9D;EACF;EACA,OAAOE,MAAM;AACf","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export type { TsserverClientOpts } from './ts-server-client';
2
+ export { TsserverClient } from './ts-server-client';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "TsserverClient", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _tsServerClient().TsserverClient;
10
+ }
11
+ });
12
+ function _tsServerClient() {
13
+ const data = require("./ts-server-client");
14
+ _tsServerClient = function () {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_tsServerClient","data","require"],"sources":["index.ts"],"sourcesContent":["export type { TsserverClientOpts } from './ts-server-client';\nexport { TsserverClient } from './ts-server-client';\n"],"mappings":";;;;;;;;;;;AACA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * copied over from https://github.com/typescript-language-server/typescript-language-server/blob/master/src/modules-resolver.ts
3
+ * modified to accommodate Bit needs
4
+ */
5
+ export declare function findPathToModule(dir: string, moduleName: string): string | undefined;
6
+ export declare function findPathToYarnSdk(dir: string, moduleName: string): string | undefined;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findPathToModule = findPathToModule;
7
+ exports.findPathToYarnSdk = findPathToYarnSdk;
8
+ function fs() {
9
+ const data = _interopRequireWildcard(require("fs"));
10
+ fs = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ function path() {
16
+ const data = _interopRequireWildcard(require("path"));
17
+ path = function () {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
22
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
23
+ /**
24
+ * copied over from https://github.com/typescript-language-server/typescript-language-server/blob/master/src/modules-resolver.ts
25
+ * modified to accommodate Bit needs
26
+ */
27
+
28
+ /*
29
+ * Copyright (C) 2017, 2018 TypeFox and others.
30
+ *
31
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
32
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
33
+ */
34
+
35
+ function findPathToModule(dir, moduleName) {
36
+ try {
37
+ return require.resolve(moduleName, {
38
+ paths: [dir]
39
+ });
40
+ } catch {
41
+ return undefined;
42
+ }
43
+ }
44
+ function findPathToYarnSdk(dir, moduleName) {
45
+ const stat = fs().statSync(dir);
46
+ if (stat.isDirectory()) {
47
+ const candidate = path().resolve(dir, '.yarn', 'sdks', moduleName);
48
+ if (fs().existsSync(candidate)) {
49
+ return candidate;
50
+ }
51
+ }
52
+ const parent = path().resolve(dir, '..');
53
+ if (parent !== dir) {
54
+ return findPathToYarnSdk(parent, moduleName);
55
+ }
56
+ return undefined;
57
+ }
58
+
59
+ //# sourceMappingURL=modules-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fs","data","_interopRequireWildcard","require","path","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","findPathToModule","dir","moduleName","resolve","paths","undefined","findPathToYarnSdk","stat","statSync","isDirectory","candidate","existsSync","parent"],"sources":["modules-resolver.ts"],"sourcesContent":["/**\n * copied over from https://github.com/typescript-language-server/typescript-language-server/blob/master/src/modules-resolver.ts\n * modified to accommodate Bit needs\n */\n\n/*\n * Copyright (C) 2017, 2018 TypeFox and others.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n */\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nexport function findPathToModule(dir: string, moduleName: string): string | undefined {\n try {\n return require.resolve(moduleName, { paths: [dir] });\n } catch {\n return undefined;\n }\n}\n\nexport function findPathToYarnSdk(dir: string, moduleName: string): string | undefined {\n const stat = fs.statSync(dir);\n if (stat.isDirectory()) {\n const candidate = path.resolve(dir, '.yarn', 'sdks', moduleName);\n if (fs.existsSync(candidate)) {\n return candidate;\n }\n }\n const parent = path.resolve(dir, '..');\n if (parent !== dir) {\n return findPathToYarnSdk(parent, moduleName);\n }\n return undefined;\n}\n"],"mappings":";;;;;;;AAWA,SAAAA,GAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,EAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6B,SAAAC,wBAAAG,CAAA,EAAAC,C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AAkB,EAAsB;EACrF,MAAMK,IAAI,GAAG/B,EAAE,CAAD,CAAC,CAACgC,QAAQ,CAACP,GAAG,CAAC;EAC7B,IAAIM,IAAI,CAACE,WAAW,CAAC,CAAC,EAAE;IACtB,MAAMC,SAAS,GAAG9B,IAAI,CAAD,CAAC,CAACuB,OAAO,CAACF,GAAG,EAAE,OAAO,EAAE,MAAM,EAAEC,UAAU,CAAC;IAChE,IAAI1B,EAAE,CAAD,CAAC,CAACmC,UAAU,CAACD,SAAS,CAAC,EAAE;MAC5B,OAAOA,SAAS;IAClB;EACF;EACA,MAAME,MAAM,GAAGhC,IAAI,CAAD,CAAC,CAACuB,OAAO,CAACF,GAAG,EAAE,IAAI,CAAC;EACtC,IAAIW,MAAM,KAAKX,GAAG,EAAE;IAClB,OAAOK,iBAAiB,CAACM,MAAM,EAAEV,UAAU,CAAC;EAC9C;EACA,OAAOG,SAAS;AAClB","ignoreList":[]}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * part of this file was copied over from https://github.com/typescript-language-server/typescript-language-server/blob/master/src/tsp-client.ts
3
+ */
4
+ import { Logger } from '@teambit/logger';
5
+ import type ts from 'typescript/lib/tsserverlibrary';
6
+ import { CancellationToken } from 'vscode-jsonrpc';
7
+ import { CommandTypes } from './tsp-command-types';
8
+ export interface TspClientOptions {
9
+ logger: Logger;
10
+ tsserverPath: string;
11
+ logToConsole?: boolean;
12
+ onEvent?: (event: ts.server.protocol.Event) => void;
13
+ }
14
+ export interface TsServerArgs {
15
+ logFile?: string;
16
+ logVerbosity?: string;
17
+ maxTsServerMemory?: number;
18
+ globalPlugins?: string[];
19
+ pluginProbeLocations?: string[];
20
+ }
21
+ export interface StandardTsServerRequests {
22
+ [CommandTypes.ApplyCodeActionCommand]: [
23
+ ts.server.protocol.ApplyCodeActionCommandRequestArgs,
24
+ ts.server.protocol.ApplyCodeActionCommandResponse
25
+ ];
26
+ [CommandTypes.CompletionDetails]: [
27
+ ts.server.protocol.CompletionDetailsRequestArgs,
28
+ ts.server.protocol.CompletionDetailsResponse
29
+ ];
30
+ [CommandTypes.CompletionInfo]: [ts.server.protocol.CompletionsRequestArgs, ts.server.protocol.CompletionInfoResponse];
31
+ [CommandTypes.Configure]: [ts.server.protocol.ConfigureRequestArguments, ts.server.protocol.ConfigureResponse];
32
+ [CommandTypes.Definition]: [ts.server.protocol.FileLocationRequestArgs, ts.server.protocol.DefinitionResponse];
33
+ [CommandTypes.DefinitionAndBoundSpan]: [
34
+ ts.server.protocol.FileLocationRequestArgs,
35
+ ts.server.protocol.DefinitionInfoAndBoundSpanResponse
36
+ ];
37
+ [CommandTypes.DocCommentTemplate]: [
38
+ ts.server.protocol.FileLocationRequestArgs,
39
+ ts.server.protocol.DocCommandTemplateResponse
40
+ ];
41
+ [CommandTypes.DocumentHighlights]: [
42
+ ts.server.protocol.DocumentHighlightsRequestArgs,
43
+ ts.server.protocol.DocumentHighlightsResponse
44
+ ];
45
+ [CommandTypes.Format]: [ts.server.protocol.FormatRequestArgs, ts.server.protocol.FormatResponse];
46
+ [CommandTypes.Formatonkey]: [ts.server.protocol.FormatOnKeyRequestArgs, ts.server.protocol.FormatResponse];
47
+ [CommandTypes.GetApplicableRefactors]: [
48
+ ts.server.protocol.GetApplicableRefactorsRequestArgs,
49
+ ts.server.protocol.GetApplicableRefactorsResponse
50
+ ];
51
+ [CommandTypes.GetCodeFixes]: [ts.server.protocol.CodeFixRequestArgs, ts.server.protocol.CodeFixResponse];
52
+ [CommandTypes.GetCombinedCodeFix]: [
53
+ ts.server.protocol.GetCombinedCodeFixRequestArgs,
54
+ ts.server.protocol.GetCombinedCodeFixResponse
55
+ ];
56
+ [CommandTypes.GetEditsForFileRename]: [
57
+ ts.server.protocol.GetEditsForFileRenameRequestArgs,
58
+ ts.server.protocol.GetEditsForFileRenameResponse
59
+ ];
60
+ [CommandTypes.GetEditsForRefactor]: [
61
+ ts.server.protocol.GetEditsForRefactorRequestArgs,
62
+ ts.server.protocol.GetEditsForRefactorResponse
63
+ ];
64
+ [CommandTypes.GetOutliningSpans]: [ts.server.protocol.FileRequestArgs, ts.server.protocol.OutliningSpansResponse];
65
+ [CommandTypes.GetSupportedCodeFixes]: [null, ts.server.protocol.GetSupportedCodeFixesResponse];
66
+ [CommandTypes.Implementation]: [
67
+ ts.server.protocol.FileLocationRequestArgs,
68
+ ts.server.protocol.ImplementationResponse
69
+ ];
70
+ [CommandTypes.JsxClosingTag]: [ts.server.protocol.JsxClosingTagRequestArgs, ts.server.protocol.JsxClosingTagResponse];
71
+ [CommandTypes.Navto]: [ts.server.protocol.NavtoRequestArgs, ts.server.protocol.NavtoResponse];
72
+ [CommandTypes.NavTree]: [ts.server.protocol.FileRequestArgs, ts.server.protocol.NavTreeResponse];
73
+ [CommandTypes.OrganizeImports]: [
74
+ ts.server.protocol.OrganizeImportsRequestArgs,
75
+ ts.server.protocol.OrganizeImportsResponse
76
+ ];
77
+ [CommandTypes.PrepareCallHierarchy]: [
78
+ ts.server.protocol.FileLocationRequestArgs,
79
+ ts.server.protocol.PrepareCallHierarchyResponse
80
+ ];
81
+ [CommandTypes.ProvideCallHierarchyIncomingCalls]: [
82
+ ts.server.protocol.FileLocationRequestArgs,
83
+ ts.server.protocol.ProvideCallHierarchyIncomingCallsResponse
84
+ ];
85
+ [CommandTypes.ProvideCallHierarchyOutgoingCalls]: [
86
+ ts.server.protocol.FileLocationRequestArgs,
87
+ ts.server.protocol.ProvideCallHierarchyOutgoingCallsResponse
88
+ ];
89
+ [CommandTypes.ProjectInfo]: [ts.server.protocol.ProjectInfoRequestArgs, ts.server.protocol.ProjectInfoResponse];
90
+ [CommandTypes.ProvideInlayHints]: [ts.server.protocol.InlayHintsRequestArgs, ts.server.protocol.InlayHintsResponse];
91
+ [CommandTypes.Quickinfo]: [ts.server.protocol.FileLocationRequestArgs, ts.server.protocol.QuickInfoResponse];
92
+ [CommandTypes.References]: [ts.server.protocol.FileLocationRequestArgs, ts.server.protocol.ReferencesResponse];
93
+ [CommandTypes.Rename]: [ts.server.protocol.RenameRequestArgs, ts.server.protocol.RenameResponse];
94
+ [CommandTypes.SelectionRange]: [
95
+ ts.server.protocol.SelectionRangeRequestArgs,
96
+ ts.server.protocol.SelectionRangeResponse
97
+ ];
98
+ [CommandTypes.SignatureHelp]: [ts.server.protocol.SignatureHelpRequestArgs, ts.server.protocol.SignatureHelpResponse];
99
+ [CommandTypes.TypeDefinition]: [
100
+ ts.server.protocol.FileLocationRequestArgs,
101
+ ts.server.protocol.TypeDefinitionResponse
102
+ ];
103
+ [CommandTypes.UpdateOpen]: [ts.server.protocol.UpdateOpenRequestArgs, ts.server.protocol.Response];
104
+ }
105
+ export interface NoResponseTsServerRequests {
106
+ [CommandTypes.Change]: [ts.server.protocol.ChangeRequestArgs, null];
107
+ [CommandTypes.Close]: [ts.server.protocol.FileRequestArgs, null];
108
+ [CommandTypes.CompilerOptionsForInferredProjects]: [
109
+ ts.server.protocol.SetCompilerOptionsForInferredProjectsArgs,
110
+ ts.server.protocol.SetCompilerOptionsForInferredProjectsResponse
111
+ ];
112
+ [CommandTypes.Configure]: [ts.server.protocol.ConfigureRequestArguments, ts.server.protocol.ConfigureResponse];
113
+ [CommandTypes.ConfigurePlugin]: [
114
+ ts.server.protocol.ConfigurePluginRequestArguments,
115
+ ts.server.protocol.ConfigurePluginResponse
116
+ ];
117
+ [CommandTypes.Open]: [ts.server.protocol.OpenRequestArgs, null];
118
+ }
119
+ export interface AsyncTsServerRequests {
120
+ [CommandTypes.Geterr]: [ts.server.protocol.GeterrRequestArgs, ts.server.protocol.Response];
121
+ [CommandTypes.GeterrForProject]: [ts.server.protocol.GeterrForProjectRequestArgs, ts.server.protocol.Response];
122
+ }
123
+ export type TypeScriptRequestTypes = StandardTsServerRequests & NoResponseTsServerRequests & AsyncTsServerRequests;
124
+ export declare class ProcessBasedTsServer {
125
+ private options;
126
+ private tsServerArgs;
127
+ private readlineInterface;
128
+ private tsServerProcess;
129
+ private seq;
130
+ private readonly deferreds;
131
+ private logger;
132
+ private cancellationPipeName;
133
+ constructor(options: TspClientOptions, tsServerArgs?: TsServerArgs);
134
+ restart(): Promise<void>;
135
+ start(): Promise<void>;
136
+ notify(command: CommandTypes.Open, args: ts.server.protocol.OpenRequestArgs): Promise<void>;
137
+ notify(command: CommandTypes.Close, args: ts.server.protocol.FileRequestArgs): Promise<void>;
138
+ notify(command: CommandTypes.Saveto, args: ts.server.protocol.SavetoRequestArgs): Promise<void>;
139
+ notify(command: CommandTypes.Change, args: ts.server.protocol.ChangeRequestArgs): Promise<void>;
140
+ request<K extends keyof TypeScriptRequestTypes>(command: K, args: TypeScriptRequestTypes[K][0], token?: CancellationToken): Promise<TypeScriptRequestTypes[K][1]>;
141
+ kill(): void;
142
+ private log;
143
+ protected sendMessage(command: string, notification: boolean, args?: any): void;
144
+ protected processMessage(untrimmedMessageString: string, resolve?: () => void, reject?: (err: any) => void): void;
145
+ private resolveResponse;
146
+ private isEvent;
147
+ private isResponse;
148
+ private isRequestCompletedEvent;
149
+ private ensureServerIsRunning;
150
+ }
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ProcessBasedTsServer = void 0;
7
+ function fs() {
8
+ const data = _interopRequireWildcard(require("fs"));
9
+ fs = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function path() {
15
+ const data = _interopRequireWildcard(require("path"));
16
+ path = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function cp() {
22
+ const data = _interopRequireWildcard(require("child_process"));
23
+ cp = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function readline() {
29
+ const data = _interopRequireWildcard(require("readline"));
30
+ readline = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function decoder() {
36
+ const data = _interopRequireWildcard(require("string_decoder"));
37
+ decoder = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _tempy() {
43
+ const data = _interopRequireDefault(require("tempy"));
44
+ _tempy = function () {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _utils() {
50
+ const data = require("./utils");
51
+ _utils = function () {
52
+ return data;
53
+ };
54
+ return data;
55
+ }
56
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
57
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
58
+ /**
59
+ * part of this file was copied over from https://github.com/typescript-language-server/typescript-language-server/blob/master/src/tsp-client.ts
60
+ */
61
+
62
+ /*
63
+ * Copyright (C) 2017, 2018 TypeFox and others.
64
+ *
65
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
66
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
67
+ */
68
+
69
+ class ProcessBasedTsServer {
70
+ seq = 0;
71
+ deferreds = {};
72
+ constructor(options, tsServerArgs = {}) {
73
+ this.options = options;
74
+ this.tsServerArgs = tsServerArgs;
75
+ this.logger = options.logger;
76
+ }
77
+ async restart() {
78
+ this.kill();
79
+ await this.start();
80
+ }
81
+ start() {
82
+ return new Promise((resolve, reject) => {
83
+ if (this.tsServerProcess) {
84
+ reject(new Error('server already started'));
85
+ return;
86
+ }
87
+ const {
88
+ tsserverPath
89
+ } = this.options;
90
+ const {
91
+ logFile,
92
+ logVerbosity,
93
+ maxTsServerMemory,
94
+ globalPlugins,
95
+ pluginProbeLocations
96
+ } = this.tsServerArgs;
97
+ const args = [];
98
+ if (logFile) {
99
+ args.push('--logFile', logFile);
100
+ }
101
+ if (logVerbosity) {
102
+ args.push('--logVerbosity', logVerbosity);
103
+ }
104
+ if (globalPlugins && globalPlugins.length) {
105
+ args.push('--globalPlugins', globalPlugins.join(','));
106
+ }
107
+ if (pluginProbeLocations && pluginProbeLocations.length) {
108
+ args.push('--pluginProbeLocations', pluginProbeLocations.join(','));
109
+ }
110
+ this.cancellationPipeName = _tempy().default.file({
111
+ name: 'tscancellation'
112
+ });
113
+ args.push('--cancellationPipeName', `${this.cancellationPipeName}*`);
114
+ this.logger.info(`Starting tsserver : '${tsserverPath} ${args.join(' ')}'`);
115
+ const tsserverPathIsModule = path().extname(tsserverPath) === '.js';
116
+ const options = {
117
+ silent: true,
118
+ execArgv: maxTsServerMemory ? [`--max-old-space-size=${maxTsServerMemory}`] : []
119
+ };
120
+ this.tsServerProcess = tsserverPathIsModule ? cp().fork(tsserverPath, args, options) : cp().spawn(tsserverPath, args);
121
+ this.readlineInterface = readline().createInterface(this.tsServerProcess.stdout, this.tsServerProcess.stdin, undefined);
122
+ process.on('exit', () => {
123
+ this.kill();
124
+ reject(new Error('TSServer was killed'));
125
+ });
126
+ this.readlineInterface.on('line', line => {
127
+ this.processMessage(line, resolve, reject);
128
+ });
129
+ const dec = new (decoder().StringDecoder)('utf-8');
130
+ this.tsServerProcess.stderr?.addListener('data', data => {
131
+ const stringMsg = typeof data === 'string' ? data : dec.write(data);
132
+ this.logger.error(stringMsg);
133
+ reject(new Error(stringMsg));
134
+ });
135
+ });
136
+ }
137
+ async notify(command, args) {
138
+ await this.ensureServerIsRunning();
139
+ this.sendMessage(command, true, args);
140
+ }
141
+ async request(command, args, token) {
142
+ await this.ensureServerIsRunning();
143
+ this.sendMessage(command, false, args);
144
+ const seq = this.seq;
145
+ const deferred = new (_utils().Deferred)();
146
+ this.deferreds[seq] = deferred;
147
+ const request = deferred.promise;
148
+ let onCancelled;
149
+ if (token) {
150
+ onCancelled = token.onCancellationRequested(() => {
151
+ onCancelled.dispose();
152
+ if (this.cancellationPipeName) {
153
+ const requestCancellationPipeName = `${this.cancellationPipeName}${seq}`;
154
+ fs().writeFile(requestCancellationPipeName, '', err => {
155
+ if (!err) {
156
+ // eslint-disable-next-line
157
+ request.then(() => fs().unlink(requestCancellationPipeName, () => {
158
+ /* no-op */
159
+ }));
160
+ }
161
+ });
162
+ }
163
+ });
164
+ }
165
+ try {
166
+ const result = await request;
167
+ onCancelled?.dispose();
168
+ return result;
169
+ } catch (error) {
170
+ this.logger.error(`Error in request: ${error}`);
171
+ throw error;
172
+ }
173
+ }
174
+ kill() {
175
+ this.tsServerProcess?.kill();
176
+ this.tsServerProcess?.stdin?.destroy();
177
+ this.readlineInterface?.close();
178
+ this.tsServerProcess = null;
179
+ this.readlineInterface = null;
180
+ }
181
+ log(msg, obj = {}) {
182
+ msg = `[tsserver] ${msg}`;
183
+ if (this.options.logToConsole) {
184
+ this.logger.console(`${msg} ${JSON.stringify(obj, undefined, 4)}`);
185
+ } else {
186
+ this.logger.trace(msg, obj);
187
+ }
188
+ }
189
+ sendMessage(command, notification, args) {
190
+ this.seq += 1;
191
+ const request = {
192
+ command,
193
+ seq: this.seq,
194
+ type: 'request'
195
+ };
196
+ if (args) {
197
+ request.arguments = args;
198
+ }
199
+ const serializedRequest = `${JSON.stringify(request)}\n`;
200
+ this.tsServerProcess?.stdin?.write(serializedRequest);
201
+ this.log(notification ? 'notify' : 'request', request);
202
+ }
203
+ processMessage(untrimmedMessageString, resolve, reject) {
204
+ const messageString = untrimmedMessageString.trim();
205
+ if (!messageString || messageString.startsWith('Content-Length:')) {
206
+ return;
207
+ }
208
+ let message;
209
+ try {
210
+ message = JSON.parse(messageString);
211
+ } catch {
212
+ // If the message isn't valid JSON, it's not a valid tsserver message. Reject the promise.
213
+ reject?.(new Error(`Received invalid message from TSServer: ${untrimmedMessageString}`));
214
+ return;
215
+ }
216
+ this.log('processMessage', message);
217
+ if (this.isEvent(message)) {
218
+ resolve?.();
219
+ }
220
+ if (this.isResponse(message)) {
221
+ this.resolveResponse(message, message.request_seq, message.success);
222
+ } else if (this.isEvent(message)) {
223
+ if (this.isRequestCompletedEvent(message)) {
224
+ this.resolveResponse(message, message.body.request_seq, true);
225
+ } else if (this.options.onEvent) {
226
+ this.options.onEvent(message);
227
+ }
228
+ }
229
+ }
230
+ resolveResponse(message, request_seq, success) {
231
+ const deferred = this.deferreds[request_seq];
232
+ this.log('request completed', {
233
+ request_seq,
234
+ success
235
+ });
236
+ if (deferred) {
237
+ if (success) {
238
+ this.deferreds[request_seq].resolve(message);
239
+ } else {
240
+ this.deferreds[request_seq].reject(message);
241
+ }
242
+ delete this.deferreds[request_seq];
243
+ }
244
+ }
245
+ isEvent(message) {
246
+ return message.type === 'event';
247
+ }
248
+ isResponse(message) {
249
+ return message.type === 'response';
250
+ }
251
+ isRequestCompletedEvent(message) {
252
+ return this.isEvent(message) && message.event === 'requestCompleted';
253
+ }
254
+ async ensureServerIsRunning() {
255
+ if (!this.tsServerProcess) {
256
+ await this.restart();
257
+ }
258
+ }
259
+ }
260
+ exports.ProcessBasedTsServer = ProcessBasedTsServer;
261
+
262
+ //# sourceMappingURL=process-based-tsserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fs","data","_interopRequireWildcard","require","path","cp","readline","decoder","_tempy","_interopRequireDefault","_utils","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ProcessBasedTsServer","seq","deferreds","constructor","options","tsServerArgs","logger","restart","kill","start","Promise","resolve","reject","tsServerProcess","Error","tsserverPath","logFile","logVerbosity","maxTsServerMemory","globalPlugins","pluginProbeLocations","args","push","length","join","cancellationPipeName","tempy","file","name","info","tsserverPathIsModule","extname","silent","execArgv","fork","spawn","readlineInterface","createInterface","stdout","stdin","undefined","process","on","line","processMessage","dec","StringDecoder","stderr","addListener","stringMsg","write","error","notify","command","ensureServerIsRunning","sendMessage","request","token","deferred","Deferred","promise","onCancelled","onCancellationRequested","dispose","requestCancellationPipeName","writeFile","err","then","unlink","result","destroy","close","log","msg","obj","logToConsole","console","JSON","stringify","trace","notification","type","arguments","serializedRequest","untrimmedMessageString","messageString","trim","startsWith","message","parse","isEvent","isResponse","resolveResponse","request_seq","success","isRequestCompletedEvent","body","onEvent","event","exports"],"sources":["process-based-tsserver.ts"],"sourcesContent":["/**\n * part of this file was copied over from https://github.com/typescript-language-server/typescript-language-server/blob/master/src/tsp-client.ts\n */\n\n/*\n * Copyright (C) 2017, 2018 TypeFox and others.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as cp from 'child_process';\nimport * as readline from 'readline';\nimport { Logger } from '@teambit/logger';\nimport { Readable, Writable } from 'stream';\nimport * as decoder from 'string_decoder';\nimport type ts from 'typescript/lib/tsserverlibrary';\nimport tempy from 'tempy';\nimport { CancellationToken } from 'vscode-jsonrpc';\nimport { CommandTypes } from './tsp-command-types';\nimport { Deferred } from './utils';\n\nexport interface TspClientOptions {\n logger: Logger;\n tsserverPath: string;\n logToConsole?: boolean;\n onEvent?: (event: ts.server.protocol.Event) => void;\n}\n\nexport interface TsServerArgs {\n logFile?: string;\n logVerbosity?: string;\n maxTsServerMemory?: number;\n globalPlugins?: string[];\n pluginProbeLocations?: string[];\n}\n\nexport interface StandardTsServerRequests {\n [CommandTypes.ApplyCodeActionCommand]: [\n ts.server.protocol.ApplyCodeActionCommandRequestArgs,\n ts.server.protocol.ApplyCodeActionCommandResponse,\n ];\n [CommandTypes.CompletionDetails]: [\n ts.server.protocol.CompletionDetailsRequestArgs,\n ts.server.protocol.CompletionDetailsResponse,\n ];\n [CommandTypes.CompletionInfo]: [ts.server.protocol.CompletionsRequestArgs, ts.server.protocol.CompletionInfoResponse];\n [CommandTypes.Configure]: [ts.server.protocol.ConfigureRequestArguments, ts.server.protocol.ConfigureResponse];\n [CommandTypes.Definition]: [ts.server.protocol.FileLocationRequestArgs, ts.server.protocol.DefinitionResponse];\n [CommandTypes.DefinitionAndBoundSpan]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.DefinitionInfoAndBoundSpanResponse,\n ];\n [CommandTypes.DocCommentTemplate]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.DocCommandTemplateResponse,\n ];\n [CommandTypes.DocumentHighlights]: [\n ts.server.protocol.DocumentHighlightsRequestArgs,\n ts.server.protocol.DocumentHighlightsResponse,\n ];\n [CommandTypes.Format]: [ts.server.protocol.FormatRequestArgs, ts.server.protocol.FormatResponse];\n [CommandTypes.Formatonkey]: [ts.server.protocol.FormatOnKeyRequestArgs, ts.server.protocol.FormatResponse];\n [CommandTypes.GetApplicableRefactors]: [\n ts.server.protocol.GetApplicableRefactorsRequestArgs,\n ts.server.protocol.GetApplicableRefactorsResponse,\n ];\n [CommandTypes.GetCodeFixes]: [ts.server.protocol.CodeFixRequestArgs, ts.server.protocol.CodeFixResponse];\n [CommandTypes.GetCombinedCodeFix]: [\n ts.server.protocol.GetCombinedCodeFixRequestArgs,\n ts.server.protocol.GetCombinedCodeFixResponse,\n ];\n [CommandTypes.GetEditsForFileRename]: [\n ts.server.protocol.GetEditsForFileRenameRequestArgs,\n ts.server.protocol.GetEditsForFileRenameResponse,\n ];\n [CommandTypes.GetEditsForRefactor]: [\n ts.server.protocol.GetEditsForRefactorRequestArgs,\n ts.server.protocol.GetEditsForRefactorResponse,\n ];\n [CommandTypes.GetOutliningSpans]: [ts.server.protocol.FileRequestArgs, ts.server.protocol.OutliningSpansResponse];\n [CommandTypes.GetSupportedCodeFixes]: [null, ts.server.protocol.GetSupportedCodeFixesResponse];\n [CommandTypes.Implementation]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.ImplementationResponse,\n ];\n [CommandTypes.JsxClosingTag]: [ts.server.protocol.JsxClosingTagRequestArgs, ts.server.protocol.JsxClosingTagResponse];\n [CommandTypes.Navto]: [ts.server.protocol.NavtoRequestArgs, ts.server.protocol.NavtoResponse];\n [CommandTypes.NavTree]: [ts.server.protocol.FileRequestArgs, ts.server.protocol.NavTreeResponse];\n [CommandTypes.OrganizeImports]: [\n ts.server.protocol.OrganizeImportsRequestArgs,\n ts.server.protocol.OrganizeImportsResponse,\n ];\n [CommandTypes.PrepareCallHierarchy]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.PrepareCallHierarchyResponse,\n ];\n [CommandTypes.ProvideCallHierarchyIncomingCalls]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.ProvideCallHierarchyIncomingCallsResponse,\n ];\n [CommandTypes.ProvideCallHierarchyOutgoingCalls]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.ProvideCallHierarchyOutgoingCallsResponse,\n ];\n [CommandTypes.ProjectInfo]: [ts.server.protocol.ProjectInfoRequestArgs, ts.server.protocol.ProjectInfoResponse];\n [CommandTypes.ProvideInlayHints]: [ts.server.protocol.InlayHintsRequestArgs, ts.server.protocol.InlayHintsResponse];\n [CommandTypes.Quickinfo]: [ts.server.protocol.FileLocationRequestArgs, ts.server.protocol.QuickInfoResponse];\n [CommandTypes.References]: [ts.server.protocol.FileLocationRequestArgs, ts.server.protocol.ReferencesResponse];\n [CommandTypes.Rename]: [ts.server.protocol.RenameRequestArgs, ts.server.protocol.RenameResponse];\n [CommandTypes.SelectionRange]: [\n ts.server.protocol.SelectionRangeRequestArgs,\n ts.server.protocol.SelectionRangeResponse,\n ];\n [CommandTypes.SignatureHelp]: [ts.server.protocol.SignatureHelpRequestArgs, ts.server.protocol.SignatureHelpResponse];\n [CommandTypes.TypeDefinition]: [\n ts.server.protocol.FileLocationRequestArgs,\n ts.server.protocol.TypeDefinitionResponse,\n ];\n [CommandTypes.UpdateOpen]: [ts.server.protocol.UpdateOpenRequestArgs, ts.server.protocol.Response];\n}\n\nexport interface NoResponseTsServerRequests {\n [CommandTypes.Change]: [ts.server.protocol.ChangeRequestArgs, null];\n [CommandTypes.Close]: [ts.server.protocol.FileRequestArgs, null];\n [CommandTypes.CompilerOptionsForInferredProjects]: [\n ts.server.protocol.SetCompilerOptionsForInferredProjectsArgs,\n ts.server.protocol.SetCompilerOptionsForInferredProjectsResponse,\n ];\n [CommandTypes.Configure]: [ts.server.protocol.ConfigureRequestArguments, ts.server.protocol.ConfigureResponse];\n [CommandTypes.ConfigurePlugin]: [\n ts.server.protocol.ConfigurePluginRequestArguments,\n ts.server.protocol.ConfigurePluginResponse,\n ];\n [CommandTypes.Open]: [ts.server.protocol.OpenRequestArgs, null];\n}\n\nexport interface AsyncTsServerRequests {\n [CommandTypes.Geterr]: [ts.server.protocol.GeterrRequestArgs, ts.server.protocol.Response];\n [CommandTypes.GeterrForProject]: [ts.server.protocol.GeterrForProjectRequestArgs, ts.server.protocol.Response];\n}\n\nexport type TypeScriptRequestTypes = StandardTsServerRequests & NoResponseTsServerRequests & AsyncTsServerRequests;\n\nexport class ProcessBasedTsServer {\n private readlineInterface: readline.ReadLine | null;\n private tsServerProcess: cp.ChildProcess | null;\n private seq = 0;\n\n private readonly deferreds: {\n [seq: number]: Deferred<any>;\n } = {};\n\n private logger: Logger;\n private cancellationPipeName: string | undefined;\n\n constructor(\n private options: TspClientOptions,\n private tsServerArgs: TsServerArgs = {}\n ) {\n this.logger = options.logger;\n }\n\n async restart() {\n this.kill();\n await this.start();\n }\n\n start() {\n return new Promise<void>((resolve, reject) => {\n if (this.tsServerProcess) {\n reject(new Error('server already started'));\n return;\n }\n\n const { tsserverPath } = this.options;\n const { logFile, logVerbosity, maxTsServerMemory, globalPlugins, pluginProbeLocations } = this.tsServerArgs;\n const args: string[] = [];\n if (logFile) {\n args.push('--logFile', logFile);\n }\n if (logVerbosity) {\n args.push('--logVerbosity', logVerbosity);\n }\n if (globalPlugins && globalPlugins.length) {\n args.push('--globalPlugins', globalPlugins.join(','));\n }\n if (pluginProbeLocations && pluginProbeLocations.length) {\n args.push('--pluginProbeLocations', pluginProbeLocations.join(','));\n }\n this.cancellationPipeName = tempy.file({ name: 'tscancellation' });\n args.push('--cancellationPipeName', `${this.cancellationPipeName}*`);\n this.logger.info(`Starting tsserver : '${tsserverPath} ${args.join(' ')}'`);\n const tsserverPathIsModule = path.extname(tsserverPath) === '.js';\n const options = {\n silent: true,\n execArgv: maxTsServerMemory ? [`--max-old-space-size=${maxTsServerMemory}`] : [],\n };\n this.tsServerProcess = tsserverPathIsModule ? cp.fork(tsserverPath, args, options) : cp.spawn(tsserverPath, args);\n\n this.readlineInterface = readline.createInterface(\n this.tsServerProcess.stdout as Readable,\n this.tsServerProcess.stdin as Writable,\n undefined\n );\n process.on('exit', () => {\n this.kill();\n reject(new Error('TSServer was killed'));\n });\n\n this.readlineInterface.on('line', (line) => {\n this.processMessage(line, resolve, reject);\n });\n\n const dec = new decoder.StringDecoder('utf-8');\n this.tsServerProcess.stderr?.addListener('data', (data) => {\n const stringMsg = typeof data === 'string' ? data : dec.write(data);\n this.logger.error(stringMsg);\n reject(new Error(stringMsg));\n });\n });\n }\n\n async notify(command: CommandTypes.Open, args: ts.server.protocol.OpenRequestArgs): Promise<void>;\n async notify(command: CommandTypes.Close, args: ts.server.protocol.FileRequestArgs): Promise<void>;\n async notify(command: CommandTypes.Saveto, args: ts.server.protocol.SavetoRequestArgs): Promise<void>;\n async notify(command: CommandTypes.Change, args: ts.server.protocol.ChangeRequestArgs): Promise<void>;\n async notify(command: string, args: any): Promise<void> {\n await this.ensureServerIsRunning();\n this.sendMessage(command, true, args);\n }\n\n async request<K extends keyof TypeScriptRequestTypes>(\n command: K,\n args: TypeScriptRequestTypes[K][0],\n token?: CancellationToken\n ): Promise<TypeScriptRequestTypes[K][1]> {\n await this.ensureServerIsRunning();\n this.sendMessage(command, false, args);\n const seq = this.seq;\n const deferred = new Deferred<TypeScriptRequestTypes[K][1]>();\n this.deferreds[seq] = deferred;\n const request = deferred.promise;\n\n let onCancelled;\n if (token) {\n onCancelled = token.onCancellationRequested(() => {\n onCancelled.dispose();\n if (this.cancellationPipeName) {\n const requestCancellationPipeName = `${this.cancellationPipeName}${seq}`;\n fs.writeFile(requestCancellationPipeName, '', (err) => {\n if (!err) {\n // eslint-disable-next-line\n request.then(() =>\n fs.unlink(requestCancellationPipeName, () => {\n /* no-op */\n })\n );\n }\n });\n }\n });\n }\n\n try {\n const result = await request;\n onCancelled?.dispose();\n return result;\n } catch (error) {\n this.logger.error(`Error in request: ${error}`);\n throw error;\n }\n }\n\n kill() {\n this.tsServerProcess?.kill();\n this.tsServerProcess?.stdin?.destroy();\n this.readlineInterface?.close();\n this.tsServerProcess = null;\n this.readlineInterface = null;\n }\n\n private log(msg: string, obj: Record<string, any> = {}) {\n msg = `[tsserver] ${msg}`;\n if (this.options.logToConsole) {\n this.logger.console(`${msg} ${JSON.stringify(obj, undefined, 4)}`);\n } else {\n this.logger.trace(msg, obj);\n }\n }\n\n protected sendMessage(command: string, notification: boolean, args?: any): void {\n this.seq += 1;\n const request: ts.server.protocol.Request = {\n command,\n seq: this.seq,\n type: 'request',\n };\n if (args) {\n request.arguments = args;\n }\n const serializedRequest = `${JSON.stringify(request)}\\n`;\n this.tsServerProcess?.stdin?.write(serializedRequest);\n this.log(notification ? 'notify' : 'request', request);\n }\n\n protected processMessage(untrimmedMessageString: string, resolve?: () => void, reject?: (err) => void): void {\n const messageString = untrimmedMessageString.trim();\n if (!messageString || messageString.startsWith('Content-Length:')) {\n return;\n }\n let message: ts.server.protocol.Message;\n\n try {\n message = JSON.parse(messageString);\n } catch {\n // If the message isn't valid JSON, it's not a valid tsserver message. Reject the promise.\n reject?.(new Error(`Received invalid message from TSServer: ${untrimmedMessageString}`));\n return;\n }\n\n this.log('processMessage', message);\n\n if (this.isEvent(message)) {\n resolve?.();\n }\n\n if (this.isResponse(message)) {\n this.resolveResponse(message, message.request_seq, message.success);\n } else if (this.isEvent(message)) {\n if (this.isRequestCompletedEvent(message)) {\n this.resolveResponse(message, message.body.request_seq, true);\n } else if (this.options.onEvent) {\n this.options.onEvent(message);\n }\n }\n }\n\n private resolveResponse(message: ts.server.protocol.Message, request_seq: number, success: boolean) {\n const deferred = this.deferreds[request_seq];\n this.log('request completed', { request_seq, success });\n if (deferred) {\n if (success) {\n this.deferreds[request_seq].resolve(message);\n } else {\n this.deferreds[request_seq].reject(message);\n }\n delete this.deferreds[request_seq];\n }\n }\n\n private isEvent(message: ts.server.protocol.Message): message is ts.server.protocol.Event {\n return message.type === 'event';\n }\n\n private isResponse(message: ts.server.protocol.Message): message is ts.server.protocol.Response {\n return message.type === 'response';\n }\n\n private isRequestCompletedEvent(\n message: ts.server.protocol.Message\n ): message is ts.server.protocol.RequestCompletedEvent {\n return this.isEvent(message) && message.event === 'requestCompleted';\n }\n\n private async ensureServerIsRunning() {\n if (!this.tsServerProcess) {\n await this.restart();\n }\n }\n}\n"],"mappings":";;;;;;AAWA,SAAAA,GAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,EAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,GAAA;EAAA,MAAAJ,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAE,EAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;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