完成增加/删除 device 的更新 & 完成复写配置文件功能
This commit is contained in:
parent
25a52bc547
commit
2796de88f5
2
.gitignore
vendored
2
.gitignore
vendored
@ -19,3 +19,5 @@ resources/dide-lsp/server/*
|
|||||||
resources/dide-lsp/static/*
|
resources/dide-lsp/static/*
|
||||||
resources/dide-netlist/static/*
|
resources/dide-netlist/static/*
|
||||||
resources/dide-netlist/view/*
|
resources/dide-netlist/view/*
|
||||||
|
scripts/update-icon.py
|
||||||
|
scripts/vscode-package.py
|
@ -111,5 +111,11 @@
|
|||||||
"toolbar.save-as-pdf": "Aktuelle Ansicht als PDF speichern",
|
"toolbar.save-as-pdf": "Aktuelle Ansicht als PDF speichern",
|
||||||
"pdf-file": "PDF-Datei",
|
"pdf-file": "PDF-Datei",
|
||||||
"export-pdf": "PDF wird exportiert",
|
"export-pdf": "PDF wird exportiert",
|
||||||
"info.process-killed": "Prozess {0} wurde zerstört"
|
"info.process-killed": "Prozess {0} wurde zerstört",
|
||||||
|
"info.addDevice.placeholder": "Bitte geben Sie den Namen des Geräts ein",
|
||||||
|
"warning.addDevice.name-taken": "Der Name des Geräts {0} ist bereits vergeben",
|
||||||
|
"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"
|
||||||
}
|
}
|
@ -111,5 +111,11 @@
|
|||||||
"toolbar.save-as-pdf": "Save current view as PDF",
|
"toolbar.save-as-pdf": "Save current view as PDF",
|
||||||
"pdf-file": "PDF file",
|
"pdf-file": "PDF file",
|
||||||
"export-pdf": "Exporting PDF",
|
"export-pdf": "Exporting PDF",
|
||||||
"info.process-killed": "Process {0} has been destroyed"
|
"info.process-killed": "Process {0} has been destroyed",
|
||||||
|
"info.addDevice.placeholder": "Please enter the name of the device",
|
||||||
|
"warning.addDevice.name-taken": "The name of device {0} is already taken",
|
||||||
|
"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"
|
||||||
}
|
}
|
@ -111,5 +111,11 @@
|
|||||||
"toolbar.save-as-pdf": "現在のビューをPDFとして保存",
|
"toolbar.save-as-pdf": "現在のビューをPDFとして保存",
|
||||||
"pdf-file": "PDFファイル",
|
"pdf-file": "PDFファイル",
|
||||||
"export-pdf": "PDFをエクスポート中",
|
"export-pdf": "PDFをエクスポート中",
|
||||||
"info.process-killed": "プロセス {0} は破棄されました"
|
"info.process-killed": "プロセス {0} は破棄されました",
|
||||||
|
"info.addDevice.placeholder": "デバイスの名前を入力してください",
|
||||||
|
"warning.addDevice.name-taken": "デバイス {0} の名前は既に使用されています",
|
||||||
|
"info.addDevice.add-success": "デバイス {0} が正常に追加されました",
|
||||||
|
"info.delDevice.placeholder": "削除するデバイスを選択してください",
|
||||||
|
"info.delDevice.del-success": "デバイス {0} は正常に削除されました",
|
||||||
|
"info.progress.launch-lsp": "Digital LSP 言語サーバーを起動する"
|
||||||
}
|
}
|
@ -111,5 +111,11 @@
|
|||||||
"toolbar.save-as-pdf": "将当前视图保存为 pdf",
|
"toolbar.save-as-pdf": "将当前视图保存为 pdf",
|
||||||
"pdf-file": "pdf 文件",
|
"pdf-file": "pdf 文件",
|
||||||
"export-pdf": "正在导出 pdf",
|
"export-pdf": "正在导出 pdf",
|
||||||
"info.process-killed": "进程 {0} 已经被销毁"
|
"info.process-killed": "进程 {0} 已经被销毁",
|
||||||
|
"info.addDevice.placeholder": "请输入 device 的名字",
|
||||||
|
"warning.addDevice.name-taken": "device {0} 的名字已经被占用",
|
||||||
|
"info.addDevice.add-success": "device {0} 已被成功添加",
|
||||||
|
"info.delDevice.placeholder": "选择需要删除的 device",
|
||||||
|
"info.delDevice.del-success": "device {0} 已被成功删除",
|
||||||
|
"info.progress.launch-lsp": "启动 Digital LSP 语言服务器"
|
||||||
}
|
}
|
@ -111,5 +111,11 @@
|
|||||||
"toolbar.save-as-pdf": "將目前視圖儲存為PDF",
|
"toolbar.save-as-pdf": "將目前視圖儲存為PDF",
|
||||||
"pdf-file": "PDF檔案",
|
"pdf-file": "PDF檔案",
|
||||||
"export-pdf": "正在匯出PDF",
|
"export-pdf": "正在匯出PDF",
|
||||||
"info.process-killed": "進程 {0} 已經被銷毀"
|
"info.process-killed": "進程 {0} 已經被銷毀",
|
||||||
|
"info.addDevice.placeholder": "請輸入設備的名稱",
|
||||||
|
"warning.addDevice.name-taken": "設備 {0} 的名字已經被佔用",
|
||||||
|
"info.addDevice.add-success": "設備 {0} 已成功添加",
|
||||||
|
"info.delDevice.placeholder": "選擇需要刪除的設備",
|
||||||
|
"info.delDevice.del-success": "設備 {0} 已被成功刪除",
|
||||||
|
"info.progress.launch-lsp": "啟動 Digital LSP 語言伺服器"
|
||||||
}
|
}
|
50
package.json
50
package.json
@ -420,130 +420,130 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.expand",
|
"command": "digital-ide.treeView.arch.expand",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"icon": "$(expand-all)",
|
"icon": "$(expand-all)",
|
||||||
"title": "%digital-ide.treeView.arch.expand.title%"
|
"title": "%digital-ide.treeView.arch.expand.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.collapse",
|
"command": "digital-ide.treeView.arch.collapse",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"icon": "$(collapse-all)",
|
"icon": "$(collapse-all)",
|
||||||
"title": "%digital-ide.treeView.arch.collapse.title%"
|
"title": "%digital-ide.treeView.arch.collapse.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.refresh",
|
"command": "digital-ide.treeView.arch.refresh",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"icon": "$(refresh)",
|
"icon": "$(refresh)",
|
||||||
"title": "%digital-ide.treeView.arch.refresh.title%"
|
"title": "%digital-ide.treeView.arch.refresh.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.treeView.arch.openFile",
|
"command": "digital-ide.treeView.arch.openFile",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.treeView.arch.openFile.title%"
|
"title": "%digital-ide.treeView.arch.openFile.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.soft.launch",
|
"command": "digital-ide.soft.launch",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.soft.launch.title%"
|
"title": "%digital-ide.soft.launch.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.soft.build",
|
"command": "digital-ide.soft.build",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.soft.build.title%"
|
"title": "%digital-ide.soft.build.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.soft.download",
|
"command": "digital-ide.soft.download",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.soft.download.title%"
|
"title": "%digital-ide.soft.download.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.launch",
|
"command": "digital-ide.hard.launch",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.launch.title%"
|
"title": "%digital-ide.hard.launch.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.simulate",
|
"command": "digital-ide.hard.simulate",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.simulate.title%"
|
"title": "%digital-ide.hard.simulate.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.simulate.cli",
|
"command": "digital-ide.hard.simulate.cli",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.simulate.cli.title%"
|
"title": "%digital-ide.hard.simulate.cli.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.simulate.gui",
|
"command": "digital-ide.hard.simulate.gui",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.simulate.gui.title%"
|
"title": "%digital-ide.hard.simulate.gui.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.refresh",
|
"command": "digital-ide.hard.refresh",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.refresh.title%"
|
"title": "%digital-ide.hard.refresh.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.build",
|
"command": "digital-ide.hard.build",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.build.title%"
|
"title": "%digital-ide.hard.build.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.build.synth",
|
"command": "digital-ide.hard.build.synth",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.build.synth.title%"
|
"title": "%digital-ide.hard.build.synth.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.build.impl",
|
"command": "digital-ide.hard.build.impl",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.build.impl.title%"
|
"title": "%digital-ide.hard.build.impl.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.build.bitstream",
|
"command": "digital-ide.hard.build.bitstream",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.build.bitstream.title%"
|
"title": "%digital-ide.hard.build.bitstream.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.program",
|
"command": "digital-ide.hard.program",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.program.title%"
|
"title": "%digital-ide.hard.program.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.gui",
|
"command": "digital-ide.hard.gui",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.gui.title%"
|
"title": "%digital-ide.hard.gui.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.hard.exit",
|
"command": "digital-ide.hard.exit",
|
||||||
"category": "tool",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.hard.exit.title%"
|
"title": "%digital-ide.hard.exit.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pl.setSrcTop",
|
"command": "digital-ide.pl.setSrcTop",
|
||||||
"category": "pl",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.pl.setSrcTop.title%"
|
"title": "%digital-ide.pl.setSrcTop.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pl.setSimTop",
|
"command": "digital-ide.pl.setSimTop",
|
||||||
"category": "pl",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.pl.setSimTop.title%"
|
"title": "%digital-ide.pl.setSimTop.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pl.addDevice",
|
"command": "digital-ide.pl.addDevice",
|
||||||
"category": "pl",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.pl.addDevice.title%"
|
"title": "%digital-ide.pl.addDevice.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pl.delDevice",
|
"command": "digital-ide.pl.delDevice",
|
||||||
"category": "pl",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.pl.delDevice.title%"
|
"title": "%digital-ide.pl.delDevice.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pl.addFile",
|
"command": "digital-ide.pl.addFile",
|
||||||
"category": "pl",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.pl.addFile.title%"
|
"title": "%digital-ide.pl.addFile.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.pl.delFile",
|
"command": "digital-ide.pl.delFile",
|
||||||
"category": "pl",
|
"category": "Digital-IDE",
|
||||||
"title": "%digital-ide.pl.delFile.title%"
|
"title": "%digital-ide.pl.delFile.title%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"description": "The tool chain you need",
|
"description": "The tool chain you need",
|
||||||
"enum": [
|
"enum": [
|
||||||
"xilinx",
|
"xilinx",
|
||||||
"efinity"
|
"efinity"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"prjName": {
|
"prjName": {
|
||||||
@ -198,7 +198,8 @@
|
|||||||
"xc7a35tftg256-1",
|
"xc7a35tftg256-1",
|
||||||
"xc7a35tcsg324-1",
|
"xc7a35tcsg324-1",
|
||||||
"xc7z035ffg676-2",
|
"xc7z035ffg676-2",
|
||||||
"xc7z020clg484-1"
|
"xc7z020clg484-1",
|
||||||
|
"hello-world"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -32,6 +32,11 @@ async function registerCommand(context: vscode.ExtensionContext, packageJson: an
|
|||||||
manager.prjManage.transformXilinxToStandard(context);
|
manager.prjManage.transformXilinxToStandard(context);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
context.subscriptions.push(
|
||||||
|
vscode.commands.registerCommand('digital-ide.property-json.overwrite', () => {
|
||||||
|
manager.prjManage.overwritePropertyJson()
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function readPackageJson(context: vscode.ExtensionContext): any | undefined {
|
function readPackageJson(context: vscode.ExtensionContext): any | undefined {
|
||||||
@ -79,7 +84,7 @@ async function launch(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
await vscode.window.withProgress({
|
await vscode.window.withProgress({
|
||||||
location: vscode.ProgressLocation.Window,
|
location: vscode.ProgressLocation.Window,
|
||||||
title: "启动 Digital LSP 语言服务器"
|
title: t('info.progress.launch-lsp')
|
||||||
}, async () => {
|
}, async () => {
|
||||||
await lspClient.activate(context, packageJson);
|
await lspClient.activate(context, packageJson);
|
||||||
});
|
});
|
||||||
|
@ -46,8 +46,8 @@ function measureRequestTimecost(url: string, timeout: number = 5): Promise<numbe
|
|||||||
|
|
||||||
export async function chooseBestDownloadSource(signature: string, version: string, timeout: number = 3000) {
|
export async function chooseBestDownloadSource(signature: string, version: string, timeout: number = 3000) {
|
||||||
const links = [
|
const links = [
|
||||||
getGiteeDownloadLink(signature, version),
|
getGithubDownloadLink(signature, version),
|
||||||
getGithubDownloadLink(signature, version)
|
getGiteeDownloadLink(signature, version)
|
||||||
];
|
];
|
||||||
const pools: Promise<number>[] = [];
|
const pools: Promise<number>[] = [];
|
||||||
for (const link of links) {
|
for (const link of links) {
|
||||||
|
@ -3,6 +3,7 @@ import * as fs from 'fs';
|
|||||||
|
|
||||||
import { Arch, PrjInfo, RawPrjInfo, resolve } from './prjInfo';
|
import { Arch, PrjInfo, RawPrjInfo, resolve } from './prjInfo';
|
||||||
import { hdlPath } from '../hdlFs';
|
import { hdlPath } from '../hdlFs';
|
||||||
|
import { getUserHomeDir } from './util';
|
||||||
|
|
||||||
type AbsPath = string;
|
type AbsPath = string;
|
||||||
type RelPath = string;
|
type RelPath = string;
|
||||||
@ -94,6 +95,10 @@ class OpeParam {
|
|||||||
return this._propertySchemaPath;
|
return this._propertySchemaPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get dideHome() : AbsPath {
|
||||||
|
return hdlPath.join(getUserHomeDir(), '.digital-ide');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path of property-init.json
|
* path of property-init.json
|
||||||
*/
|
*/
|
||||||
|
@ -5,6 +5,7 @@ import * as childProcess from 'child_process';
|
|||||||
|
|
||||||
import { AbsPath, MainOutput } from ".";
|
import { AbsPath, MainOutput } from ".";
|
||||||
import { t } from '../i18n';
|
import { t } from '../i18n';
|
||||||
|
import { hdlPath } from '../hdlFs';
|
||||||
|
|
||||||
export class PathSet {
|
export class PathSet {
|
||||||
files: Set<AbsPath> = new Set<AbsPath>();
|
files: Set<AbsPath> = new Set<AbsPath>();
|
||||||
@ -252,3 +253,13 @@ export function killProcess(pid: number): Promise<void> {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户的主目录
|
||||||
|
* @returns 用户主目录的绝对路径
|
||||||
|
*/
|
||||||
|
export function getUserHomeDir(): AbsPath {
|
||||||
|
// 优先使用环境变量,如果不存在则使用 os.homedir()
|
||||||
|
const path = process.env.HOME || process.env.USERPROFILE || os.homedir();
|
||||||
|
return hdlPath.toSlash(path);
|
||||||
|
}
|
||||||
|
@ -183,6 +183,17 @@ export function readJSON(path: AbsPath): any {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function checkJson(path: AbsPath): any {
|
||||||
|
try {
|
||||||
|
const context = fs.readFileSync(path, 'utf-8');
|
||||||
|
const obj = JSON.parse(context)
|
||||||
|
const toolChain = obj.properties.toolChain;
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function writeJSON(path: AbsPath, obj: object): boolean {
|
export function writeJSON(path: AbsPath, obj: object): boolean {
|
||||||
try {
|
try {
|
||||||
const jsonString = JSON.stringify(obj, null, '\t');
|
const jsonString = JSON.stringify(obj, null, '\t');
|
||||||
@ -239,10 +250,6 @@ export function copyFile(src: AbsPath, dest: AbsPath, cover: boolean = true): bo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cover) {
|
|
||||||
cover = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parent = fspath.dirname(dest);
|
const parent = fspath.dirname(dest);
|
||||||
fs.mkdirSync(parent, {recursive: true});
|
fs.mkdirSync(parent, {recursive: true});
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
* Hardware Programming
|
* Hardware Programming
|
||||||
*/
|
*/
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { exec } from 'child_process';
|
import * as fs from 'fs';
|
||||||
import { platform } from 'os';
|
|
||||||
|
|
||||||
import { PLContext, XilinxOperation } from './xilinx';
|
import { PLContext, XilinxOperation } from './xilinx';
|
||||||
import { BaseManage } from '../common';
|
import { BaseManage } from '../common';
|
||||||
@ -157,32 +156,53 @@ class PlManage extends BaseManage {
|
|||||||
this.context.ope.delFiles(files, this.context);
|
this.context.ope.delFiles(files, this.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 添加自定义 device 字符串
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
async addDevice() {
|
async addDevice() {
|
||||||
const propertySchema = opeParam.propertySchemaPath;
|
const propertySchema = opeParam.propertySchemaPath;
|
||||||
let propertyParam = hdlFile.readJSON(propertySchema) as PropertySchema;
|
let propertyParam = hdlFile.readJSON(propertySchema) as PropertySchema;
|
||||||
const device = await vscode.window.showInputBox({
|
const device = await vscode.window.showInputBox({
|
||||||
password: false,
|
password: false,
|
||||||
ignoreFocusOut: true,
|
ignoreFocusOut: true,
|
||||||
placeHolder: 'Please input the name of device'
|
placeHolder: t('info.addDevice.placeholder')
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 同步到缓存中
|
||||||
|
const dideHome = opeParam.dideHome;
|
||||||
|
const cachePPy = hdlPath.join(dideHome, 'property-schema.json');
|
||||||
|
|
||||||
if (!propertyParam.properties.device.enum.includes(device)) {
|
if (!propertyParam.properties.device.enum.includes(device)) {
|
||||||
propertyParam.properties.device.enum.push(device);
|
propertyParam.properties.device.enum.push(device);
|
||||||
hdlFile.writeJSON(propertySchema, propertyParam);
|
hdlFile.writeJSON(propertySchema, propertyParam);
|
||||||
vscode.window.showInformationMessage(`Add the ${device} successfully!!!`);
|
hdlFile.writeJSON(cachePPy, propertyParam);
|
||||||
|
vscode.window.showInformationMessage(t('info.addDevice.add-success', device));
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showWarningMessage("The device already exists.");
|
vscode.window.showWarningMessage(t('warning.addDevice.name-taken', device));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 删除用户创建的 device
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
async delDevice() {
|
async delDevice() {
|
||||||
const propertySchema = opeParam.propertySchemaPath;
|
const propertySchema = opeParam.propertySchemaPath;
|
||||||
let propertyParam = hdlFile.readJSON(propertySchema) as PropertySchema;
|
const propertyParam = hdlFile.readJSON(propertySchema) as PropertySchema;
|
||||||
const device = await vscode.window.showQuickPick(propertyParam.properties.device.enum);
|
const cachePPy = hdlPath.join(opeParam.dideHome, 'property-schema.json');
|
||||||
|
|
||||||
|
const device = await vscode.window.showQuickPick(
|
||||||
|
propertyParam.properties.device.enum.filter(device => device !== 'none'),
|
||||||
|
{
|
||||||
|
placeHolder: t('info.delDevice.placeholder'),
|
||||||
|
ignoreFocusOut: true
|
||||||
|
}
|
||||||
|
);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -190,7 +210,8 @@ class PlManage extends BaseManage {
|
|||||||
const index = propertyParam.properties.device.enum.indexOf(device);
|
const index = propertyParam.properties.device.enum.indexOf(device);
|
||||||
propertyParam.properties.device.enum.splice(index, 1);
|
propertyParam.properties.device.enum.splice(index, 1);
|
||||||
hdlFile.writeJSON(propertySchema, propertyParam);
|
hdlFile.writeJSON(propertySchema, propertyParam);
|
||||||
vscode.window.showInformationMessage(`Delete the ${device} successfully!!!`);
|
hdlFile.writeJSON(cachePPy, propertyParam);
|
||||||
|
vscode.window.showInformationMessage(t('info.delDevice.del-success', device));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,6 +457,14 @@ class XilinxOperation {
|
|||||||
for (const pid of srcscannerPids) {
|
for (const pid of srcscannerPids) {
|
||||||
await killProcess(pid);
|
await killProcess(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除所有 vivado_pid21812.str
|
||||||
|
for (const file of fs.readdirSync(opeParam.workspacePath)) {
|
||||||
|
if (file.startsWith('vivado_pid') && file.endsWith('.str')) {
|
||||||
|
const file_path = hdlPath.join(opeParam.workspacePath, file);
|
||||||
|
hdlFile.rmSync(file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async exit(context: PLContext) {
|
public async exit(context: PLContext) {
|
||||||
|
@ -3,7 +3,7 @@ import * as vscode from 'vscode';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as fspath from 'path';
|
import * as fspath from 'path';
|
||||||
|
|
||||||
import { AbsPath, IProgress, LspClient, MainOutput, opeParam, ReportType } from '../global';
|
import { AbsPath, IProgress, MainOutput, opeParam, ReportType } from '../global';
|
||||||
import { PathSet } from '../global/util';
|
import { PathSet } from '../global/util';
|
||||||
import { RawPrjInfo } from '../global/prjInfo';
|
import { RawPrjInfo } from '../global/prjInfo';
|
||||||
import { hdlDir, hdlFile, hdlPath } from '../hdlFs';
|
import { hdlDir, hdlFile, hdlPath } from '../hdlFs';
|
||||||
@ -14,9 +14,7 @@ import { hdlIgnore } from './ignore';
|
|||||||
import { hdlMonitor } from '../monitor';
|
import { hdlMonitor } from '../monitor';
|
||||||
import { t } from '../i18n';
|
import { t } from '../i18n';
|
||||||
import { PpyAction } from '../monitor/propery';
|
import { PpyAction } from '../monitor/propery';
|
||||||
import { refreshArchTree } from '../function/treeView';
|
import { checkJson, readJSON } from '../hdlFs/file';
|
||||||
import * as lspClient from '../function/lsp-client';
|
|
||||||
import { refreshWorkspaceDiagonastics } from '../function/lsp/linter/manager';
|
|
||||||
|
|
||||||
|
|
||||||
interface RefreshPrjConfig {
|
interface RefreshPrjConfig {
|
||||||
@ -36,7 +34,11 @@ class PrjManage {
|
|||||||
vscode.window.showWarningMessage('property file already exists !!!');
|
vscode.window.showWarningMessage('property file already exists !!!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const template = hdlFile.readJSON(opeParam.propertyInitPath) as RawPrjInfo;
|
|
||||||
|
const cachePPy = hdlPath.join(opeParam.dideHome, 'property-init.json');
|
||||||
|
const propertyInitPath = fs.existsSync(cachePPy) ? cachePPy: opeParam.propertyInitPath;
|
||||||
|
|
||||||
|
const template = hdlFile.readJSON(propertyInitPath) as RawPrjInfo;
|
||||||
hdlFile.writeJSON(opeParam.propertyJsonPath, template);
|
hdlFile.writeJSON(opeParam.propertyJsonPath, template);
|
||||||
|
|
||||||
// 当创建 property.json 时,monitor 似乎无法获取到 ppy 的 add 事件
|
// 当创建 property.json 时,monitor 似乎无法获取到 ppy 的 add 事件
|
||||||
@ -45,13 +47,22 @@ class PrjManage {
|
|||||||
await ppyAction.add(opeParam.propertyJsonPath, hdlMonitor);
|
await ppyAction.add(opeParam.propertyJsonPath, hdlMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// overwrite content in current property.json to property-init.json
|
/**
|
||||||
|
* @description 用户自定义 property-init.json
|
||||||
|
*/
|
||||||
public async overwritePropertyJson() {
|
public async overwritePropertyJson() {
|
||||||
|
const dideHome = opeParam.dideHome;
|
||||||
|
hdlDir.mkdir(dideHome);
|
||||||
|
const cachePPy = hdlPath.join(dideHome, 'property-init.json');
|
||||||
|
if (!fs.existsSync(cachePPy)) {
|
||||||
|
hdlFile.copyFile(opeParam.propertyInitPath, cachePPy);
|
||||||
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
preview: false,
|
preview: false,
|
||||||
viewColumn: vscode.ViewColumn.Active
|
viewColumn: vscode.ViewColumn.Active
|
||||||
};
|
};
|
||||||
const uri = vscode.Uri.file(opeParam.propertyInitPath);
|
const uri = vscode.Uri.file(cachePPy);
|
||||||
await vscode.window.showTextDocument(uri, options);
|
await vscode.window.showTextDocument(uri, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,12 +94,8 @@ class PrjManage {
|
|||||||
propertySchemaPath,
|
propertySchemaPath,
|
||||||
propertyInitPath);
|
propertyInitPath);
|
||||||
|
|
||||||
// set path for merge in prjInfo
|
|
||||||
opeParam.prjInfo.initContextPath(extensionPath, workspacePath);
|
opeParam.prjInfo.initContextPath(extensionPath, workspacePath);
|
||||||
|
|
||||||
const refreshPrjConfig: RefreshPrjConfig = {mkdir: true};
|
const refreshPrjConfig: RefreshPrjConfig = {mkdir: true};
|
||||||
|
|
||||||
// merge prjInfo from propertyJsonPath if exist
|
|
||||||
if (fs.existsSync(propertyJsonPath)) {
|
if (fs.existsSync(propertyJsonPath)) {
|
||||||
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo;
|
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath) as RawPrjInfo;
|
||||||
opeParam.mergePrjInfo(rawPrjInfo);
|
opeParam.mergePrjInfo(rawPrjInfo);
|
||||||
@ -96,6 +103,15 @@ class PrjManage {
|
|||||||
refreshPrjConfig.mkdir = false;
|
refreshPrjConfig.mkdir = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建用户目录
|
||||||
|
hdlDir.mkdir(opeParam.dideHome);
|
||||||
|
// 同步部分文件
|
||||||
|
const cachePPySchema = hdlPath.join(opeParam.dideHome, 'property-schema.json');
|
||||||
|
const propertySchema = opeParam.propertySchemaPath;
|
||||||
|
if (fs.existsSync(cachePPySchema) && checkJson(cachePPySchema)) {
|
||||||
|
hdlFile.copyFile(cachePPySchema, propertySchema);
|
||||||
|
}
|
||||||
|
|
||||||
return refreshPrjConfig;
|
return refreshPrjConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,6 +543,7 @@ class PrjManage {
|
|||||||
// hdlMonitor.start();
|
// hdlMonitor.start();
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const prjManage = new PrjManage();
|
const prjManage = new PrjManage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user