import * as vscode from 'vscode'; import { Fast, vlogAll, vhdlAll, svAll, vhdlFast, 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'; async function doFastApi(path: string): Promise { try { const client = LspClient.MainClient; const langID = hdlFile.getLanguageId(path); if (client) { console.log(client.initializeResult); const response = await client.sendRequest(DoFastRequestType, { 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 vlogFast(path: string): Promise { const fast = await doFastApi(path); return fast; } async function svFast(path: string): Promise { const fast = await doFastApi(path); return fast; } namespace HdlSymbol { /** * @description 计算出模块级的信息 * @param path 文件绝对路径 * @returns */ export function fast(path: AbsPath): Promise { 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); default: return new Promise(resolve => resolve(undefined)); } } /** * @description 0.4.0 后丢弃 * @param path 文件绝对路径 * @returns */ export function all(path: AbsPath): Promise { 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); default: return new Promise(resolve => resolve(undefined)); } } } export { HdlSymbol, };