增加手动安装的功能

This commit is contained in:
锦恢 2025-01-09 17:47:29 +08:00
parent 0029c7d710
commit f20edcfff8
15 changed files with 96 additions and 15 deletions

View File

@ -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!"
}

View File

@ -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}!"
}

View File

@ -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}という名前のアーカイブファイルをダウンロードしてください!"
}

View File

@ -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} 的压缩包文件!"
}

View File

@ -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} 的壓縮包文件!"
}

View File

@ -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%",

View File

@ -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"
}

View File

@ -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 言語サーバーをインストール"
}

View File

@ -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"
}

View File

@ -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 语言服务器"
}

View File

@ -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 語言伺服器"
}

View File

@ -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'};

View File

@ -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<number> {

View File

@ -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<boolean> {
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<IProgress>, 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);

2
update.bat Normal file
View File

@ -0,0 +1,2 @@
yarn build
scp -P 2233 -r src/.vuepress/dist/* ubuntu@nc-ai.cn:/home/ubuntu/html