上线新的后端
This commit is contained in:
parent
b16595bd81
commit
5cafbc67a6
@ -51,7 +51,7 @@ async function callParser(path, func) {
|
||||
// console.log(res);
|
||||
|
||||
debug.compute += Date.now() - s3;
|
||||
console.log(path, debug);
|
||||
// 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})`);
|
||||
|
@ -12,8 +12,6 @@ import * as lspClient from './function/lsp-client';
|
||||
|
||||
|
||||
async function registerCommand(context: vscode.ExtensionContext) {
|
||||
manager.registerManagerCommands(context);
|
||||
|
||||
func.registerFunctionCommands(context);
|
||||
func.registerLsp(context);
|
||||
func.registerToolCommands(context);
|
||||
@ -28,15 +26,25 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
||||
|
||||
|
||||
async function launch(context: vscode.ExtensionContext) {
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: 'Register Command (Digtial-IDE)'
|
||||
}, async () => {
|
||||
await registerCommand(context);
|
||||
});
|
||||
|
||||
await vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Window,
|
||||
title: 'Initialization (Digtial-IDE)'
|
||||
}, async () => {
|
||||
await manager.prjManage.initialise(context);
|
||||
await registerCommand(context);
|
||||
manager.registerManagerCommands(context);
|
||||
|
||||
hdlMonitor.start();
|
||||
});
|
||||
|
||||
|
||||
|
||||
MainOutput.report('Digital-IDE has launched, Version: 0.3.3', ReportType.Launch);
|
||||
MainOutput.report('OS: ' + opeParam.os, ReportType.Launch);
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { LanguageClient, RequestType, ProtocolConnection } from 'vscode-languageclient/node';
|
||||
import { Fast } from '../../resources/hdlParser';
|
||||
|
||||
|
||||
interface IDigitalIDELspClient {
|
||||
@ -11,4 +13,29 @@ export const LspClient: IDigitalIDELspClient = {
|
||||
VhdlClient: undefined
|
||||
};
|
||||
|
||||
export const CustomRequestType = new RequestType<string[], void, void>('custom/request');
|
||||
/**
|
||||
* @description 构造请求参数
|
||||
* RequestType<P, R, E, RO>
|
||||
* P: 请求的参数类型。
|
||||
* R: 请求的响应类型。
|
||||
* E: 请求的错误类型。
|
||||
* RO: 请求的可选参数类型。
|
||||
*/
|
||||
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('api/fast');
|
||||
|
||||
export interface ITextDocumentItem {
|
||||
uri: vscode.Uri,
|
||||
languageId: string,
|
||||
version: number,
|
||||
text: string
|
||||
}
|
||||
|
||||
export interface ICommonParam {
|
||||
param: string
|
||||
}
|
||||
|
||||
export interface IDoFastParam {
|
||||
|
||||
}
|
@ -227,10 +227,9 @@ class HdlParam {
|
||||
|
||||
private async doHdlFast(path: AbsPath) {
|
||||
try {
|
||||
// TODO: make this quick
|
||||
const fast = await HdlSymbol.fast(path);
|
||||
const fast = await HdlSymbol.fast(path);
|
||||
if (fast) {
|
||||
const languageId = this.alignLanguageId(fast.languageId);
|
||||
const languageId = hdlFile.getLanguageId(path);
|
||||
new HdlFile(path,
|
||||
languageId,
|
||||
fast.macro,
|
||||
@ -248,13 +247,12 @@ class HdlParam {
|
||||
}
|
||||
}
|
||||
|
||||
public async initialize(hdlFiles: AbsPath[] | Generator<AbsPath>) {
|
||||
public async initialize(hdlFiles: AbsPath[] | Generator<AbsPath>) {
|
||||
await this.initHdlFiles(hdlFiles);
|
||||
|
||||
// await this.initHdlFiles(hdlFiles);
|
||||
|
||||
// for (const hdlFile of this.getAllHdlFiles()) {
|
||||
// hdlFile.makeInstance();
|
||||
// }
|
||||
for (const hdlFile of this.getAllHdlFiles()) {
|
||||
hdlFile.makeInstance();
|
||||
}
|
||||
}
|
||||
|
||||
public getTopModulesByType(type: string): HdlModule[] {
|
||||
|
@ -1,9 +1,53 @@
|
||||
import { Fast, vlogAll, vlogFast, vhdlAll, svFast, svAll, vhdlFast, All } from '../../resources/hdlParser';
|
||||
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 } from '../global';
|
||||
import { AbsPath, LspClient } from '../global';
|
||||
import { DoFastRequestType, ITextDocumentItem, CustomParamRequestType } from '../global/lsp';
|
||||
import { RawHdlModule } from './common';
|
||||
|
||||
async function doFastApi(path: string): Promise<Fast | undefined> {
|
||||
try {
|
||||
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: []
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("error happen when run doFastApi, " + error);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async function vlogFast(path: string): Promise<Fast | undefined> {
|
||||
const fast = await doFastApi(path);
|
||||
return fast;
|
||||
}
|
||||
|
||||
async function svFast(path: string): Promise<Fast | undefined> {
|
||||
const fast = await doFastApi(path);
|
||||
return fast;
|
||||
}
|
||||
|
||||
namespace HdlSymbol {
|
||||
/**
|
||||
* @description 计算出模块级的信息
|
||||
* @param path 文件绝对路径
|
||||
* @returns
|
||||
*/
|
||||
export function fast(path: AbsPath): Promise<Fast | undefined> {
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
switch (langID) {
|
||||
@ -14,6 +58,11 @@ namespace HdlSymbol {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 0.4.0 后丢弃
|
||||
* @param path 文件绝对路径
|
||||
* @returns
|
||||
*/
|
||||
export function all(path: AbsPath): Promise<All | undefined> {
|
||||
const langID = hdlFile.getLanguageId(path);
|
||||
switch (langID) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user