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