diff --git a/l10n/bundle.l10n.de.json b/l10n/bundle.l10n.de.json index a53a58d..0973b84 100644 --- a/l10n/bundle.l10n.de.json +++ b/l10n/bundle.l10n.de.json @@ -117,5 +117,8 @@ "info.addDevice.add-success": "Gerät {0} wurde erfolgreich hinzugefügt", "info.delDevice.placeholder": "Wählen Sie das zu löschende Gerät aus", "info.delDevice.del-success": "Gerät {0} wurde erfolgreich gelöscht", - "info.progress.launch-lsp": "Starten Sie den Digital LSP-Sprachserver" + "info.progress.launch-lsp": "Starten Sie den Digital LSP-Sprachserver", + "info.choose.digital-lsp-targz": "Wählen Sie das Digital LSP-Archiv aus", + "info.digital-lsp.targz": "Digitales LSP-Paket", + "error.digital-lsp.incorrect-filename": "Die von Ihnen bereitgestellte Digital-LSP-Archivdatei {0} entspricht nicht der aktuellen Systemarchitektur. Bitte laden Sie die Archivdatei mit dem Namen {1} herunter!" } \ No newline at end of file diff --git a/l10n/bundle.l10n.en.json b/l10n/bundle.l10n.en.json index 60fdbf4..4fe28b0 100644 --- a/l10n/bundle.l10n.en.json +++ b/l10n/bundle.l10n.en.json @@ -117,5 +117,8 @@ "info.addDevice.add-success": "Device {0} has been successfully added", "info.delDevice.placeholder": "Select the device to delete", "info.delDevice.del-success": "Device {0} has been successfully deleted", - "info.progress.launch-lsp": "Start the Digital LSP language server" + "info.progress.launch-lsp": "Start the Digital LSP language server", + "info.choose.digital-lsp-targz": "Select the Digital LSP archive", + "info.digital-lsp.targz": "Digital LSP Package", + "error.digital-lsp.incorrect-filename": "The digital LSP archive file {0} you provided does not match the current system architecture. Please download the archive file named {1}!" } \ No newline at end of file diff --git a/l10n/bundle.l10n.ja.json b/l10n/bundle.l10n.ja.json index 0143285..70ff430 100644 --- a/l10n/bundle.l10n.ja.json +++ b/l10n/bundle.l10n.ja.json @@ -117,5 +117,8 @@ "info.addDevice.add-success": "デバイス {0} が正常に追加されました", "info.delDevice.placeholder": "削除するデバイスを選択してください", "info.delDevice.del-success": "デバイス {0} は正常に削除されました", - "info.progress.launch-lsp": "Digital LSP 言語サーバーを起動する" + "info.progress.launch-lsp": "Digital LSP 言語サーバーを起動する", + "info.choose.digital-lsp-targz": "Digital LSPのアーカイブを選択してください", + "info.digital-lsp.targz": "デジタルLSPパッケージ", + "error.digital-lsp.incorrect-filename": "提供されたデジタルLSPアーカイブファイル{0}は、現在のシステムアーキテクチャに適合していません。{1}という名前のアーカイブファイルをダウンロードしてください!" } \ No newline at end of file diff --git a/l10n/bundle.l10n.zh-cn.json b/l10n/bundle.l10n.zh-cn.json index a9bd5f7..bb3d0e0 100644 --- a/l10n/bundle.l10n.zh-cn.json +++ b/l10n/bundle.l10n.zh-cn.json @@ -117,5 +117,8 @@ "info.addDevice.add-success": "device {0} 已被成功添加", "info.delDevice.placeholder": "选择需要删除的 device", "info.delDevice.del-success": "device {0} 已被成功删除", - "info.progress.launch-lsp": "启动 Digital LSP 语言服务器" + "info.progress.launch-lsp": "启动 Digital LSP 语言服务器", + "info.choose.digital-lsp-targz": "选择 Digital LSP 的压缩包", + "info.digital-lsp.targz": "Digital LSP 压缩包", + "error.digital-lsp.incorrect-filename": "您提供的 digital lsp 压缩包文件 {0} 并不是一个符合当前系统架构的,请下载名为 {1} 的压缩包文件!" } \ No newline at end of file diff --git a/l10n/bundle.l10n.zh-tw.json b/l10n/bundle.l10n.zh-tw.json index da35311..7c81f56 100644 --- a/l10n/bundle.l10n.zh-tw.json +++ b/l10n/bundle.l10n.zh-tw.json @@ -117,5 +117,8 @@ "info.addDevice.add-success": "設備 {0} 已成功添加", "info.delDevice.placeholder": "選擇需要刪除的設備", "info.delDevice.del-success": "設備 {0} 已被成功刪除", - "info.progress.launch-lsp": "啟動 Digital LSP 語言伺服器" + "info.progress.launch-lsp": "啟動 Digital LSP 語言伺服器", + "info.choose.digital-lsp-targz": "選擇 Digital LSP 的壓縮包", + "info.digital-lsp.targz": "數位LSP壓縮包", + "error.digital-lsp.incorrect-filename": "您提供的 digital lsp 壓縮包文件 {0} 並不是一個符合當前系統架構的,請下載名為 {1} 的壓縮包文件!" } \ No newline at end of file diff --git a/package.json b/package.json index 8381721..0fd74bf 100644 --- a/package.json +++ b/package.json @@ -608,6 +608,11 @@ "category": "Digital-IDE", "title": "%digital-ide.digital-lsp.download.title%" }, + { + "command": "digital-ide.digital-lsp.install", + "category": "Digital-IDE", + "title": "%digital-ide.digital-lsp.install.title%" + }, { "command": "digital-ide.vhdl2vlog", "title": "%digital-ide.vhdl2vlog.title%", diff --git a/package.nls.de.json b/package.nls.de.json index f3e4836..d409ce5 100644 --- a/package.nls.de.json +++ b/package.nls.de.json @@ -105,5 +105,6 @@ "digital-ide.function.netlist.schema-mode.0.title": "Prä-Verhaltenssynthese", "digital-ide.function.netlist.schema-mode.1.title": "Post-Verhaltenssynthese", "digital-ide.function.netlist.schema-mode.2.title": "Post-RTL-Synthese", - "digital-ide.run-ys.title": "yosys-Skript ausführen" + "digital-ide.run-ys.title": "yosys-Skript ausführen", + "digital-ide.digital-lsp.install.title": "Digital LSP-Sprachserver installieren" } \ No newline at end of file diff --git a/package.nls.ja.json b/package.nls.ja.json index af24420..10447dc 100644 --- a/package.nls.ja.json +++ b/package.nls.ja.json @@ -105,5 +105,6 @@ "digital-ide.function.netlist.schema-mode.0.title": "ビヘイビア前合成", "digital-ide.function.netlist.schema-mode.1.title": "ビヘイビア後合成", "digital-ide.function.netlist.schema-mode.2.title": "RTL後合成", - "digital-ide.run-ys.title": "yosys スクリプトを実行" + "digital-ide.run-ys.title": "yosys スクリプトを実行", + "digital-ide.digital-lsp.install.title": "Digital LSP 言語サーバーをインストール" } \ No newline at end of file diff --git a/package.nls.json b/package.nls.json index ea49a91..fbbfa89 100644 --- a/package.nls.json +++ b/package.nls.json @@ -105,5 +105,6 @@ "digital-ide.function.netlist.schema-mode.0.title": "Pre-Behavioral Synthesis", "digital-ide.function.netlist.schema-mode.1.title": "Post-Behavioral Synthesis", "digital-ide.function.netlist.schema-mode.2.title": "Post-RTL Synthesis", - "digital-ide.run-ys.title": "Run yosys script" + "digital-ide.run-ys.title": "Run yosys script", + "digital-ide.digital-lsp.install.title": "Install Digital LSP Language Server" } \ No newline at end of file diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index 260745e..a9f64dd 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -105,5 +105,6 @@ "digital-ide.function.netlist.schema-mode.0.title": "行为前综合", "digital-ide.function.netlist.schema-mode.1.title": "行为后综合", "digital-ide.function.netlist.schema-mode.2.title": "RTL后综合", - "digital-ide.run-ys.title": "运行 yosys 脚本" + "digital-ide.run-ys.title": "运行 yosys 脚本", + "digital-ide.digital-lsp.install.title": "安装 Digital LSP 语言服务器" } \ No newline at end of file diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index 341b940..8d662ca 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -105,5 +105,6 @@ "digital-ide.function.netlist.schema-mode.0.title": "行為前綜合", "digital-ide.function.netlist.schema-mode.1.title": "行為後綜合", "digital-ide.function.netlist.schema-mode.2.title": "RTL後綜合", - "digital-ide.run-ys.title": "運行 yosys 腳本" + "digital-ide.run-ys.title": "運行 yosys 腳本", + "digital-ide.digital-lsp.install.title": "安裝 Digital LSP 語言伺服器" } \ No newline at end of file diff --git a/src/function/index.ts b/src/function/index.ts index 0ba61db..ec70de7 100644 --- a/src/function/index.ts +++ b/src/function/index.ts @@ -16,7 +16,7 @@ import * as FSM from './fsm'; import * as Netlist from './dide-netlist'; import * as WaveView from './dide-viewer'; import { ModuleDataItem } from './treeView/tree'; -import { downloadLsp } from './lsp-client'; +import { downloadLsp, installLsp } from './lsp-client'; import { hdlPath } from '../hdlFs'; function registerDocumentation(context: vscode.ExtensionContext) { @@ -101,6 +101,13 @@ function registerLsp(context: vscode.ExtensionContext, version: string) { downloadLsp(context, version, versionFolderPath) }); + vscode.commands.registerCommand('digital-ide.digital-lsp.install', () => { + const versionFolderPath = context.asAbsolutePath( + path.join('resources', 'dide-lsp', 'server', version) + ); + installLsp(context, version, versionFolderPath); + }); + const vlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'verilog'}; const svlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'systemverilog'}; const vhdlSelector: vscode.DocumentSelector = {scheme: 'file', language: 'vhdl'}; diff --git a/src/function/lsp-client/cdn.ts b/src/function/lsp-client/cdn.ts index a5bfe15..b35c8c5 100644 --- a/src/function/lsp-client/cdn.ts +++ b/src/function/lsp-client/cdn.ts @@ -1,16 +1,21 @@ import axios from 'axios'; import { performance } from 'perf_hooks'; +export function getLspFileName(version: string, signature: string) { + return `digital-lsp_${version}_${signature}.tar.gz`; +} // const link1 = 'https://gitee.com/Digital-IDE/Digital-IDE/releases/download/0.4.0/digital-lsp_0.4.0_darwin_aarch64.tar.gz'; // const link2 = 'https://github.com/Digital-EDA/Digital-IDE/releases/download/0.4.0/digital-lsp_0.4.0_darwin_aarch64.tar.gz'; export function getGithubDownloadLink(signature: string, version: string): string { - return `https://github.com/Digital-EDA/Digital-IDE/releases/download/${version}/digital-lsp_${version}_${signature}.tar.gz`; + const filename = getLspFileName(version, signature); + return `https://github.com/Digital-EDA/Digital-IDE/releases/download/${version}/${filename}`; } export function getGiteeDownloadLink(signature: string, version: string): string { - return `https://gitee.com/Digital-IDE/Digital-IDE/releases/download/${version}/digital-lsp_${version}_${signature}.tar.gz`; + const filename = getLspFileName(version, signature); + return `https://gitee.com/Digital-IDE/Digital-IDE/releases/download/${version}/${filename}`; } function measureRequestTimecost(url: string, timeout: number = 5): Promise { diff --git a/src/function/lsp-client/index.ts b/src/function/lsp-client/index.ts index 30f7812..4f1e314 100644 --- a/src/function/lsp-client/index.ts +++ b/src/function/lsp-client/index.ts @@ -13,7 +13,7 @@ import * as tar from 'tar'; import { platform } from "os"; import { IProgress, LspClient, opeParam } from '../../global'; import axios, { AxiosResponse } from "axios"; -import { chooseBestDownloadSource } from "./cdn"; +import { chooseBestDownloadSource, getLspFileName } from "./cdn"; import { hdlDir, hdlPath } from "../../hdlFs"; import { registerConfigurationUpdater, registerLinter } from "./config"; import { t } from "../../i18n"; @@ -115,7 +115,7 @@ export async function downloadLsp(context: vscode.ExtensionContext, version: str console.log('choose download link: ' + downloadLink); clearInterval(intervalHandler); - return downloadLink + return downloadLink; }); const tarGzFilePath = await vscode.window.withProgress({ @@ -142,6 +142,48 @@ export async function downloadLsp(context: vscode.ExtensionContext, version: str return false; } + +export async function installLsp(context: vscode.ExtensionContext, version: string, versionFolderPath: string): Promise { + + const uri = await vscode.window.showOpenDialog({ + title: t('info.choose.digital-lsp-targz'), + canSelectFiles: true, + canSelectFolders: false, + canSelectMany: false, + filters: { + [t('info.digital-lsp.targz')]: ['tar.gz'], + [t('info.vcd-viewer.all-file')]: ['*'] + } + }); + + if (!uri) { + return false; + } + + const tarGzFilePath = uri[0].fsPath; + const filename = path.basename(tarGzFilePath); + const signature = getPlatformPlatformSignature().toString(); + const expectFilename = getLspFileName(version, signature); + if (expectFilename !== filename) { + vscode.window.showErrorMessage(t('error.digital-lsp.incorrect-filename', filename, expectFilename)); + return false; + } + + await vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: t('info.progress.extract-digital-lsp') + }, async (progress: vscode.Progress, token: vscode.CancellationToken) => { + if (fs.existsSync(tarGzFilePath)) { + console.log('check finish, begin to extract'); + await extractTarGz(tarGzFilePath, versionFolderPath); + } else { + vscode.window.showErrorMessage(t('error.lsp.download-digital-lsp') + version); + } + }); + + return false; +} + export async function activate(context: vscode.ExtensionContext, packageJson: any) { const version = packageJson.version; await checkAndDownload(context, version); diff --git a/update.bat b/update.bat new file mode 100644 index 0000000..649121b --- /dev/null +++ b/update.bat @@ -0,0 +1,2 @@ +yarn build +scp -P 2233 -r src/.vuepress/dist/* ubuntu@nc-ai.cn:/home/ubuntu/html \ No newline at end of file