实现下载
This commit is contained in:
parent
9657f3c77a
commit
5231b22181
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,15 +1,9 @@
|
|||||||
<<<<<<< HEAD
|
|
||||||
library
|
library
|
||||||
node_modules
|
node_modules
|
||||||
out
|
out
|
||||||
./*.log
|
./*.log
|
||||||
./*.str
|
./*.str
|
||||||
dist
|
dist
|
||||||
=======
|
|
||||||
out
|
|
||||||
dist
|
|
||||||
node_modules
|
|
||||||
>>>>>>> 199b7a8af3ea01baea4b20c89273a490dc0dc9d2
|
|
||||||
script/__pycache__
|
script/__pycache__
|
||||||
.vscode-test/
|
.vscode-test/
|
||||||
*.vsix
|
*.vsix
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
"welcome.title": "Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊",
|
"welcome.title": "Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊",
|
||||||
"welcome.star": "Star",
|
"welcome.star": "Star",
|
||||||
"welcome.refuse": "Refuse",
|
"welcome.refuse": "Refuse",
|
||||||
"progress.register-command": "(Digital IDE) Register Command",
|
"progress.register-command": "Register Command",
|
||||||
"progress.initialization": "(Digital IDE) Initialization",
|
"progress.active-lsp-server": "Activate LSP Server",
|
||||||
"progress.build-module-tree": "build module tree",
|
"progress.initialization": "Initialization",
|
||||||
|
"progress.build-module-tree": "Build Module Tree",
|
||||||
|
"progress.download-digital-lsp": "Download Digital LSP",
|
||||||
"fail.save-file": "fail to save file",
|
"fail.save-file": "fail to save file",
|
||||||
"click.join-qq-group": "Click the link to join the QQ group"
|
"click.join-qq-group": "Click the link to join the QQ group"
|
||||||
}
|
}
|
@ -4,8 +4,10 @@
|
|||||||
"welcome.star": "支持",
|
"welcome.star": "支持",
|
||||||
"welcome.refuse": "拒绝",
|
"welcome.refuse": "拒绝",
|
||||||
"progress.register-command": "(Digital IDE) 注册命令",
|
"progress.register-command": "(Digital IDE) 注册命令",
|
||||||
|
"progress.active-lsp-server": "Activate LSP Server",
|
||||||
"progress.initialization": "(Digital IDE) 初始化",
|
"progress.initialization": "(Digital IDE) 初始化",
|
||||||
"progress.build-module-tree": "构建模块树",
|
"progress.build-module-tree": "构建模块树",
|
||||||
|
"progress.download-digital-lsp": "Download Digital LSP",
|
||||||
"fail.save-file": "保存文件失败",
|
"fail.save-file": "保存文件失败",
|
||||||
"click.join-qq-group": "点击链接加入QQ群一起讨论"
|
"click.join-qq-group": "点击链接加入QQ群一起讨论"
|
||||||
}
|
}
|
@ -4,8 +4,10 @@
|
|||||||
"welcome.star": "支持",
|
"welcome.star": "支持",
|
||||||
"welcome.refuse": "拒絕",
|
"welcome.refuse": "拒絕",
|
||||||
"progress.register-command": "(Digital IDE) 註冊命令",
|
"progress.register-command": "(Digital IDE) 註冊命令",
|
||||||
|
"progress.active-lsp-server": "Activate LSP Server",
|
||||||
"progress.initialization": "(Digital IDE) 初始化",
|
"progress.initialization": "(Digital IDE) 初始化",
|
||||||
"progress.build-module-tree": "構建模塊樹",
|
"progress.build-module-tree": "構建模塊樹",
|
||||||
|
"progress.download-digital-lsp": "Download Digital LSP",
|
||||||
"fail.save-file": "保存文件失敗",
|
"fail.save-file": "保存文件失敗",
|
||||||
"click.join-qq-group": "点击链接加入QQ群一起讨论"
|
"click.join-qq-group": "点击链接加入QQ群一起讨论"
|
||||||
}
|
}
|
723
package-lock.json
generated
723
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -296,7 +296,9 @@
|
|||||||
},
|
},
|
||||||
"fpga-support.onTypeFormattingTriggerCharacters": {
|
"fpga-support.onTypeFormattingTriggerCharacters": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"default": ["\n"],
|
"default": [
|
||||||
|
"\n"
|
||||||
|
],
|
||||||
"description": "Trigger characters for onTypeFormatting"
|
"description": "Trigger characters for onTypeFormatting"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1183,14 +1185,17 @@
|
|||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios": "^1.7.7",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"puppeteer-core": "^19.4.1",
|
"puppeteer-core": "^19.4.1",
|
||||||
"showdown": "^2.1.0",
|
"showdown": "^2.1.0",
|
||||||
"state-machine-cat": "^9.2.5",
|
"state-machine-cat": "^9.2.5",
|
||||||
|
"tar": "^7.4.3",
|
||||||
"temp": "^0.9.4",
|
"temp": "^0.9.4",
|
||||||
"vscode-jsonrpc": "^8.2.1",
|
"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",
|
||||||
|
"zlib": "^1.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { opeParam, MainOutput, AbsPath, ReportType, LspClient, IProgress } from './global';
|
import { opeParam, MainOutput, AbsPath, ReportType, LspClient, IProgress } from './global';
|
||||||
import { hdlParam } from './hdlParser';
|
import { hdlParam } from './hdlParser';
|
||||||
@ -19,21 +20,39 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
|||||||
func.registerFSM(context);
|
func.registerFSM(context);
|
||||||
func.registerNetlist(context);
|
func.registerNetlist(context);
|
||||||
func.registerWaveViewer(context);
|
func.registerWaveViewer(context);
|
||||||
|
}
|
||||||
|
|
||||||
lspClient.activate(context);
|
function getVersion(context: vscode.ExtensionContext): string {
|
||||||
await LspClient.DigitalIDE?.onReady();
|
let extensionPath = context.extensionPath;
|
||||||
|
let packagePath = extensionPath + '/package.json';
|
||||||
|
if (!fs.existsSync(packagePath)) {
|
||||||
|
return '0.4.0';
|
||||||
|
}
|
||||||
|
let packageMeta = fs.readFileSync(packagePath, { encoding: 'utf-8' });
|
||||||
|
let packageJson = JSON.parse(packageMeta);
|
||||||
|
return packageJson.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function launch(context: vscode.ExtensionContext) {
|
async function launch(context: vscode.ExtensionContext) {
|
||||||
const { t } = vscode.l10n;
|
const { t } = vscode.l10n;
|
||||||
console.log(t('welcome.title'));
|
console.log(t('welcome.title'));
|
||||||
console.log(t('click.join-qq-group') + ' https://qm.qq.com/q/1M655h3GsA');
|
console.log(t('click.join-qq-group') + ' https://qm.qq.com/q/1M655h3GsA');
|
||||||
|
const versionString = getVersion(context);
|
||||||
|
|
||||||
await vscode.window.withProgress({
|
await vscode.window.withProgress({
|
||||||
location: vscode.ProgressLocation.Window,
|
location: vscode.ProgressLocation.Window,
|
||||||
title: t('progress.register-command')
|
title: t('progress.register-command')
|
||||||
}, async () => {
|
}, async () => {
|
||||||
await registerCommand(context);
|
await registerCommand(context);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
await vscode.window.withProgress({
|
||||||
|
location: vscode.ProgressLocation.Window,
|
||||||
|
title: t('progress.active-lsp-server')
|
||||||
|
}, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
|
||||||
|
await lspClient.activate(context, progress, versionString);
|
||||||
|
await LspClient.DigitalIDE?.onReady();
|
||||||
});
|
});
|
||||||
|
|
||||||
await vscode.window.withProgress({
|
await vscode.window.withProgress({
|
||||||
@ -53,7 +72,7 @@ async function launch(context: vscode.ExtensionContext) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
MainOutput.report('Digital-IDE has launched, Version: 0.4.0', ReportType.Launch);
|
MainOutput.report('Digital-IDE has launched, Version: ' + versionString, ReportType.Launch);
|
||||||
MainOutput.report('OS: ' + opeParam.os, ReportType.Launch);
|
MainOutput.report('OS: ' + opeParam.os, ReportType.Launch);
|
||||||
|
|
||||||
console.log(hdlParam);
|
console.log(hdlParam);
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
enum IPlatformSignature {
|
enum IPlatformSignature {
|
||||||
x86Windows,
|
x86Windows = 'windows_amd64',
|
||||||
aach64Windows,
|
aach64Windows = 'windows_aarch64',
|
||||||
x86Darwin,
|
x86Darwin = 'darwin_amd64',
|
||||||
aarch64Darwin,
|
aarch64Darwin = 'darwin_aarch64',
|
||||||
x86Linux,
|
x86Linux = 'linux_amd64',
|
||||||
aarch64Linux,
|
aarch64Linux = 'linux_aarch64',
|
||||||
unsupport
|
unsupport = 'unsupport'
|
||||||
};
|
};
|
||||||
|
|
||||||
function getPlatformPlatformSignature(): IPlatformSignature {
|
export function getPlatformPlatformSignature(): IPlatformSignature {
|
||||||
// Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`
|
// Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`
|
||||||
const arch = os.arch();
|
const arch = os.arch();
|
||||||
|
|
||||||
@ -40,3 +41,13 @@ function getPlatformPlatformSignature(): IPlatformSignature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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`;
|
||||||
|
}
|
||||||
|
|
||||||
|
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`;
|
||||||
|
}
|
@ -9,7 +9,10 @@ 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';
|
import { IProgress, LspClient } from '../../global';
|
||||||
|
import axios from "axios";
|
||||||
|
import { getGiteeDownloadLink, getPlatformPlatformSignature } from "./cdn";
|
||||||
|
|
||||||
|
|
||||||
function getLspServerExecutionName() {
|
function getLspServerExecutionName() {
|
||||||
const osname = platform();
|
const osname = platform();
|
||||||
@ -20,8 +23,36 @@ function getLspServerExecutionName() {
|
|||||||
return 'digital-lsp';
|
return 'digital-lsp';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkAndDownload(context: vscode.ExtensionContext, progress: vscode.Progress<IProgress>, version: string): boolean {
|
||||||
|
const { t } = vscode.l10n;
|
||||||
|
|
||||||
|
const versionFolderPath = context.asAbsolutePath(
|
||||||
|
path.join('resources', 'dide-lsp', 'server', version)
|
||||||
|
);
|
||||||
|
|
||||||
|
const serverPath = path.join(versionFolderPath, getLspServerExecutionName());
|
||||||
|
if (fs.existsSync(versionFolderPath) && fs.existsSync(serverPath)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 流式下载
|
||||||
|
progress.report({ message: t('progress.download-digital-lsp') });
|
||||||
|
const signature = getPlatformPlatformSignature().toString();
|
||||||
|
const giteeDownloadLink = getGiteeDownloadLink(signature, version)
|
||||||
|
console.log('download link ', giteeDownloadLink);
|
||||||
|
|
||||||
|
const response = await axios.get(giteeDownloadLink, { responseType: 'stream' });
|
||||||
|
const totalLength = response.headers['content-length'];
|
||||||
|
console.log('totalLength ', totalLength);
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function activate(context: vscode.ExtensionContext, progress: vscode.Progress<IProgress>, version: string) {
|
||||||
|
await checkAndDownload(context, progress, version);
|
||||||
|
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
|
||||||
const lspServerName = getLspServerExecutionName();
|
const lspServerName = getLspServerExecutionName();
|
||||||
const lspServerPath = context.asAbsolutePath(
|
const lspServerPath = context.asAbsolutePath(
|
||||||
path.join('resources', 'dide-lsp', 'server', lspServerName)
|
path.join('resources', 'dide-lsp', 'server', lspServerName)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user