实现下载功能
This commit is contained in:
parent
138e43dc4d
commit
22c6e4b0d9
@ -17,7 +17,8 @@
|
||||
{"open":"(", "close":")", "notIn":["string", "comment"]},
|
||||
{"open":"[", "close":"]", "notIn":["string", "comment"]},
|
||||
{"open":"{", "close":"}", "notIn":["string", "comment"]},
|
||||
{"open":"\"", "close":"\"", "notIn":["string", "comment"]}
|
||||
{"open":"\"", "close":"\"", "notIn":["string", "comment"]},
|
||||
{"open":"begin", "close":"end", "notIn":["string", "comment"]}
|
||||
],
|
||||
"onTypeFormatting": {
|
||||
"autoFormatTriggerCharacters": ["\n"]
|
||||
|
@ -551,6 +551,11 @@
|
||||
"category": "Digital-IDE",
|
||||
"title": "%digital-ide.lsp.systemverilog.linter.pick.title%"
|
||||
},
|
||||
{
|
||||
"command": "digital-ide.digital-lsp.download",
|
||||
"category": "Digital-IDE",
|
||||
"title": "%digital-ide.digital-lsp.download.title%"
|
||||
},
|
||||
{
|
||||
"command": "digital-ide.vhdl2vlog",
|
||||
"title": "%digital-ide.vhdl2vlog.title%",
|
||||
|
@ -47,5 +47,6 @@
|
||||
"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.tool.export-filelist.title": "export filelist",
|
||||
"digital-ide.treeview": "Digital IDE: TreeView"
|
||||
"digital-ide.treeview": "Digital IDE: TreeView",
|
||||
"digital-ide.digital-lsp.download.title": "Download Digital LSP"
|
||||
}
|
@ -47,5 +47,6 @@
|
||||
"digital-ide.lsp.vhdl.linter.pick.title": "选择 VHDL 的诊断",
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "选择 SystemVerilog 的诊断",
|
||||
"digital-ide.tool.export-filelist.title": "导出 filelist",
|
||||
"digital-ide.treeview": "Digital IDE: 模块树"
|
||||
"digital-ide.treeview": "Digital IDE: 模块树",
|
||||
"digital-ide.digital-lsp.download.title": "下载 Digital 语言服务器"
|
||||
}
|
@ -47,5 +47,6 @@
|
||||
"digital-ide.lsp.vhdl.linter.pick.title": "選擇 VHDL 的診斷",
|
||||
"digital-ide.lsp.systemverilog.linter.pick.title": "選擇 SystemVerilog 的診斷",
|
||||
"digital-ide.tool.export-filelist.title": "導出 filelist",
|
||||
"digital-ide.treeview": "Digital IDE: 模块树"
|
||||
"digital-ide.treeview": "Digital IDE: 模块树",
|
||||
"digital-ide.digital-lsp.download.title": "下载 Digital 语言服务器"
|
||||
}
|
2
resources/hdlParser/.gitignore
vendored
2
resources/hdlParser/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
parser.js
|
||||
parser.wasm
|
30
resources/hdlParser/index.d.ts
vendored
30
resources/hdlParser/index.d.ts
vendored
@ -1,30 +0,0 @@
|
||||
import type { RawHdlModule, Macro, RawSymbol, Error } from '../../src/hdlParser/common';
|
||||
import type { HdlLangID } from '../../src/global/enum';
|
||||
|
||||
type AbsPath = string;
|
||||
type RelPath = string;
|
||||
type Path = AbsPath | RelPath;
|
||||
|
||||
|
||||
export const extensionUrl: string;
|
||||
|
||||
interface Fast {
|
||||
content: RawHdlModule[]
|
||||
languageId: string
|
||||
macro: Macro
|
||||
}
|
||||
|
||||
interface All {
|
||||
content: RawSymbol[]
|
||||
languageId: HdlLangID
|
||||
macro: Macro
|
||||
error: Error[]
|
||||
}
|
||||
|
||||
export function callParser(path: AbsPath, func: number): Promise<any | undefined>;
|
||||
export function vlogFast(path: AbsPath): Promise<Fast | undefined>;
|
||||
export function vlogAll(path: AbsPath): Promise<All | undefined>;
|
||||
export function vhdlFast(path: AbsPath): Promise<Fast | undefined>;
|
||||
export function vhdlAll(path: AbsPath): Promise<All | undefined>;
|
||||
export function svFast(path: AbsPath): Promise<Fast | undefined>;
|
||||
export function svAll(path: AbsPath): Promise<All | undefined>;
|
@ -1,112 +0,0 @@
|
||||
const vscode = require('vscode');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const hdlParser = require('./parser');
|
||||
const { exit } = require('process');
|
||||
|
||||
const githubIssueUrl = 'https://github.com/Digital-EDA/Digital-IDE/issues';
|
||||
const extensionUrl = 'https://github.com/Digital-EDA/Digital-IDE';
|
||||
|
||||
const _hdlParser = {
|
||||
module: null,
|
||||
tempPath: '/home/hdl_parser',
|
||||
|
||||
async acquire() {
|
||||
const module = this.module;
|
||||
if (module) {
|
||||
return module;
|
||||
} else {
|
||||
const _m = await hdlParser();
|
||||
this.module = _m;
|
||||
return _m;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const debug = {
|
||||
acquire: 0,
|
||||
io: 0,
|
||||
compute: 0
|
||||
};
|
||||
|
||||
async function callParser(path, func) {
|
||||
const s1 = Date.now();
|
||||
const wasmModule = await _hdlParser.acquire();
|
||||
debug.acquire += Date.now() - s1;
|
||||
|
||||
const file = _hdlParser.tempPath;
|
||||
const fileLength = file.length;
|
||||
|
||||
const s2 = Date.now();
|
||||
const source = fs.readFileSync(path, 'utf-8') + '\n';
|
||||
wasmModule.FS.writeFile(_hdlParser.tempPath, source, { encoding: 'utf8' });
|
||||
debug.io += Date.now() - s2;
|
||||
|
||||
try {
|
||||
const s3 = Date.now();
|
||||
|
||||
// hdlparser out
|
||||
const res = wasmModule.ccall('call_parser', 'string', ['string', 'int', 'int'], [file, fileLength, func]);
|
||||
// console.log(res);
|
||||
|
||||
debug.compute += Date.now() - s3;
|
||||
// console.log(path, debug);
|
||||
return JSON.parse(res);
|
||||
} catch (error) {
|
||||
console.log(`errors happen when call wasm, path: ${path}, errors: ${error}, input params: (${path}, ${func})`);
|
||||
|
||||
const dsaSetting = vscode.workspace.getConfiguration('digital-ide.dont-show-again');
|
||||
if (dsaSetting.get('propose.issue', false) === true) {
|
||||
return undefined;
|
||||
}
|
||||
const res = await vscode.window.showErrorMessage(
|
||||
`Errors happen when parsing ${path}. Error: "${error}". Just propose a valuable issue in our github repo 😊`,
|
||||
{ title: 'Go and Propose!', value: true },
|
||||
{ title: "Don't Show Again", value: false }
|
||||
);
|
||||
if (res && res.value === true) {
|
||||
vscode.env.openExternal(vscode.Uri.parse(githubIssueUrl));
|
||||
} else if (res && res.value === false) {
|
||||
dsaSetting.update('propose.issue', true, vscode.ConfigurationTarget.Global);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function vhdlFast(path) {
|
||||
return await callParser(path, 1);
|
||||
}
|
||||
|
||||
async function vhdlAll(path) {
|
||||
return await callParser(path, 2);
|
||||
}
|
||||
|
||||
async function svFast(path) {
|
||||
return await callParser(path, 3);
|
||||
}
|
||||
|
||||
async function svAll(path) {
|
||||
return await callParser(path, 4);
|
||||
}
|
||||
|
||||
async function vlogFast(path) {
|
||||
return await callParser(path, 5);
|
||||
}
|
||||
|
||||
async function vlogAll(path) {
|
||||
return await callParser(path, 6);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
vlogFast,
|
||||
vlogAll,
|
||||
vhdlFast,
|
||||
vhdlAll,
|
||||
svFast,
|
||||
svAll,
|
||||
extensionUrl,
|
||||
callParser
|
||||
};
|
@ -6,15 +6,14 @@ import { hdlParam } from './hdlParser';
|
||||
import * as manager from './manager';
|
||||
import * as func from './function';
|
||||
import { hdlMonitor } from './monitor';
|
||||
import { extensionUrl } from '../resources/hdlParser';
|
||||
|
||||
import * as lspClient from './function/lsp-client';
|
||||
import { refreshArchTree } from './function/treeView';
|
||||
|
||||
|
||||
async function registerCommand(context: vscode.ExtensionContext) {
|
||||
async function registerCommand(context: vscode.ExtensionContext, version: string) {
|
||||
func.registerFunctionCommands(context);
|
||||
func.registerLsp(context);
|
||||
func.registerLsp(context, version);
|
||||
func.registerToolCommands(context);
|
||||
func.registerFSM(context);
|
||||
func.registerNetlist(context);
|
||||
@ -42,7 +41,7 @@ async function launch(context: vscode.ExtensionContext) {
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: t('progress.register-command')
|
||||
}, async () => {
|
||||
await registerCommand(context);
|
||||
await registerCommand(context, versionString);
|
||||
});
|
||||
|
||||
await lspClient.activate(context, versionString);
|
||||
@ -83,7 +82,7 @@ async function launch(context: vscode.ExtensionContext) {
|
||||
{ title: t('welcome.refuse'), value: false },
|
||||
);
|
||||
if (res?.value) {
|
||||
vscode.env.openExternal(vscode.Uri.parse(extensionUrl));
|
||||
vscode.env.openExternal(vscode.Uri.parse('https://github.com/Digital-EDA/Digital-IDE'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ async function patchComment(path: AbsPath, ports: (HdlModulePort | HdlModulePara
|
||||
inlineComment = inlineComment.substring(2);
|
||||
}
|
||||
ports[i].desc = inlineComment;
|
||||
console.log(inlineComment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,23 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as hdlDoc from './hdlDoc';
|
||||
import * as sim from './sim';
|
||||
import * as treeView from './treeView';
|
||||
|
||||
import * as lspCompletion from './lsp/completion';
|
||||
import * as lspDocSymbol from './lsp/docSymbol';
|
||||
import * as lspDefinition from './lsp/definition';
|
||||
import * as lspHover from './lsp/hover';
|
||||
import * as lspFormatter from '../../resources/formatter';
|
||||
import * as lspTranslator from '../../resources/translator';
|
||||
import * as lspDocSemantic from './lsp/docSemantic';
|
||||
import * as lspLinter from './lsp/linter';
|
||||
|
||||
import * as tool from './tool';
|
||||
import * as lspCore from './lsp/core';
|
||||
|
||||
// special function
|
||||
import * as FSM from './fsm';
|
||||
import * as Netlist from './netlist';
|
||||
import * as WaveView from './dide-viewer';
|
||||
import { ModuleDataItem } from './treeView/tree';
|
||||
import { downloadLsp } from './lsp-client';
|
||||
|
||||
function registerDocumentation(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand('digital-ide.hdlDoc.showWebview', hdlDoc.showDocWebview);
|
||||
@ -59,7 +56,16 @@ function registerTreeView(context: vscode.ExtensionContext) {
|
||||
vscode.commands.registerCommand('digital-ide.treeView.arch.openFile', treeView.openFileByUri);
|
||||
}
|
||||
|
||||
function registerLsp(context: vscode.ExtensionContext) {
|
||||
function registerLsp(context: vscode.ExtensionContext, version: string) {
|
||||
|
||||
// lsp download
|
||||
vscode.commands.registerCommand('digital-ide.digital-lsp.download', () => {
|
||||
const versionFolderPath = context.asAbsolutePath(
|
||||
path.join('resources', 'dide-lsp', 'server', version)
|
||||
);
|
||||
downloadLsp(context, version, versionFolderPath)
|
||||
});
|
||||
|
||||
const vlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'verilog'};
|
||||
const svlogSelector: vscode.DocumentSelector = {scheme: 'file', language: 'systemverilog'};
|
||||
const vhdlSelector: vscode.DocumentSelector = {scheme: 'file', language: 'vhdl'};
|
||||
@ -96,7 +102,6 @@ function registerLsp(context: vscode.ExtensionContext) {
|
||||
|
||||
// lsp linter
|
||||
// make first symbols in workspace
|
||||
lspCore.hdlSymbolStorage.initialise();
|
||||
lspLinter.vlogLinterManager.initialise();
|
||||
lspLinter.vhdlLinterManager.initialise();
|
||||
lspLinter.svlogLinterManager.initialise();
|
||||
|
@ -1,55 +0,0 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { All } from '../../../../resources/hdlParser';
|
||||
import { AbsPath } from '../../../global';
|
||||
import { hdlPath } from '../../../hdlFs';
|
||||
import { isHDLFile, isVerilogFile, isVhdlFile } from '../../../hdlFs/file';
|
||||
import { HdlSymbol } from '../../../hdlParser';
|
||||
|
||||
type ThenableAll = Promise<All | undefined>;
|
||||
|
||||
class SymbolStorage {
|
||||
private symbolMap: Map<AbsPath, ThenableAll>;
|
||||
private isHdlFile: (file: AbsPath) => boolean;
|
||||
constructor(isHdlFile: (file: AbsPath) => boolean) {
|
||||
this.symbolMap = new Map<AbsPath, ThenableAll>();
|
||||
this.isHdlFile = isHdlFile;
|
||||
}
|
||||
|
||||
public async getSymbol(path: AbsPath): ThenableAll {
|
||||
path = hdlPath.toSlash(path);
|
||||
const allP = this.symbolMap.get(path);
|
||||
if (allP) {
|
||||
return await allP;
|
||||
}
|
||||
this.updateSymbol(path);
|
||||
const all = await this.symbolMap.get(path);
|
||||
return all;
|
||||
}
|
||||
|
||||
public async updateSymbol(path: AbsPath) {
|
||||
path = hdlPath.toSlash(path);
|
||||
const allPromise = HdlSymbol.all(path);
|
||||
this.symbolMap.set(path, allPromise);
|
||||
}
|
||||
|
||||
public async deleteSymbol(path: AbsPath) {
|
||||
path = hdlPath.toSlash(path);
|
||||
this.symbolMap.delete(path);
|
||||
}
|
||||
|
||||
public async initialise() {
|
||||
for (const doc of vscode.workspace.textDocuments) {
|
||||
// TODO : check support for sv
|
||||
// TODO : check performance
|
||||
if (isHDLFile(doc.fileName)) {
|
||||
await this.updateSymbol(doc.fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const hdlSymbolStorage = new SymbolStorage(isVerilogFile);
|
||||
|
||||
export {
|
||||
hdlSymbolStorage
|
||||
};
|
@ -1,8 +1,6 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { All } from '../../../../resources/hdlParser';
|
||||
import { isVerilogFile, isVhdlFile } from '../../../hdlFs/file';
|
||||
import { Position } from '../../../hdlParser/common';
|
||||
import { hdlSymbolStorage } from '../core';
|
||||
import { BaseLinter } from './base';
|
||||
import { LspOutput, ReportType } from '../../../global';
|
||||
|
||||
@ -15,13 +13,13 @@ class DefaultVlogLinter implements BaseLinter {
|
||||
|
||||
async lint(document: vscode.TextDocument): Promise<void> {
|
||||
const filePath = document.fileName;
|
||||
const vlogAll = await hdlSymbolStorage.getSymbol(filePath);
|
||||
// console.log('lint all finish');
|
||||
// const vlogAll = await hdlSymbolStorage.getSymbol(filePath);
|
||||
// // console.log('lint all finish');
|
||||
|
||||
if (vlogAll) {
|
||||
const diagnostics = this.provideDiagnostics(document, vlogAll);
|
||||
this.diagnostic.set(document.uri, diagnostics);
|
||||
}
|
||||
// if (vlogAll) {
|
||||
// const diagnostics = this.provideDiagnostics(document, vlogAll);
|
||||
// this.diagnostic.set(document.uri, diagnostics);
|
||||
// }
|
||||
}
|
||||
|
||||
private provideDiagnostics(document: vscode.TextDocument, all: All): vscode.Diagnostic[] {
|
||||
@ -88,13 +86,13 @@ class DefaultVhdlLinter implements BaseLinter {
|
||||
|
||||
async lint(document: vscode.TextDocument): Promise<void> {
|
||||
const filePath = document.fileName;
|
||||
const vhdlAll = await hdlSymbolStorage.getSymbol(filePath);
|
||||
// console.log('lint all finish');
|
||||
// const vhdlAll = await hdlSymbolStorage.getSymbol(filePath);
|
||||
// // console.log('lint all finish');
|
||||
|
||||
if (vhdlAll) {
|
||||
const diagnostics = this.provideDiagnostics(document, vhdlAll);
|
||||
this.diagnostic.set(document.uri, diagnostics);
|
||||
}
|
||||
// if (vhdlAll) {
|
||||
// const diagnostics = this.provideDiagnostics(document, vhdlAll);
|
||||
// this.diagnostic.set(document.uri, diagnostics);
|
||||
// }
|
||||
}
|
||||
|
||||
private provideDiagnostics(document: vscode.TextDocument, all: All): vscode.Diagnostic[] {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { LanguageClient, RequestType, ProtocolConnection } from 'vscode-languageclient/node';
|
||||
import { Fast } from '../../resources/hdlParser';
|
||||
import { Fast } from '../hdlParser/common';
|
||||
|
||||
|
||||
interface IDigitalIDELspClient {
|
||||
@ -24,6 +24,7 @@ export const LspClient: IDigitalIDELspClient = {
|
||||
export const CustomRequestType = new RequestType<void, number, void>('custom/request');
|
||||
export const CustomParamRequestType = new RequestType<ICommonParam, number, void>('custom/paramRequest');
|
||||
export const DoFastRequestType = new RequestType<IDoFastParam, Fast, void>('api/fast');
|
||||
export const UpdateFastRequestType = new RequestType<IDoFastParam, Fast, void>('api/update-fast');
|
||||
|
||||
export interface ITextDocumentItem {
|
||||
uri: vscode.Uri,
|
||||
|
@ -2,6 +2,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { AbsPath, RelPath } from '../global';
|
||||
import { HdlLangID } from '../global/enum';
|
||||
|
||||
interface Position {
|
||||
// row/line of the cursor, index from 0
|
||||
@ -191,6 +192,18 @@ interface CommentResult {
|
||||
length: number
|
||||
}
|
||||
|
||||
interface Fast {
|
||||
content: RawHdlModule[]
|
||||
languageId: string
|
||||
macro: Macro
|
||||
}
|
||||
|
||||
interface All {
|
||||
content: RawSymbol[]
|
||||
languageId: HdlLangID
|
||||
macro: Macro
|
||||
error: Error[]
|
||||
}
|
||||
|
||||
export {
|
||||
Position,
|
||||
@ -212,5 +225,7 @@ export {
|
||||
HdlDependence,
|
||||
RawSymbol,
|
||||
CommentResult,
|
||||
makeVscodePosition
|
||||
makeVscodePosition,
|
||||
Fast,
|
||||
All
|
||||
};
|
@ -8,7 +8,6 @@ import { MainOutput, ReportType } from '../global/outputChannel';
|
||||
import * as common from './common';
|
||||
import { hdlFile, hdlPath } from '../hdlFs';
|
||||
import { HdlSymbol } from './util';
|
||||
import { Fast, vhdlFast } from '../../resources/hdlParser';
|
||||
|
||||
class HdlParam {
|
||||
private readonly topModules : Set<HdlModule> = new Set<HdlModule>();
|
||||
@ -365,7 +364,7 @@ class HdlParam {
|
||||
}
|
||||
}
|
||||
|
||||
public updateFast(path: string, fast: Fast) {
|
||||
public updateFast(path: string, fast: common.Fast) {
|
||||
const moduleFile = this.getHdlFile(path);
|
||||
if (moduleFile === undefined) {
|
||||
return;
|
||||
|
@ -1,10 +1,11 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { Fast, vlogAll, vhdlAll, svAll, All } from '../../resources/hdlParser';
|
||||
import { hdlFile } from '../hdlFs';
|
||||
import { HdlLangID } from '../global/enum';
|
||||
import { AbsPath, LspClient } from '../global';
|
||||
import { DoFastRequestType, ITextDocumentItem, CustomParamRequestType } from '../global/lsp';
|
||||
import { RawHdlModule } from './common';
|
||||
import { DoFastRequestType, ITextDocumentItem, CustomParamRequestType, UpdateFastRequestType } from '../global/lsp';
|
||||
import { Fast, RawHdlModule } from './common';
|
||||
|
||||
|
||||
|
||||
async function doFastApi(path: string): Promise<Fast | undefined> {
|
||||
try {
|
||||
@ -22,20 +23,22 @@ async function doFastApi(path: string): Promise<Fast | undefined> {
|
||||
}
|
||||
}
|
||||
|
||||
async function vlogFast(path: string): Promise<Fast | undefined> {
|
||||
const fast = await doFastApi(path);
|
||||
return fast;
|
||||
async function updateFastApi(path: string): Promise<Fast | undefined> {
|
||||
try {
|
||||
const client = LspClient.DigitalIDE;
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
if (client) {
|
||||
const response = await client.sendRequest(UpdateFastRequestType, { path });
|
||||
response.languageId = langID;
|
||||
return response;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("error happen when run doFastApi, " + error);
|
||||
console.error("error file path: " + path);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async function svFast(path: string): Promise<Fast | undefined> {
|
||||
const fast = await doFastApi(path);
|
||||
return fast;
|
||||
}
|
||||
|
||||
async function vhdlFast(path: string): Promise<Fast | undefined> {
|
||||
const fast = await doFastApi(path);
|
||||
return fast;
|
||||
}
|
||||
|
||||
namespace HdlSymbol {
|
||||
/**
|
||||
@ -46,24 +49,21 @@ namespace HdlSymbol {
|
||||
export function fast(path: AbsPath): Promise<Fast | undefined> {
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
switch (langID) {
|
||||
case HdlLangID.Verilog: return vlogFast(path);
|
||||
case HdlLangID.Vhdl: return vhdlFast(path);
|
||||
case HdlLangID.SystemVerilog: return svFast(path);
|
||||
case HdlLangID.Verilog:
|
||||
case HdlLangID.Vhdl:
|
||||
case HdlLangID.SystemVerilog:
|
||||
return doFastApi(path);
|
||||
default: return new Promise(resolve => resolve(undefined));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 0.4.0 后丢弃
|
||||
* @param path 文件绝对路径
|
||||
* @returns
|
||||
*/
|
||||
export function all(path: AbsPath): Promise<All | undefined> {
|
||||
export function updateFast(path: AbsPath): Promise<Fast | undefined> {
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
switch (langID) {
|
||||
case HdlLangID.Verilog: return vlogAll(path);
|
||||
case HdlLangID.Vhdl: return vhdlAll(path);
|
||||
case HdlLangID.SystemVerilog: return svAll(path);
|
||||
case HdlLangID.Verilog:
|
||||
case HdlLangID.Vhdl:
|
||||
case HdlLangID.SystemVerilog:
|
||||
return updateFastApi(path);
|
||||
default: return new Promise(resolve => resolve(undefined));
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import { prjManage } from '../manager';
|
||||
import { libManage } from '../manager/lib';
|
||||
import type { HdlMonitor } from './index';
|
||||
import { HdlLangID, ToolChainType } from '../global/enum';
|
||||
import { hdlSymbolStorage } from '../function/lsp/core';
|
||||
import { vlogLinterManager, vhdlLinterManager, svlogLinterManager } from '../function/lsp/linter';
|
||||
|
||||
enum Event {
|
||||
@ -71,7 +70,6 @@ class HdlAction extends BaseAction {
|
||||
console.log('HdlAction add', path);
|
||||
|
||||
path = hdlPath.toSlash(path);
|
||||
|
||||
this.updateLinter(path);
|
||||
|
||||
// check if it has been created
|
||||
@ -92,7 +90,7 @@ class HdlAction extends BaseAction {
|
||||
// operation to process unlink of hdl files can be deleted in <processLibFiles>
|
||||
path = hdlPath.toSlash(path);
|
||||
hdlParam.deleteHdlFile(path);
|
||||
console.log(hdlParam);
|
||||
|
||||
refreshArchTree();
|
||||
|
||||
const uri = vscode.Uri.file(path);
|
||||
@ -119,22 +117,14 @@ 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
|
||||
if (langID === HdlLangID.Vhdl) {
|
||||
await this.updateSymbolStorage(path);
|
||||
await this.updateHdlParam(path);
|
||||
}
|
||||
await this.updateHdlParam(path);
|
||||
await this.updateLinter(path);
|
||||
|
||||
refreshArchTree();
|
||||
}
|
||||
|
||||
async updateSymbolStorage(path: string) {
|
||||
hdlSymbolStorage.updateSymbol(path);
|
||||
}
|
||||
|
||||
// 下一个版本丢弃,完全由后端承担这部分功能
|
||||
async updateLinter(path: string) {
|
||||
const uri = vscode.Uri.file(path);
|
||||
const document = await vscode.workspace.openTextDocument(uri);
|
||||
@ -156,7 +146,9 @@ class HdlAction extends BaseAction {
|
||||
return;
|
||||
}
|
||||
|
||||
const fast = await HdlSymbol.fast(path);
|
||||
const fast = await HdlSymbol.updateFast(path);
|
||||
console.log('get update fast');
|
||||
|
||||
if (!fast) {
|
||||
// vscode.window.showErrorMessage('error happen when parse ' + path + '\nFail to update');
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user