From 1860d19627941678c416d187e4e6d7b73eafad62 Mon Sep 17 00:00:00 2001
From: Kirigaya <1193466151@qq.com>
Date: Sun, 22 Sep 2024 22:00:57 +0800
Subject: [PATCH 1/2] update
---
src/hdlParser/core.ts | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts
index 441f827..8e57d7b 100644
--- a/src/hdlParser/core.ts
+++ b/src/hdlParser/core.ts
@@ -525,10 +525,6 @@ class HdlModule {
}
public makeNameToInstances() {
- if (this.name === 'u_reg_cfg') {
- console.log('[u_reg_cfg debug]');
- console.log(this.rawInstances);
- }
if (this.rawInstances !== undefined) {
this.nameToInstances.clear();
for (const inst of this.rawInstances) {
From e4205ffdddd3fe8139006b75b45988ad8b6762c0 Mon Sep 17 00:00:00 2001
From: Kirigaya <1193466151@qq.com>
Date: Mon, 23 Sep 2024 16:16:00 +0800
Subject: [PATCH 2/2] update
---
resources/netlist/view/netlist_viewer.html | 4 ++--
src/extension.ts | 7 +++++++
src/function/hdlDoc/diagram.ts | 1 -
src/function/hdlDoc/markdown.ts | 5 +----
src/function/lsp/util/feature.ts | 8 +++-----
src/global/lsp.ts | 4 ++--
src/hdlParser/util.ts | 17 +++--------------
7 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/resources/netlist/view/netlist_viewer.html b/resources/netlist/view/netlist_viewer.html
index 59ab18e..1e67086 100644
--- a/resources/netlist/view/netlist_viewer.html
+++ b/resources/netlist/view/netlist_viewer.html
@@ -166,8 +166,8 @@
const message = event.data;
const command = message.command;
const netlist = JSON.parse(message.netlist);
- console.log(typeof netlist);
- console.log(netlist);
+ // console.log(typeof netlist);
+ // console.log(netlist);
switch (command) {
case 'netlist' :
diff --git a/src/extension.ts b/src/extension.ts
index e4c1a69..a5d7146 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -8,6 +8,7 @@ import { hdlMonitor } from './monitor';
import { extensionUrl } from '../resources/hdlParser';
import * as lspClient from './function/lsp-client';
+import { refreshArchTree } from './function/treeView';
@@ -37,9 +38,15 @@ async function launch(context: vscode.ExtensionContext) {
location: vscode.ProgressLocation.Window,
title: 'Initialization (Digtial-IDE)'
}, async () => {
+ // 初始化解析
await manager.prjManage.initialise(context);
+
+ // 这里是因为 pl 对象在 initialise 完成初始化,此处再注册它的行为
manager.registerManagerCommands(context);
+ // 刷新结构树
+ refreshArchTree();
+
hdlMonitor.start();
});
diff --git a/src/function/hdlDoc/diagram.ts b/src/function/hdlDoc/diagram.ts
index 3730e92..0a9875f 100644
--- a/src/function/hdlDoc/diagram.ts
+++ b/src/function/hdlDoc/diagram.ts
@@ -190,7 +190,6 @@ function makeRightDirection(rightPorts: HdlModulePort[]): string {
const portCaption = makePortCaption(port, 'right');
let portArrow = makePortArrow(port, 'right');
portArrow = portArrow.replace('-0.5 -0.5 125 45', '20 -0.5 125 45');
- console.log(portArrow);
const arrow = `
${portCaption}${portArrow}
`;
rightDirection += arrow;
diff --git a/src/function/hdlDoc/markdown.ts b/src/function/hdlDoc/markdown.ts
index 0c97c95..7b31fbc 100644
--- a/src/function/hdlDoc/markdown.ts
+++ b/src/function/hdlDoc/markdown.ts
@@ -47,9 +47,7 @@ function selectFieldValue(obj: any, subName: string, ws: string, name: string):
function makeTableFromObjArray(md: MarkdownString, array: any[], name: string, fieldNames: string[], displayNames: string[]) {
- const ws = hdlPath.toSlash(opeParam.workspacePath) + '/';
- console.log('enter showhtml');
-
+ const ws = hdlPath.toSlash(opeParam.workspacePath) + '/';
if (array.length === 0) {
md.addText(`no ${name} info`);
} else {
@@ -82,7 +80,6 @@ async function patchComment(path: AbsPath, ports: (HdlModulePort | HdlModulePara
}
const ranges = ports.map(port => port.range);
const comments = await getSymbolComments(path, ranges);
- console.log(ranges);
for (let i = 0; i < ports.length; ++ i) {
let inlineComment = comments[i].replace(/\n/, ' ');
diff --git a/src/function/lsp/util/feature.ts b/src/function/lsp/util/feature.ts
index 2f06027..1c62bd3 100644
--- a/src/function/lsp/util/feature.ts
+++ b/src/function/lsp/util/feature.ts
@@ -128,7 +128,7 @@ function bin2float(bin: string, exp: number, fra: number): number | undefined {
function getFullSymbolInfoVlog(document: vscode.TextDocument, range: Range) {
const comments = [];
- const currentLine = range.start.line;
+ const currentLine = range.start.line - 1;
const currentText = document.lineAt(currentLine).text;
// 往上找到第一个非空行
@@ -203,8 +203,6 @@ function getFullSymbolInfoVlog(document: vscode.TextDocument, range: Range) {
}
}
-
-
// 情况 2.1:单行注释
if (currentText.includes('//')) {
const singleLineCommentStartIndex = currentText.indexOf('//');
@@ -262,8 +260,8 @@ async function getFullSymbolInfo(document: vscode.TextDocument, range: Range, no
if (document.languageId !== 'vhdl') {
comments.push(...getFullSymbolInfoVlog(document, range));
let resultComment = '';
- for (const c of comments.reverse()) {
- resultComment += c.trim() + '\n';
+ for (const c of comments) {
+ resultComment += c.trim() + '
';
}
return resultComment;
diff --git a/src/global/lsp.ts b/src/global/lsp.ts
index ceb7cba..329fe0e 100644
--- a/src/global/lsp.ts
+++ b/src/global/lsp.ts
@@ -23,7 +23,7 @@ export const LspClient: IDigitalIDELspClient = {
*/
export const CustomRequestType = new RequestType('custom/request');
export const CustomParamRequestType = new RequestType('custom/paramRequest');
-export const DoFastRequestType = new RequestType('api/fast');
+export const DoFastRequestType = new RequestType('api/fast');
export interface ITextDocumentItem {
uri: vscode.Uri,
@@ -37,5 +37,5 @@ export interface ICommonParam {
}
export interface IDoFastParam {
-
+ path: string
}
\ No newline at end of file
diff --git a/src/hdlParser/util.ts b/src/hdlParser/util.ts
index 30e8e28..684f400 100644
--- a/src/hdlParser/util.ts
+++ b/src/hdlParser/util.ts
@@ -11,20 +11,9 @@ async function doFastApi(path: string): Promise {
const client = LspClient.MainClient;
const langID = hdlFile.getLanguageId(path);
if (client) {
- const response = await client.sendRequest(DoFastRequestType, { path }) as { fast: any };
- if (response.fast instanceof Array) {
- const rawModules = response.fast as RawHdlModule[];
- return {
- content: rawModules,
- languageId: langID,
- macro: {
- errors: [],
- defines: [],
- includes: [],
- invalid: []
- }
- };
- }
+ const response = await client.sendRequest(DoFastRequestType, { path });
+ response.languageId = langID;
+ return response;
}
} catch (error) {
console.error("error happen when run doFastApi, " + error);