support i18n
This commit is contained in:
parent
306c57f07e
commit
dd37321295
1
images/svg/dark/export.svg
Normal file
1
images/svg/dark/export.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727096948217" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4248" data-darkreader-inline-fill="" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M448.059944 209.339744V640.359663h127.880112V209.339744l96.229785 112.278739 96.613425-96.613425L575.940056 0 574.917015 0.959101H449.082985L448.059944 0l-192.84321 225.068998 96.613425 96.613425L448.059944 209.339744zM831.700281 384.599438v383.640337H192.299719V384.599438H64.419607v447.580393a63.940056 63.940056 0 0 0 63.940056 63.940057h767.280674a63.940056 63.940056 0 0 0 63.940056-63.940057V384.599438h-127.880112z" p-id="4249" fill="#ffffff"></path></svg>
|
After Width: | Height: | Size: 827 B |
1
images/svg/light/export.svg
Normal file
1
images/svg/light/export.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727096948217" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4248" data-darkreader-inline-fill="" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M448.059944 209.339744V640.359663h127.880112V209.339744l96.229785 112.278739 96.613425-96.613425L575.940056 0 574.917015 0.959101H449.082985L448.059944 0l-192.84321 225.068998 96.613425 96.613425L448.059944 209.339744zM831.700281 384.599438v383.640337H192.299719V384.599438H64.419607v447.580393a63.940056 63.940056 0 0 0 63.940056 63.940057h767.280674a63.940056 63.940056 0 0 0 63.940056-63.940057V384.599438h-127.880112z" p-id="4249" fill="#2c2c2c"></path></svg>
|
After Width: | Height: | Size: 827 B |
9
l10n/bundle.l10n.en.json
Normal file
9
l10n/bundle.l10n.en.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"hello": "hello in English",
|
||||
"welcome.title": "Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊",
|
||||
"welcome.star": "Star",
|
||||
"welcome.refuse": "Refuse",
|
||||
"progress.register-command": "(Digital IDE) Register Command",
|
||||
"progress.initialization": "(Digital IDE) Initialization",
|
||||
"progress.build-module-tree": "build module tree"
|
||||
}
|
9
l10n/bundle.l10n.zh-cn.json
Normal file
9
l10n/bundle.l10n.zh-cn.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"hello": "hello in English",
|
||||
"welcome.title": "Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊",
|
||||
"welcome.star": "Star",
|
||||
"welcome.refuse": "Refuse",
|
||||
"progress.register-command": "(Digital IDE) Register Command",
|
||||
"progress.initialization": "(Digital IDE) Initialization",
|
||||
"progress.build-module-tree": "build module tree"
|
||||
}
|
9
l10n/bundle.l10n.zh-tw.json
Normal file
9
l10n/bundle.l10n.zh-tw.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"hello": "hello in English",
|
||||
"welcome.title": "Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊",
|
||||
"welcome.star": "Star",
|
||||
"welcome.refuse": "Refuse",
|
||||
"progress.register-command": "(Digital IDE) Register Command",
|
||||
"progress.initialization": "(Digital IDE) Initialization",
|
||||
"progress.build-module-tree": "build module tree"
|
||||
}
|
25
package.json
25
package.json
@ -4,8 +4,9 @@
|
||||
"description": "all in one vscode plugin for Verilog/VHDL development",
|
||||
"publisher": "sterben",
|
||||
"homepage": "https://digital-eda.github.io/DIDE-doc-Cn",
|
||||
"version": "0.3.3",
|
||||
"version": "0.4.0",
|
||||
"main": "./out/extension",
|
||||
"l10n": "./l10n",
|
||||
"icon": "images/icon.png",
|
||||
"engines": {
|
||||
"vscode": "^1.72.0"
|
||||
@ -344,6 +345,15 @@
|
||||
"dark": "images/svg/dark/debug.svg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "digital-ide.tool.export-filelist",
|
||||
"title": "%digital-ide.tool.export-filelist.title%",
|
||||
"category": "Digital-IDE",
|
||||
"icon": {
|
||||
"light": "images/svg/light/export.svg",
|
||||
"dark": "images/svg/dark/export.svg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "digital-ide.pickLibrary",
|
||||
"title": "%digital-ide.pickLibrary.title%",
|
||||
@ -616,7 +626,18 @@
|
||||
{
|
||||
"command": "digital-ide.tool.icarus.simulateFile",
|
||||
"group": "navigation@3",
|
||||
"when": "view == digital-ide-treeView-arch && viewItem == file"
|
||||
"when": "view == digital-ide-treeView-arch && viewItem == file",
|
||||
"args": {
|
||||
"file": "${viewItem}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "digital-ide.tool.export-filelist",
|
||||
"group": "navigation@4",
|
||||
"when": "view == digital-ide-treeView-arch && viewItem == file",
|
||||
"args": {
|
||||
"file": "${viewItem}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"editor/title": [
|
||||
|
@ -45,5 +45,6 @@
|
||||
"digital-ide.lsp.vlog.linter.pick.title": "select a diagnostic for verilog",
|
||||
"digital-ide.lsp.svlog.linter.pick.title": "select a diagnostic for systemverilog verilog",
|
||||
"digital-ide.lsp.vhdl.linter.pick.title": "select a diagnostic for vhdl",
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "select a diagnostic for systemverilog"
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "select a diagnostic for systemverilog",
|
||||
"digital-ide.tool.export-filelist.title": "export filelist"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"digital-ide.lsp.vlog.linter.pick.title": "选择 Verilog 的诊断",
|
||||
"digital-ide.lsp.svlog.linter.pick.title": "选择 System Verilog 的诊断",
|
||||
"digital-ide.lsp.vhdl.linter.pick.title": "选择 VHDL 的诊断",
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "选择 SystemVerilog 的诊断"
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "选择 SystemVerilog 的诊断",
|
||||
"digital-ide.tool.export-filelist.title": "导出 filelist"
|
||||
}
|
@ -45,5 +45,6 @@
|
||||
"digital-ide.lsp.vlog.linter.pick.title": "選擇 Verilog 的診斷",
|
||||
"digital-ide.lsp.svlog.linter.pick.title": "選擇 System Verilog 的診斷",
|
||||
"digital-ide.lsp.vhdl.linter.pick.title": "選擇 VHDL 的診斷",
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "選擇 SystemVerilog 的診斷"
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "選擇 SystemVerilog 的診斷",
|
||||
"digital-ide.tool.export-filelist.title": "導出 filelist"
|
||||
}
|
@ -26,16 +26,18 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
async function launch(context: vscode.ExtensionContext) {
|
||||
const { t } = vscode.l10n;
|
||||
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: 'Register Command (Digtial-IDE)'
|
||||
title: t('progress.register-command')
|
||||
}, async () => {
|
||||
await registerCommand(context);
|
||||
});
|
||||
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: 'Initialization (Digtial-IDE)'
|
||||
title: t('progress.initialization')
|
||||
}, async (progress: vscode.Progress<IProgress>, token: vscode.CancellationToken) => {
|
||||
// 初始化解析
|
||||
await manager.prjManage.initialise(context, progress);
|
||||
@ -50,8 +52,7 @@ async function launch(context: vscode.ExtensionContext) {
|
||||
});
|
||||
|
||||
|
||||
|
||||
MainOutput.report('Digital-IDE has launched, Version: 0.3.3', ReportType.Launch);
|
||||
MainOutput.report('Digital-IDE has launched, Version: 0.4.0', ReportType.Launch);
|
||||
MainOutput.report('OS: ' + opeParam.os, ReportType.Launch);
|
||||
|
||||
console.log(hdlParam);
|
||||
@ -64,9 +65,9 @@ async function launch(context: vscode.ExtensionContext) {
|
||||
// don't show in next time
|
||||
welcomeSetting.update('show', false, vscode.ConfigurationTarget.Global);
|
||||
const res = await vscode.window.showInformationMessage(
|
||||
'Thanks for using Digital-IDE ❤️. Your star will be our best motivation! 😊',
|
||||
{ title: 'Star', value: true },
|
||||
{ title: 'Refuse', value: false },
|
||||
t('welcome.title'),
|
||||
{ title: t('welcome.star'), value: true },
|
||||
{ title: t('welcome.refuse'), value: false },
|
||||
);
|
||||
if (res?.value) {
|
||||
vscode.env.openExternal(vscode.Uri.parse(extensionUrl));
|
||||
|
@ -110,6 +110,9 @@ function registerLsp(context: vscode.ExtensionContext) {
|
||||
function registerToolCommands(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand('digital-ide.lsp.tool.insertTextToUri', tool.insertTextToUri);
|
||||
vscode.commands.registerCommand('digital-ide.lsp.tool.transformOldPropertyFile', tool.transformOldPpy);
|
||||
vscode.commands.registerCommand('digital-ide.tool.export-filelist', (view: ModuleDataItem) => {
|
||||
tool.exportFilelist(view);
|
||||
});
|
||||
}
|
||||
|
||||
function registerFSM(context: vscode.ExtensionContext) {
|
||||
|
@ -1,9 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
import * as fspath from 'path';
|
||||
|
||||
import { opeParam } from '../global';
|
||||
import { hdlFile } from '../hdlFs';
|
||||
import { hdlFile, hdlPath } from '../hdlFs';
|
||||
import { ModuleDataItem } from './treeView/tree';
|
||||
import { hdlParam } from '../hdlParser';
|
||||
|
||||
async function insertTextToUri(uri: vscode.Uri, text: string, position?: vscode.Position) {
|
||||
if (!position) {
|
||||
@ -70,8 +73,47 @@ async function transformOldPpy() {
|
||||
}
|
||||
}
|
||||
|
||||
async function askUserToSaveFilelist(filelist: string[]) {
|
||||
const topModulePath = filelist[0];
|
||||
const defaultSaveName = fspath.basename(topModulePath, fspath.extname(topModulePath));
|
||||
const defaultSavePath = hdlPath.join(opeParam.workspacePath, defaultSaveName + '.f');
|
||||
|
||||
const uri = await vscode.window.showSaveDialog({
|
||||
filters: {
|
||||
'All Files': ['*']
|
||||
},
|
||||
saveLabel: 'save',
|
||||
defaultUri: vscode.Uri.file(defaultSavePath)
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 导出当前 module 的 filelist
|
||||
* @param view treeview 中的模块对象
|
||||
*/
|
||||
function exportFilelist(view: ModuleDataItem) {
|
||||
const fileset = new Set<string>();
|
||||
if (view.path !== undefined) {
|
||||
const deps = hdlParam.getAllDependences(view.path, view.name);
|
||||
if (deps) {
|
||||
deps.others.forEach(path => fileset.add(path));
|
||||
deps.include.forEach(path => fileset.add(path));
|
||||
const filelist = [view.path];
|
||||
filelist.push(...fileset);
|
||||
|
||||
} else {
|
||||
vscode.window.showErrorMessage('fail to get deps of view ' + view.name);
|
||||
}
|
||||
} else {
|
||||
vscode.window.showErrorMessage('cannot find path for current module');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export {
|
||||
insertTextToUri,
|
||||
transformOldPpy
|
||||
transformOldPpy,
|
||||
exportFilelist
|
||||
};
|
@ -7,7 +7,7 @@ import { MainOutput, ReportType } from '../global/outputChannel';
|
||||
import * as common from './common';
|
||||
import { hdlFile, hdlPath } from '../hdlFs';
|
||||
import { HdlSymbol } from './util';
|
||||
import { vhdlFast } from '../../resources/hdlParser';
|
||||
import { Fast, vhdlFast } from '../../resources/hdlParser';
|
||||
|
||||
class HdlParam {
|
||||
private readonly topModules : Set<HdlModule> = new Set<HdlModule>();
|
||||
@ -242,13 +242,13 @@ class HdlParam {
|
||||
}
|
||||
|
||||
public async initHdlFiles(hdlFiles: AbsPath[], progress?: vscode.Progress<IProgress>) {
|
||||
const { t } = vscode.l10n;
|
||||
let count: number = 0;
|
||||
let fileNum = hdlFiles.length;
|
||||
const parallelChunk = 5;
|
||||
|
||||
const pools: { id: number, promise: Promise<void> }[] = [];
|
||||
|
||||
vscode.window.showInformationMessage("files to handle: " + fileNum);
|
||||
const reportTitle = t('progress.build-module-tree');
|
||||
|
||||
async function consumePools() {
|
||||
for (const p of pools) {
|
||||
@ -256,7 +256,7 @@ class HdlParam {
|
||||
await p.promise;
|
||||
console.log("handle id " + p.id + ' increment: ' + increment);
|
||||
|
||||
progress?.report({ message: `build module tree ${p.id}/${fileNum}`, increment });
|
||||
progress?.report({ message: reportTitle + ` ${p.id}/${fileNum}`, increment });
|
||||
}
|
||||
pools.length = 0;
|
||||
}
|
||||
@ -347,6 +347,42 @@ class HdlParam {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public updateFast(path: string, fast: Fast) {
|
||||
const moduleFile = this.getHdlFile(path);
|
||||
if (moduleFile === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. update marco directly
|
||||
moduleFile.updateMacro(fast.macro);
|
||||
|
||||
// 2. update modules one by one
|
||||
const uncheckedModuleNames = new Set<string>();
|
||||
for (const name of moduleFile.getAllModuleNames()) {
|
||||
uncheckedModuleNames.add(name);
|
||||
}
|
||||
|
||||
for (const rawHdlModule of fast.content) {
|
||||
const moduleName = rawHdlModule.name;
|
||||
if (uncheckedModuleNames.has(moduleName)) {
|
||||
// match the same module, check then
|
||||
const originalModule = moduleFile.getHdlModule(moduleName);
|
||||
uncheckedModuleNames.delete(moduleName);
|
||||
originalModule?.update(rawHdlModule);
|
||||
} else {
|
||||
// no matched, create it
|
||||
const newModule = moduleFile.createHdlModule(rawHdlModule);
|
||||
newModule.makeNameToInstances();
|
||||
newModule.solveUnhandleInstance();
|
||||
}
|
||||
}
|
||||
|
||||
// 3. delete module not visited yet
|
||||
for (const moduleName of uncheckedModuleNames) {
|
||||
moduleFile.deleteHdlModule(moduleName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const hdlParam = new HdlParam();
|
||||
|
@ -11,7 +11,6 @@ async function doFastApi(path: string): Promise<Fast | undefined> {
|
||||
const client = LspClient.MainClient;
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
if (client) {
|
||||
console.log(client.initializeResult);
|
||||
const response = await client.sendRequest(DoFastRequestType, { path });
|
||||
response.languageId = langID;
|
||||
return response;
|
||||
|
@ -2,7 +2,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { AbsPath, IProgress, MainOutput, opeParam, ReportType } from '../global';
|
||||
import { AbsPath, IProgress, LspClient, MainOutput, opeParam, ReportType } from '../global';
|
||||
import { PathSet } from '../global/util';
|
||||
import { RawPrjInfo } from '../global/prjInfo';
|
||||
import { hdlDir, hdlFile, hdlPath } from '../hdlFs';
|
||||
@ -13,6 +13,9 @@ import { PsManage } from './PS';
|
||||
import { hdlIgnore } from './ignore';
|
||||
import { ppyAction } from '../monitor/event';
|
||||
import { hdlMonitor } from '../monitor';
|
||||
import { NotificationType } from 'vscode-jsonrpc';
|
||||
import { refreshArchTree } from '../function/treeView';
|
||||
import { Fast } from '../../resources/hdlParser';
|
||||
|
||||
interface RefreshPrjConfig {
|
||||
mkdir: boolean
|
||||
@ -151,6 +154,28 @@ class PrjManage {
|
||||
const unhandleNum = hdlParam.getUnhandleInstanceNumber();
|
||||
MainOutput.report(`finish analyse ${hdlFiles.length} hdl files, find ${unhandleNum} unsolved instances`, ReportType.Info);
|
||||
|
||||
// 完成后端向前端发送消息的注册
|
||||
const mainClient = LspClient.MainClient;
|
||||
if (mainClient !== undefined) {
|
||||
await mainClient.onReady();
|
||||
mainClient.onNotification('update/fast', async (params: any) => {
|
||||
try {
|
||||
const fast = params.fast as Fast;
|
||||
const path = params.path as string;
|
||||
console.log("[receive notification] path: " + path);
|
||||
hdlParam.updateFast(path, fast);
|
||||
refreshArchTree();
|
||||
} catch (error) {
|
||||
console.error("error happen when update fast: " + error);
|
||||
}
|
||||
});
|
||||
|
||||
// mainClient.onNotification('update/string', async (params: any) => {
|
||||
// console.log('[StringNotificationType] receive from backend');
|
||||
// console.log(params);
|
||||
// });
|
||||
}
|
||||
|
||||
this.pl = new PlManage();
|
||||
|
||||
// TODO : finish it later
|
||||
|
@ -119,12 +119,15 @@ class HdlAction extends BaseAction {
|
||||
async change(path: string, m: HdlMonitor): Promise<void> {
|
||||
console.log('HdlAction change');
|
||||
path = hdlPath.toSlash(path);
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
|
||||
// TODO : check performance
|
||||
await this.updateSymbolStorage(path);
|
||||
if (langID === HdlLangID.Vhdl) {
|
||||
await this.updateSymbolStorage(path);
|
||||
await this.updateHdlParam(path);
|
||||
}
|
||||
await this.updateLinter(path);
|
||||
|
||||
await this.updateHdlParam(path);
|
||||
refreshArchTree();
|
||||
}
|
||||
|
||||
@ -183,8 +186,6 @@ class HdlAction extends BaseAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 3. delete module not visited yet
|
||||
for (const moduleName of uncheckedModuleNames) {
|
||||
moduleFile.deleteHdlModule(moduleName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user