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q0&ByUwn3AuLV0{J*^x|C=^Nxj7@L3lHAb0UQ-25^8gkd}!DgRI}N1ik7ws2JmF
zK(#zU!#V6{FMlbGf5RGlAfohlKy
z9@b2?5*1kA3hb4Qo+ti5T?OQ4*|5jJq7_YwUL>l>?2zp#EzP$Ea!+vND!y^@Y#8?^
zLmvE%VoYbl#q|9kXWAQ!BXdUNsK7WbrzZZ;OrULB`>&Bzrb+?#4U2Pe3NoNEOIoGLHxPL
zLP2~Qa*rxsdm_h9Dtj`}pkMHdH)|U+D0obq(hAVFhc#dNiylhfvEr;ioX3d?r-B0?
znitCnH|%3Gj(iTTRwYX$p(hpVRF}xBTi$qBxz3walWP9^x4bhN0=`FpUa2$&Xmn1w
zSOH@vEC&ByPXk74z-PX^zg;kB=CEdPVAZVuId=6v!Faxm5z&Aun
z`!iEnSgB-p%8(l_u)P?v=U0>}YEAG@Eq#w9CO&va3HPVx%;EtDmrIme_(inEF4@kh
zSSq?8{YF!Q3%^U>Sc32>xg_BtAPnD}<~0NLn2dE1yz
qbv4O&VEhSoE>htOLDJPYI{OhjiMcEfi#zxeB&_M-XgB|A_WuA!X=kSZ
diff --git a/src/function/hdlDoc/html.ts b/src/function/hdlDoc/html.ts
index 77692d5..08cf36e 100644
--- a/src/function/hdlDoc/html.ts
+++ b/src/function/hdlDoc/html.ts
@@ -9,6 +9,7 @@ import { Count, MarkdownString, ThemeColorConfig, WavedromString } from './commo
import { getRenderList, getCurrentRenderList } from './markdown';
import { hdlPath, hdlIcon, hdlFile } from '../../hdlFs';
import { ThemeType } from '../../global/enum';
+import { t } from '../../i18n';
const _cache = {
css : ''
@@ -227,8 +228,9 @@ export async function makeDocWebview(uri: vscode.Uri, context: vscode.ExtensionC
}
);
- panel.iconPath = hdlIcon.getIconConfig('documentation');
-
+ panel.iconPath = hdlIcon.getIconConfig('dide');
+ panel.title = t('info.common.codedoc') + ': ' + fspath.basename(uri.fsPath);
+
const html = getWebviewContent(context, panel);
if (html === undefined) {
return panel;
@@ -241,7 +243,7 @@ export async function makeDocWebview(uri: vscode.Uri, context: vscode.ExtensionC
let filePath: string = message.filePath;
if (filePath.startsWith('file://')) {
filePath = filePath.slice(7);
- }
+ }
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(filePath));
return;
case 'do-render':
diff --git a/src/function/hdlDoc/markdown.ts b/src/function/hdlDoc/markdown.ts
index 2696ee1..ab80e70 100644
--- a/src/function/hdlDoc/markdown.ts
+++ b/src/function/hdlDoc/markdown.ts
@@ -43,15 +43,34 @@ function selectFieldValue(obj: any, subName: string, ws: string, name: string, i
if (fs.existsSync(value)) {
// 判断 类型
const hdlFile = hdlParam.getHdlFile(value);
- if (hdlFile && hdlFile.projectType === HdlFileProjectType.RemoteLib) {
- // 如果是 库 文件,做出更加自定义的字面量
- const libRelPath = value.replace(`${opeParam.extensionPath}/library/`, '');
- value = `library [${libRelPath}](file://${value})`;
- } else {
+ if (hdlFile) {
+ switch (hdlFile.projectType) {
+ case HdlFileProjectType.RemoteLib:
+ // 如果是 库 文件,做出更加自定义的字面量
+ const libRelPath = value.replace(`${opeParam.extensionPath}/library/`, '');
+ value = `library [${libRelPath}](file://${value})`;
+ break;
+ case HdlFileProjectType.IP:
+ // 如果是 IP,定向到 xci 上
+ const ipname = fspath.basename(value);
+ const xciPath = hdlPath.join(value, ipname + '.xci');
+ value = `ip core [${relativePath}](file://${xciPath})`;
+ break;
+ default:
+ value = `project [${relativePath}](file://${value})`;
+ break;
+ }
+ } else {
value = `project [${relativePath}](file://${value})`;
}
} else {
- value = 'unknown ' + t('info.dide-doc.source.cannot-find');
+ // 如果不存在,可能是原语
+ const inst = obj as HdlInstance;
+ if (inst.getDoFastFileType === 'primitives') {
+ value = `${opeParam.prjInfo.toolChain} primitive`;
+ } else {
+ value = 'unknown ' + t('info.dide-doc.source.cannot-find');
+ }
}
}
@@ -171,14 +190,7 @@ async function getDocsFromModule(module: HdlModule): Promise {
await portPP;
// 判断是否为单文件
- let isSingleFile = false;
- if (!opeParam.workspacePath || !fs.existsSync(opeParam.workspacePath)) {
- isSingleFile = true;
- } else {
- const workspacePath = opeParam.workspacePath;
- const modulePath = module.path;
- isSingleFile = !modulePath.startsWith(workspacePath);
- }
+ const isSingleFile = opeParam.openMode === 'file';
// param section
const paramTitleIcon = ' ';
@@ -227,10 +239,10 @@ async function getDocsFromModule(module: HdlModule): Promise {
const depTitleIcon = ' ';
md.addTitle(depTitleIcon + t('info.dide-doc.dependency'), 2);
- let insts = module.getAllInstances();
+ let insts: HdlInstance[] = [];
// 对于单文件模式而言,未进行 instance 搜索,所以insts必然是空的
if (isSingleFile && insts.length === 0 && module.rawInstances) {
- insts = module.rawInstances.map(rawInstance => new HdlInstance(
+ insts = module.rawInstances.map(rawInstance => new HdlInstance(
rawInstance.name,
rawInstance.type,
undefined,
@@ -240,6 +252,9 @@ async function getDocsFromModule(module: HdlModule): Promise {
rawInstance.range,
module
));
+ } else {
+ // 对于多文件,找出所有依赖项
+ insts = [...module.getAllDependenceInstance()];
}
// 根据 start 进行排序
diff --git a/src/function/lsp-client/index.ts b/src/function/lsp-client/index.ts
index dc07c8c..f29a9fb 100644
--- a/src/function/lsp-client/index.ts
+++ b/src/function/lsp-client/index.ts
@@ -210,8 +210,10 @@ export async function activate(context: vscode.ExtensionContext, packageJson: an
);
LspClient.DigitalIDE = client;
+ // 启动 lsp
await client.start();
+ // 检测配置文件变动
registerConfigurationUpdater(client, packageJson);
}
diff --git a/src/function/treeView/tree.ts b/src/function/treeView/tree.ts
index 3db8f62..b66c0f0 100644
--- a/src/function/treeView/tree.ts
+++ b/src/function/treeView/tree.ts
@@ -203,6 +203,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider {
// 默认选择依赖模块最多的作为 first top
let firstTop: { path: string, name: string } | undefined = undefined;
let maxDepSize = 0;
+
for (const hdlModule of topModules) {
// 此处断言是因为当前的 name 和 path 是从 topModules 中提取的
diff --git a/src/hdlParser/common.ts b/src/hdlParser/common.ts
index f1a48d2..340bd34 100644
--- a/src/hdlParser/common.ts
+++ b/src/hdlParser/common.ts
@@ -172,6 +172,7 @@ interface RawHdlInstance {
interface RawHdlModule {
name: string
+ archName: string
params: HdlModuleParam[]
ports: HdlModulePort[]
instances: RawHdlInstance[]
diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts
index 880d20a..7d169ab 100644
--- a/src/hdlParser/core.ts
+++ b/src/hdlParser/core.ts
@@ -205,11 +205,14 @@ class HdlParam {
} else if (status === common.InstModPathStatus.Others && inst.instModPath) {
dependencies.others.push(inst.instModPath);
}
- const instDependencies = this.getAllDependences(inst.module.path, inst.module.name);
- if (instDependencies) {
- dependencies.current.push(...instDependencies.current);
- dependencies.include.push(...instDependencies.include);
- dependencies.others.push(...instDependencies.others);
+ // 防止无限递归
+ if (inst.module && inst.module !== module) {
+ const instDependencies = this.getAllDependences(inst.module.path, inst.module.name);
+ if (instDependencies) {
+ dependencies.current.push(...instDependencies.current);
+ dependencies.include.push(...instDependencies.include);
+ dependencies.others.push(...instDependencies.others);
+ }
}
}
@@ -819,6 +822,59 @@ class HdlModule {
return this.nameToInstances.size;
}
+ /**
+ * @description 获取当前模块的所有依赖路径
+ * @returns
+ */
+ public getAllDependences(): common.HdlDependence {
+ const dependencies : common.HdlDependence = {
+ current: [],
+ include: [],
+ others: []
+ };
+
+ for (const inst of this.getAllInstances()) {
+ if (!inst.module) {
+ continue;
+ }
+ const status = inst.instModPathStatus;
+ if (status === common.InstModPathStatus.Current && inst.instModPath) {
+ dependencies.current.push(inst.instModPath);
+ } else if (status === common.InstModPathStatus.Include && inst.instModPath) {
+ dependencies.include.push(inst.instModPath);
+ } else if (status === common.InstModPathStatus.Others && inst.instModPath) {
+ dependencies.others.push(inst.instModPath);
+ }
+ if (inst.module) {
+ const instDependencies = inst.module.getAllDependences();
+ dependencies.current.push(...instDependencies.current);
+ dependencies.include.push(...instDependencies.include);
+ dependencies.others.push(...instDependencies.others);
+ }
+ }
+
+ return dependencies;
+ }
+
+ /**
+ * @description 递归获取当前模块所有依赖
+ */
+ public getAllDependenceInstance(): Set {
+ const instances = new Set();
+ // 获取自身的
+ for (const inst of this.nameToInstances.values()) {
+ console.log(inst);
+ instances.add(inst);
+ // 递归获取 inst 的
+ if (inst.module) {
+ for (const subInst of inst.module.getAllDependenceInstance()) {
+ instances.add(subInst);
+ }
+ }
+ }
+ return instances;
+ }
+
public createHdlInstance(rawHdlInstance: common.RawHdlInstance): HdlInstance {
const instModName = rawHdlInstance.type;
@@ -1092,6 +1148,8 @@ export class HdlFile {
// add to global hdlParam
hdlParam.setHdlFile(this);
+ console.log(modules);
+
// make nameToModule
this.nameToModule = new Map();
for (const rawHdlModule of modules) {