From e4c8f3cfb10d364a787812ab4436fa408944c622 Mon Sep 17 00:00:00 2001 From: Kirigaya <1193466151@qq.com> Date: Mon, 30 Sep 2024 23:20:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=20vhdl=20lsp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension.ts | 2 - src/function/lsp-client/index.ts | 64 +++----------------------------- 2 files changed, 5 insertions(+), 61 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index ceba564..4d8f4a3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -22,7 +22,6 @@ async function registerCommand(context: vscode.ExtensionContext) { lspClient.activate(context); await LspClient.MainClient?.onReady(); - // lspClient.activateVHDL(context); } async function launch(context: vscode.ExtensionContext) { @@ -83,5 +82,4 @@ export function activate(context: vscode.ExtensionContext) { export function deactivate() { lspClient.deactivate(); - // lspClient.deactivateVHDL(); } \ No newline at end of file diff --git a/src/function/lsp-client/index.ts b/src/function/lsp-client/index.ts index b931bfa..74891a7 100644 --- a/src/function/lsp-client/index.ts +++ b/src/function/lsp-client/index.ts @@ -20,6 +20,7 @@ function getLspServerExecutionName() { return 'digital-lsp'; } + export function activate(context: vscode.ExtensionContext) { const lspServerName = getLspServerExecutionName(); const lspServerPath = context.asAbsolutePath( @@ -52,6 +53,10 @@ export function activate(context: vscode.ExtensionContext) { { scheme: 'file', language: 'verilog' + }, + { + scheme: 'file', + language: 'vhdl' } ], }; @@ -74,62 +79,3 @@ export function deactivate(): Thenable | undefined { 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 | undefined { - if (!LspClient.VhdlClient) { - return undefined; - } - return LspClient.VhdlClient.stop(); -} \ No newline at end of file