@lewin671/lsp-client 0.1.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/LICENSE +21 -0
- package/README.md +64 -0
- package/lib/common/Feature.d.ts +192 -0
- package/lib/common/Feature.js +159 -0
- package/lib/common/Feature.js.map +1 -0
- package/lib/common/LanguageClient.d.ts +230 -0
- package/lib/common/LanguageClient.js +512 -0
- package/lib/common/LanguageClient.js.map +1 -0
- package/lib/common/features/CompletionFeature.d.ts +23 -0
- package/lib/common/features/CompletionFeature.js +101 -0
- package/lib/common/features/CompletionFeature.js.map +1 -0
- package/lib/common/features/DefinitionFeature.d.ts +23 -0
- package/lib/common/features/DefinitionFeature.js +49 -0
- package/lib/common/features/DefinitionFeature.js.map +1 -0
- package/lib/common/features/DiagnosticFeature.d.ts +15 -0
- package/lib/common/features/DiagnosticFeature.js +39 -0
- package/lib/common/features/DiagnosticFeature.js.map +1 -0
- package/lib/common/features/DocumentSymbolFeature.d.ts +23 -0
- package/lib/common/features/DocumentSymbolFeature.js +87 -0
- package/lib/common/features/DocumentSymbolFeature.js.map +1 -0
- package/lib/common/features/FormattingFeature.d.ts +32 -0
- package/lib/common/features/FormattingFeature.js +72 -0
- package/lib/common/features/FormattingFeature.js.map +1 -0
- package/lib/common/features/HoverFeature.d.ts +23 -0
- package/lib/common/features/HoverFeature.js +49 -0
- package/lib/common/features/HoverFeature.js.map +1 -0
- package/lib/common/features/ReferencesFeature.d.ts +23 -0
- package/lib/common/features/ReferencesFeature.js +48 -0
- package/lib/common/features/ReferencesFeature.js.map +1 -0
- package/lib/common/features/RenameFeature.d.ts +37 -0
- package/lib/common/features/RenameFeature.js +72 -0
- package/lib/common/features/RenameFeature.js.map +1 -0
- package/lib/common/features/index.d.ts +8 -0
- package/lib/common/features/index.js +21 -0
- package/lib/common/features/index.js.map +1 -0
- package/lib/common/utils/index.d.ts +2 -0
- package/lib/common/utils/index.js +19 -0
- package/lib/common/utils/index.js.map +1 -0
- package/lib/common/utils/is.d.ts +15 -0
- package/lib/common/utils/is.js +56 -0
- package/lib/common/utils/is.js.map +1 -0
- package/lib/common/utils/uuid.d.ts +17 -0
- package/lib/common/utils/uuid.js +87 -0
- package/lib/common/utils/uuid.js.map +1 -0
- package/lib/demo/custom-lsp/client.d.ts +1 -0
- package/lib/demo/custom-lsp/client.js +86 -0
- package/lib/demo/custom-lsp/client.js.map +1 -0
- package/lib/demo/custom-lsp/server.d.ts +1 -0
- package/lib/demo/custom-lsp/server.js +64 -0
- package/lib/demo/custom-lsp/server.js.map +1 -0
- package/lib/demo/go-demo/client.d.ts +14 -0
- package/lib/demo/go-demo/client.js +697 -0
- package/lib/demo/go-demo/client.js.map +1 -0
- package/lib/demo/typescript-demo/client.d.ts +14 -0
- package/lib/demo/typescript-demo/client.js +680 -0
- package/lib/demo/typescript-demo/client.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/index.d.ts +9 -0
- package/lib/demo/typescript-demo/sample-project/src/index.js +65 -0
- package/lib/demo/typescript-demo/sample-project/src/index.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/math.d.ts +38 -0
- package/lib/demo/typescript-demo/sample-project/src/math.js +63 -0
- package/lib/demo/typescript-demo/sample-project/src/math.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/models/person.d.ts +41 -0
- package/lib/demo/typescript-demo/sample-project/src/models/person.js +53 -0
- package/lib/demo/typescript-demo/sample-project/src/models/person.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/services/calculator.d.ts +39 -0
- package/lib/demo/typescript-demo/sample-project/src/services/calculator.js +69 -0
- package/lib/demo/typescript-demo/sample-project/src/services/calculator.js.map +1 -0
- package/lib/demo/typescript-demo/sample-project/src/services/user-service.d.ts +40 -0
- package/lib/demo/typescript-demo/sample-project/src/services/user-service.js +88 -0
- package/lib/demo/typescript-demo/sample-project/src/services/user-service.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +32 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/IHost.d.ts +19 -0
- package/lib/interfaces/IHost.js +3 -0
- package/lib/interfaces/IHost.js.map +1 -0
- package/lib/transports/ITransport.d.ts +8 -0
- package/lib/transports/ITransport.js +3 -0
- package/lib/transports/ITransport.js.map +1 -0
- package/lib/transports/StdioTransport.d.ts +13 -0
- package/lib/transports/StdioTransport.js +27 -0
- package/lib/transports/StdioTransport.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IHost.js","sourceRoot":"","sources":["../../src/interfaces/IHost.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../src/transports/ITransport.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ITransport } from './ITransport';
|
|
2
|
+
import { MessageReader, MessageWriter } from 'vscode-jsonrpc/node';
|
|
3
|
+
export declare class StdioTransport implements ITransport {
|
|
4
|
+
private command;
|
|
5
|
+
private args;
|
|
6
|
+
private process;
|
|
7
|
+
constructor(command: string, args: string[]);
|
|
8
|
+
connect(): Promise<{
|
|
9
|
+
reader: MessageReader;
|
|
10
|
+
writer: MessageWriter;
|
|
11
|
+
}>;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StdioTransport = void 0;
|
|
4
|
+
const node_1 = require("vscode-jsonrpc/node");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
class StdioTransport {
|
|
7
|
+
constructor(command, args) {
|
|
8
|
+
this.command = command;
|
|
9
|
+
this.args = args;
|
|
10
|
+
}
|
|
11
|
+
async connect() {
|
|
12
|
+
this.process = (0, child_process_1.spawn)(this.command, this.args);
|
|
13
|
+
if (!this.process.stdout || !this.process.stdin) {
|
|
14
|
+
throw new Error('Failed to spawn process with stdout/stdin');
|
|
15
|
+
}
|
|
16
|
+
const reader = new node_1.StreamMessageReader(this.process.stdout);
|
|
17
|
+
const writer = new node_1.StreamMessageWriter(this.process.stdin);
|
|
18
|
+
return { reader, writer };
|
|
19
|
+
}
|
|
20
|
+
dispose() {
|
|
21
|
+
if (this.process) {
|
|
22
|
+
this.process.kill();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.StdioTransport = StdioTransport;
|
|
27
|
+
//# sourceMappingURL=StdioTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StdioTransport.js","sourceRoot":"","sources":["../../src/transports/StdioTransport.ts"],"names":[],"mappings":";;;AACA,8CAA6G;AAC7G,iDAAoD;AAEpD,MAAa,cAAc;IAGvB,YAAoB,OAAe,EAAU,IAAc;QAAvC,YAAO,GAAP,OAAO,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAU;IAAG,CAAC;IAE/D,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,OAAO,GAAG,IAAA,qBAAK,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QACjE,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,0BAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAI,0BAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO;QACH,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;IACL,CAAC;CACJ;AAvBD,wCAuBC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lewin671/lsp-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Universal LSP Client SDK for TypeScript",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/Lewin671/lsp-client.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "Lewin671",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Lewin671/lsp-client/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/Lewin671/lsp-client#readme",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"lsp",
|
|
22
|
+
"language-server-protocol",
|
|
23
|
+
"typescript",
|
|
24
|
+
"language-client"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"watch": "tsc -w",
|
|
29
|
+
"clean": "rm -rf lib",
|
|
30
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
31
|
+
"publish": "npm run prepublishOnly && npm publish --access public",
|
|
32
|
+
"demo": "node lib/demo/client.js",
|
|
33
|
+
"demo:custom": "node lib/demo/custom-lsp/client.js",
|
|
34
|
+
"demo:typescript": "node lib/demo/typescript-demo/client.js",
|
|
35
|
+
"demo:go": "node lib/demo/go-demo/client.js"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"vscode-jsonrpc": "^8.1.0",
|
|
39
|
+
"vscode-languageserver-protocol": "^3.17.3",
|
|
40
|
+
"vscode-languageserver-types": "^3.17.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^18.0.0",
|
|
44
|
+
"typescript": "^5.0.0",
|
|
45
|
+
"vscode-languageserver": "^9.0.1",
|
|
46
|
+
"vscode-languageserver-textdocument": "^1.0.12"
|
|
47
|
+
}
|
|
48
|
+
}
|