合并 vhdl lsp
This commit is contained in:
parent
d2755e0a05
commit
e4c8f3cfb1
@ -22,7 +22,6 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
lspClient.activate(context);
|
lspClient.activate(context);
|
||||||
await LspClient.MainClient?.onReady();
|
await LspClient.MainClient?.onReady();
|
||||||
// lspClient.activateVHDL(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function launch(context: vscode.ExtensionContext) {
|
async function launch(context: vscode.ExtensionContext) {
|
||||||
@ -83,5 +82,4 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
export function deactivate() {
|
export function deactivate() {
|
||||||
lspClient.deactivate();
|
lspClient.deactivate();
|
||||||
// lspClient.deactivateVHDL();
|
|
||||||
}
|
}
|
@ -20,6 +20,7 @@ function getLspServerExecutionName() {
|
|||||||
return 'digital-lsp';
|
return 'digital-lsp';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
const lspServerName = getLspServerExecutionName();
|
const lspServerName = getLspServerExecutionName();
|
||||||
const lspServerPath = context.asAbsolutePath(
|
const lspServerPath = context.asAbsolutePath(
|
||||||
@ -52,6 +53,10 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
{
|
{
|
||||||
scheme: 'file',
|
scheme: 'file',
|
||||||
language: 'verilog'
|
language: 'verilog'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scheme: 'file',
|
||||||
|
language: 'vhdl'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@ -74,62 +79,3 @@ export function deactivate(): Thenable<void> | undefined {
|
|||||||
return LspClient.MainClient.stop();
|
return LspClient.MainClient.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getLspServerExecutionNameVHDL() {
|
|
||||||
const osname = platform();
|
|
||||||
if (osname === 'win32') {
|
|
||||||
return 'vhdl_ls.exe';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'vhdl_ls';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function activateVHDL(context: vscode.ExtensionContext) {
|
|
||||||
const lspServerName = getLspServerExecutionNameVHDL();
|
|
||||||
const lspServerPath = context.asAbsolutePath(
|
|
||||||
path.join('resources', 'dide-lsp', 'server', lspServerName)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (fs.existsSync(lspServerPath)) {
|
|
||||||
console.log('lsp server found at ' + lspServerPath);
|
|
||||||
} else {
|
|
||||||
console.error('cannot found lsp server at ' + lspServerPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
const run: Executable = {
|
|
||||||
command: lspServerPath,
|
|
||||||
};
|
|
||||||
|
|
||||||
// If the extension is launched in debug mode then the debug server options are used
|
|
||||||
// Otherwise the run options are used
|
|
||||||
let serverOptions: ServerOptions = {
|
|
||||||
run,
|
|
||||||
debug: run,
|
|
||||||
};
|
|
||||||
|
|
||||||
let clientOptions: LanguageClientOptions = {
|
|
||||||
documentSelector: [
|
|
||||||
{
|
|
||||||
scheme: 'file',
|
|
||||||
language: 'vhdl'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const client = new LanguageClient(
|
|
||||||
"Digital LSP VHDL",
|
|
||||||
"Digital LSP VHDL",
|
|
||||||
serverOptions,
|
|
||||||
clientOptions
|
|
||||||
);
|
|
||||||
|
|
||||||
LspClient.VhdlClient = client;
|
|
||||||
client.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function deactivateVHDL(): Thenable<void> | undefined {
|
|
||||||
if (!LspClient.VhdlClient) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return LspClient.VhdlClient.stop();
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user