add lsp interface
This commit is contained in:
parent
ee9f6b165d
commit
5c9ddd25a8
30
package-lock.json
generated
30
package-lock.json
generated
@ -13,6 +13,7 @@
|
||||
"showdown": "^2.1.0",
|
||||
"state-machine-cat": "^9.2.5",
|
||||
"temp": "^0.9.4",
|
||||
"vscode-jsonrpc": "^8.2.1",
|
||||
"vscode-languageclient": "^7.0.0",
|
||||
"vscode-textmate": "^9.0.0",
|
||||
"wavedrom": "^2.9.1"
|
||||
@ -3809,11 +3810,11 @@
|
||||
"deprecated": "no longer supported"
|
||||
},
|
||||
"node_modules/vscode-jsonrpc": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
|
||||
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==",
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz",
|
||||
"integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==",
|
||||
"engines": {
|
||||
"node": ">=8.0.0 || >=10.0.0"
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vscode-languageclient": {
|
||||
@ -3838,6 +3839,14 @@
|
||||
"vscode-languageserver-types": "3.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
|
||||
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==",
|
||||
"engines": {
|
||||
"node": ">=8.0.0 || >=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vscode-languageserver-types": {
|
||||
"version": "3.16.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz",
|
||||
@ -7124,9 +7133,9 @@
|
||||
"integrity": "sha512-W+1+N/hdzLpQZEcvz79n2IgUE9pfx6JLdHh3Kh8RGvLL8P1LdJVQmi2OsDcLdY4QVID4OUy+FPelyerX0nJxIQ=="
|
||||
},
|
||||
"vscode-jsonrpc": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
|
||||
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg=="
|
||||
"version": "8.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz",
|
||||
"integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ=="
|
||||
},
|
||||
"vscode-languageclient": {
|
||||
"version": "7.0.0",
|
||||
@ -7145,6 +7154,13 @@
|
||||
"requires": {
|
||||
"vscode-jsonrpc": "6.0.0",
|
||||
"vscode-languageserver-types": "3.16.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"vscode-jsonrpc": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz",
|
||||
"integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"vscode-languageserver-types": {
|
||||
|
@ -1158,8 +1158,9 @@
|
||||
"showdown": "^2.1.0",
|
||||
"state-machine-cat": "^9.2.5",
|
||||
"temp": "^0.9.4",
|
||||
"vscode-jsonrpc": "^8.2.1",
|
||||
"vscode-languageclient": "^7.0.0",
|
||||
"vscode-textmate": "^9.0.0",
|
||||
"wavedrom": "^2.9.1",
|
||||
"vscode-languageclient": "^7.0.0"
|
||||
"wavedrom": "^2.9.1"
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,8 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
||||
func.registerFSM(context);
|
||||
func.registerNetlist(context);
|
||||
func.registerWaveViewer(context);
|
||||
<<<<<<< HEAD
|
||||
lspClient.activate(context);
|
||||
lspClient.activateVHDL(context);
|
||||
=======
|
||||
|
||||
lspClient.activate(context);
|
||||
>>>>>>> 199b7a8af3ea01baea4b20c89273a490dc0dc9d2
|
||||
// lspClient.activateVHDL(context);
|
||||
}
|
||||
|
||||
|
||||
@ -67,8 +62,5 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
export function deactivate() {
|
||||
lspClient.deactivate();
|
||||
<<<<<<< HEAD
|
||||
lspClient.deactivateVHDL();
|
||||
=======
|
||||
>>>>>>> 199b7a8af3ea01baea4b20c89273a490dc0dc9d2
|
||||
// lspClient.deactivateVHDL();
|
||||
}
|
@ -9,9 +9,7 @@ import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { platform } from "os";
|
||||
|
||||
let client: LanguageClient;
|
||||
let vhdlClient: LanguageClient;
|
||||
import { LspClient } from '../../global';
|
||||
|
||||
function getLspServerExecutionName() {
|
||||
const osname = platform();
|
||||
@ -58,21 +56,22 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
],
|
||||
};
|
||||
|
||||
client = new LanguageClient(
|
||||
const client = new LanguageClient(
|
||||
"Digital LSP",
|
||||
"Digital LSP",
|
||||
serverOptions,
|
||||
clientOptions
|
||||
);
|
||||
|
||||
LspClient.MainClient = client;
|
||||
|
||||
client.start();
|
||||
}
|
||||
|
||||
export function deactivate(): Thenable<void> | undefined {
|
||||
if (!client) {
|
||||
if (!LspClient.MainClient) {
|
||||
return undefined;
|
||||
}
|
||||
return client.stop();
|
||||
return LspClient.MainClient.stop();
|
||||
}
|
||||
|
||||
|
||||
@ -117,19 +116,20 @@ export function activateVHDL(context: vscode.ExtensionContext) {
|
||||
],
|
||||
};
|
||||
|
||||
client = new LanguageClient(
|
||||
const client = new LanguageClient(
|
||||
"Digital LSP VHDL",
|
||||
"Digital LSP VHDL",
|
||||
serverOptions,
|
||||
clientOptions
|
||||
);
|
||||
|
||||
LspClient.VhdlClient = client;
|
||||
client.start();
|
||||
}
|
||||
|
||||
export function deactivateVHDL(): Thenable<void> | undefined {
|
||||
if (!vhdlClient) {
|
||||
if (!LspClient.VhdlClient) {
|
||||
return undefined;
|
||||
}
|
||||
return vhdlClient.stop();
|
||||
return LspClient.VhdlClient.stop();
|
||||
}
|
@ -4,6 +4,7 @@ import { MainOutput, LspOutput, YosysOutput, WaveViewOutput, ReportType } from '
|
||||
|
||||
import * as Enum from './enum';
|
||||
import * as Lang from './lang';
|
||||
import { LspClient } from './lsp';
|
||||
|
||||
type AbsPath = string;
|
||||
type RelPath = string;
|
||||
@ -24,5 +25,6 @@ export {
|
||||
YosysOutput,
|
||||
WaveViewOutput,
|
||||
ReportType,
|
||||
AllowNull
|
||||
AllowNull,
|
||||
LspClient
|
||||
};
|
14
src/global/lsp.ts
Normal file
14
src/global/lsp.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { LanguageClient, RequestType, ProtocolConnection } from 'vscode-languageclient/node';
|
||||
|
||||
|
||||
interface IDigitalIDELspClient {
|
||||
MainClient?: LanguageClient,
|
||||
VhdlClient?: LanguageClient
|
||||
}
|
||||
|
||||
export const LspClient: IDigitalIDELspClient = {
|
||||
MainClient: undefined,
|
||||
VhdlClient: undefined
|
||||
};
|
||||
|
||||
export const CustomRequestType = new RequestType<string[], void, void>('custom/request');
|
@ -227,7 +227,8 @@ class HdlParam {
|
||||
|
||||
private async doHdlFast(path: AbsPath) {
|
||||
try {
|
||||
const fast = await HdlSymbol.fast(path);
|
||||
// TODO: make this quick
|
||||
const fast = await HdlSymbol.fast(path);
|
||||
if (fast) {
|
||||
const languageId = this.alignLanguageId(fast.languageId);
|
||||
new HdlFile(path,
|
||||
@ -248,6 +249,7 @@ class HdlParam {
|
||||
}
|
||||
|
||||
public async initialize(hdlFiles: AbsPath[] | Generator<AbsPath>) {
|
||||
|
||||
// await this.initHdlFiles(hdlFiles);
|
||||
|
||||
// for (const hdlFile of this.getAllHdlFiles()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user