update
This commit is contained in:
parent
1860d19627
commit
e4205ffddd
@ -166,8 +166,8 @@
|
|||||||
const message = event.data;
|
const message = event.data;
|
||||||
const command = message.command;
|
const command = message.command;
|
||||||
const netlist = JSON.parse(message.netlist);
|
const netlist = JSON.parse(message.netlist);
|
||||||
console.log(typeof netlist);
|
// console.log(typeof netlist);
|
||||||
console.log(netlist);
|
// console.log(netlist);
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 'netlist' :
|
case 'netlist' :
|
||||||
|
@ -8,6 +8,7 @@ import { hdlMonitor } from './monitor';
|
|||||||
import { extensionUrl } from '../resources/hdlParser';
|
import { extensionUrl } from '../resources/hdlParser';
|
||||||
|
|
||||||
import * as lspClient from './function/lsp-client';
|
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,
|
location: vscode.ProgressLocation.Window,
|
||||||
title: 'Initialization (Digtial-IDE)'
|
title: 'Initialization (Digtial-IDE)'
|
||||||
}, async () => {
|
}, async () => {
|
||||||
|
// 初始化解析
|
||||||
await manager.prjManage.initialise(context);
|
await manager.prjManage.initialise(context);
|
||||||
|
|
||||||
|
// 这里是因为 pl 对象在 initialise 完成初始化,此处再注册它的行为
|
||||||
manager.registerManagerCommands(context);
|
manager.registerManagerCommands(context);
|
||||||
|
|
||||||
|
// 刷新结构树
|
||||||
|
refreshArchTree();
|
||||||
|
|
||||||
hdlMonitor.start();
|
hdlMonitor.start();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -190,7 +190,6 @@ function makeRightDirection(rightPorts: HdlModulePort[]): string {
|
|||||||
const portCaption = makePortCaption(port, 'right');
|
const portCaption = makePortCaption(port, 'right');
|
||||||
let portArrow = makePortArrow(port, 'right');
|
let portArrow = makePortArrow(port, 'right');
|
||||||
portArrow = portArrow.replace('-0.5 -0.5 125 45', '20 -0.5 125 45');
|
portArrow = portArrow.replace('-0.5 -0.5 125 45', '20 -0.5 125 45');
|
||||||
console.log(portArrow);
|
|
||||||
|
|
||||||
const arrow = `<div class="arrow-wrapper">${portCaption}${portArrow}</div>`;
|
const arrow = `<div class="arrow-wrapper">${portCaption}${portArrow}</div>`;
|
||||||
rightDirection += arrow;
|
rightDirection += arrow;
|
||||||
|
@ -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[]) {
|
function makeTableFromObjArray(md: MarkdownString, array: any[], name: string, fieldNames: string[], displayNames: string[]) {
|
||||||
const ws = hdlPath.toSlash(opeParam.workspacePath) + '/';
|
const ws = hdlPath.toSlash(opeParam.workspacePath) + '/';
|
||||||
console.log('enter showhtml');
|
|
||||||
|
|
||||||
if (array.length === 0) {
|
if (array.length === 0) {
|
||||||
md.addText(`no ${name} info`);
|
md.addText(`no ${name} info`);
|
||||||
} else {
|
} else {
|
||||||
@ -82,7 +80,6 @@ async function patchComment(path: AbsPath, ports: (HdlModulePort | HdlModulePara
|
|||||||
}
|
}
|
||||||
const ranges = ports.map(port => port.range);
|
const ranges = ports.map(port => port.range);
|
||||||
const comments = await getSymbolComments(path, ranges);
|
const comments = await getSymbolComments(path, ranges);
|
||||||
console.log(ranges);
|
|
||||||
|
|
||||||
for (let i = 0; i < ports.length; ++ i) {
|
for (let i = 0; i < ports.length; ++ i) {
|
||||||
let inlineComment = comments[i].replace(/\n/, ' ');
|
let inlineComment = comments[i].replace(/\n/, ' ');
|
||||||
|
@ -128,7 +128,7 @@ function bin2float(bin: string, exp: number, fra: number): number | undefined {
|
|||||||
|
|
||||||
function getFullSymbolInfoVlog(document: vscode.TextDocument, range: Range) {
|
function getFullSymbolInfoVlog(document: vscode.TextDocument, range: Range) {
|
||||||
const comments = [];
|
const comments = [];
|
||||||
const currentLine = range.start.line;
|
const currentLine = range.start.line - 1;
|
||||||
const currentText = document.lineAt(currentLine).text;
|
const currentText = document.lineAt(currentLine).text;
|
||||||
|
|
||||||
// 往上找到第一个非空行
|
// 往上找到第一个非空行
|
||||||
@ -203,8 +203,6 @@ function getFullSymbolInfoVlog(document: vscode.TextDocument, range: Range) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 情况 2.1:单行注释
|
// 情况 2.1:单行注释
|
||||||
if (currentText.includes('//')) {
|
if (currentText.includes('//')) {
|
||||||
const singleLineCommentStartIndex = currentText.indexOf('//');
|
const singleLineCommentStartIndex = currentText.indexOf('//');
|
||||||
@ -262,8 +260,8 @@ async function getFullSymbolInfo(document: vscode.TextDocument, range: Range, no
|
|||||||
if (document.languageId !== 'vhdl') {
|
if (document.languageId !== 'vhdl') {
|
||||||
comments.push(...getFullSymbolInfoVlog(document, range));
|
comments.push(...getFullSymbolInfoVlog(document, range));
|
||||||
let resultComment = '';
|
let resultComment = '';
|
||||||
for (const c of comments.reverse()) {
|
for (const c of comments) {
|
||||||
resultComment += c.trim() + '\n';
|
resultComment += c.trim() + '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultComment;
|
return resultComment;
|
||||||
|
@ -23,7 +23,7 @@ export const LspClient: IDigitalIDELspClient = {
|
|||||||
*/
|
*/
|
||||||
export const CustomRequestType = new RequestType<void, number, void>('custom/request');
|
export const CustomRequestType = new RequestType<void, number, void>('custom/request');
|
||||||
export const CustomParamRequestType = new RequestType<ICommonParam, number, void>('custom/paramRequest');
|
export const CustomParamRequestType = new RequestType<ICommonParam, number, void>('custom/paramRequest');
|
||||||
export const DoFastRequestType = new RequestType('api/fast');
|
export const DoFastRequestType = new RequestType<IDoFastParam, Fast, void>('api/fast');
|
||||||
|
|
||||||
export interface ITextDocumentItem {
|
export interface ITextDocumentItem {
|
||||||
uri: vscode.Uri,
|
uri: vscode.Uri,
|
||||||
@ -37,5 +37,5 @@ export interface ICommonParam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IDoFastParam {
|
export interface IDoFastParam {
|
||||||
|
path: string
|
||||||
}
|
}
|
@ -11,20 +11,9 @@ async function doFastApi(path: string): Promise<Fast | undefined> {
|
|||||||
const client = LspClient.MainClient;
|
const client = LspClient.MainClient;
|
||||||
const langID = hdlFile.getLanguageId(path);
|
const langID = hdlFile.getLanguageId(path);
|
||||||
if (client) {
|
if (client) {
|
||||||
const response = await client.sendRequest(DoFastRequestType, { path }) as { fast: any };
|
const response = await client.sendRequest(DoFastRequestType, { path });
|
||||||
if (response.fast instanceof Array) {
|
response.languageId = langID;
|
||||||
const rawModules = response.fast as RawHdlModule[];
|
return response;
|
||||||
return {
|
|
||||||
content: rawModules,
|
|
||||||
languageId: langID,
|
|
||||||
macro: {
|
|
||||||
errors: [],
|
|
||||||
defines: [],
|
|
||||||
includes: [],
|
|
||||||
invalid: []
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("error happen when run doFastApi, " + error);
|
console.error("error happen when run doFastApi, " + error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user