add linter selection
This commit is contained in:
parent
b5550a2104
commit
e504d0450e
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,4 +9,5 @@ parser_stuck.v
|
|||||||
out-js/
|
out-js/
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyd
|
*.pyd
|
||||||
*.wasm
|
resources/hdlParser/parser.js
|
||||||
|
resources/hdlParser/parser.wasm
|
@ -14,11 +14,12 @@ Bug 修复
|
|||||||
|
|
||||||
Change
|
Change
|
||||||
- 将插件的工作状态显示在 vscode 下侧的状态栏上,利于用户了解目前的设置状态
|
- 将插件的工作状态显示在 vscode 下侧的状态栏上,利于用户了解目前的设置状态
|
||||||
|
- 状态栏右下角现在可以看到目前选择的linter以及是否正常工作了
|
||||||
- 优化项目配置目录
|
- 优化项目配置目录
|
||||||
|
|
||||||
Feature
|
Feature
|
||||||
- 增加对 XDC,TCL 等脚本的 LSP 支持
|
- 增加对 XDC,TCL 等脚本的 LSP 支持
|
||||||
- 增加 verilog, vhdl, xdc, tcl, vvp 等语言的工作区图标
|
- 增加 verilog, vhdl, xdc, tcl, vvp, vcd 等语言或生成文件的工作区图标
|
||||||
- 增加对于 vivado, modelsim, verilator 的支持,用户可以通过设置 `function.lsp.linter.vhdl.diagnostor`(设置 vhdl) 和 `function.lsp.linter.vlog.diagnostor`(设置 verilog) 来使用这些第三方工具的仿真和自动纠错。
|
- 增加对于 vivado, modelsim, verilator 的支持,用户可以通过设置 `function.lsp.linter.vhdl.diagnostor`(设置 vhdl) 和 `function.lsp.linter.vlog.diagnostor`(设置 verilog) 来使用这些第三方工具的仿真和自动纠错。
|
||||||
- 增加对于 TCL, XDC, VVP 等脚本的 LSP 和 语法高亮 支持
|
- 增加对于 TCL, XDC, VVP 等脚本的 LSP 和 语法高亮 支持
|
||||||
|
|
||||||
|
1
images/svg/dark/vcd.svg
Normal file
1
images/svg/dark/vcd.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1701098079075" class="icon" viewBox="0 0 1280 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7655" xmlns:xlink="http://www.w3.org/1999/xlink" width="250" height="200"><path d="M256 128c0-35.4 28.6-64 64-64h320c35.4 0 64 28.6 64 64v704h192V512c0-35.4 28.6-64 64-64h256c35.4 0 64 28.6 64 64s-28.6 64-64 64h-192v320c0 35.4-28.6 64-64 64H640c-35.4 0-64-28.6-64-64V192h-192v320c0 35.4-28.6 64-64 64H64c-35.4 0-64-28.6-64-64s28.6-64 64-64h192V128z" p-id="7656" fill="#4CAF50"></path></svg>
|
After Width: | Height: | Size: 640 B |
1
images/svg/light/vcd.svg
Normal file
1
images/svg/light/vcd.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1701098079075" class="icon" viewBox="0 0 1280 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7655" xmlns:xlink="http://www.w3.org/1999/xlink" width="250" height="200"><path d="M256 128c0-35.4 28.6-64 64-64h320c35.4 0 64 28.6 64 64v704h192V512c0-35.4 28.6-64 64-64h256c35.4 0 64 28.6 64 64s-28.6 64-64 64h-192v320c0 35.4-28.6 64-64 64H640c-35.4 0-64-28.6-64-64V192h-192v320c0 35.4-28.6 64-64 64H64c-35.4 0-64-28.6-64-64s28.6-64 64-64h192V128z" p-id="7656" fill="#4CAF50"></path></svg>
|
After Width: | Height: | Size: 640 B |
10718
package-lock.json
generated
10718
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@ -4,7 +4,7 @@
|
|||||||
"description": "all in one vscode plugin for Verilog/VHDL development",
|
"description": "all in one vscode plugin for Verilog/VHDL development",
|
||||||
"publisher": "sterben",
|
"publisher": "sterben",
|
||||||
"homepage": "https://digital-eda.github.io/DIDE-doc-Cn",
|
"homepage": "https://digital-eda.github.io/DIDE-doc-Cn",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"main": "./out/extension",
|
"main": "./out/extension",
|
||||||
"icon": "images/icon.png",
|
"icon": "images/icon.png",
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -494,6 +494,21 @@
|
|||||||
"title": "%digital-ide.lsp.tool.transformOldPropertyFile.title%",
|
"title": "%digital-ide.lsp.tool.transformOldPropertyFile.title%",
|
||||||
"category": "Digital-IDE"
|
"category": "Digital-IDE"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.lsp.vlog.linter.pick",
|
||||||
|
"category": "Digital-IDE",
|
||||||
|
"title": "%digital-ide.lsp.vlog.linter.pick.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.lsp.vhdl.linter.pick",
|
||||||
|
"category": "Digital-IDE",
|
||||||
|
"title": "%digital-ide.lsp.vhdl.linter.pick.title%"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "digital-ide.lsp.systemverilog.linter.pick",
|
||||||
|
"category": "Digital-IDE",
|
||||||
|
"title": "%digital-ide.lsp.systemverilog.linter.pick.title%"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "digital-ide.vhdl2vlog",
|
"command": "digital-ide.vhdl2vlog",
|
||||||
"title": "%digital-ide.vhdl2vlog.title%",
|
"title": "%digital-ide.vhdl2vlog.title%",
|
||||||
@ -829,7 +844,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": [
|
"extensions": [
|
||||||
".vvp",
|
".vvp",
|
||||||
".VVP"
|
".VVP",
|
||||||
|
".v.out"
|
||||||
],
|
],
|
||||||
"configuration": "./config/vvp.configuration.json",
|
"configuration": "./config/vvp.configuration.json",
|
||||||
"icon": {
|
"icon": {
|
||||||
@ -837,6 +853,16 @@
|
|||||||
"light": "./images/svg/light/vvp.svg"
|
"light": "./images/svg/light/vvp.svg"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "vcd",
|
||||||
|
"extensions": [
|
||||||
|
".vcd"
|
||||||
|
],
|
||||||
|
"icon": {
|
||||||
|
"dark": "./images/svg/dark/vcd.svg",
|
||||||
|
"light": "./images/svg/light/vcd.svg"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "digital-ide-output",
|
"id": "digital-ide-output",
|
||||||
"mimetypes": [
|
"mimetypes": [
|
||||||
|
@ -40,5 +40,8 @@
|
|||||||
"digital-ide.lsp.tool.transformOldPropertyFile.title": "Transform configure file from previous version to new version",
|
"digital-ide.lsp.tool.transformOldPropertyFile.title": "Transform configure file from previous version to new version",
|
||||||
"digital-ide.vhdl2vlog.title": "Translate vhdl code to verilog code",
|
"digital-ide.vhdl2vlog.title": "Translate vhdl code to verilog code",
|
||||||
"digital-ide.fsm.show.title": "Show FSM graph of current file",
|
"digital-ide.fsm.show.title": "Show FSM graph of current file",
|
||||||
"digital-ide.netlist.show.title": "Show netlist of current file"
|
"digital-ide.netlist.show.title": "Show netlist of current file",
|
||||||
|
"digital-ide.lsp.vlog.linter.pick.title": "select a diagnostic for verilog",
|
||||||
|
"digital-ide.lsp.vhdl.linter.pick.title": "select a diagnostic for vhdl",
|
||||||
|
"digital-ide.lsp.systemverilog.linter.pick.title": "select a diagnostic for systemverilog"
|
||||||
}
|
}
|
@ -40,5 +40,8 @@
|
|||||||
"digital-ide.lsp.tool.transformOldPropertyFile.title": "转换配置文件从先前版本新版本",
|
"digital-ide.lsp.tool.transformOldPropertyFile.title": "转换配置文件从先前版本新版本",
|
||||||
"digital-ide.vhdl2vlog.title": "vhdl代码翻译为verilog代码",
|
"digital-ide.vhdl2vlog.title": "vhdl代码翻译为verilog代码",
|
||||||
"digital-ide.fsm.show.title": "显示当前文件的FSM图",
|
"digital-ide.fsm.show.title": "显示当前文件的FSM图",
|
||||||
"digital-ide.netlist.show.title": "显示当前文件的netlist"
|
"digital-ide.netlist.show.title": "显示当前文件的netlist",
|
||||||
|
"digital-ide.lsp.vlog.linter.pick.title": "选择 Verilog 的诊断",
|
||||||
|
"digital-ide.lsp.vhdl.linter.pick.title": "选择 VHDL 的诊断",
|
||||||
|
"digital-ide.lsp.systemverilog.linter.pick.title": "选择 SystemVerilog 的诊断"
|
||||||
}
|
}
|
@ -40,5 +40,8 @@
|
|||||||
"digital-ide.lsp.tool.transformOldPropertyFile.title": "轉換配置文件從先前版本新版本",
|
"digital-ide.lsp.tool.transformOldPropertyFile.title": "轉換配置文件從先前版本新版本",
|
||||||
"digital-ide.vhdl2vlog.title": "vhdl代碼翻譯為verilog代碼",
|
"digital-ide.vhdl2vlog.title": "vhdl代碼翻譯為verilog代碼",
|
||||||
"digital-ide.fsm.show.title": "顯示當前文件的FSM圖",
|
"digital-ide.fsm.show.title": "顯示當前文件的FSM圖",
|
||||||
"digital-ide.netlist.show.title": "顯示當前文件的netlist"
|
"digital-ide.netlist.show.title": "顯示當前文件的netlist",
|
||||||
|
"digital-ide.lsp.vlog.linter.pick.title": "選擇 Verilog 的診斷",
|
||||||
|
"digital-ide.lsp.vhdl.linter.pick.title": "選擇 VHDL 的診斷",
|
||||||
|
"digital-ide.lsp.systemverilog.linter.pick.title": "選擇 SystemVerilog 的診斷"
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@ -1,36 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
function* walk(path, ext) {
|
|
||||||
if (fs.lstatSync(path).isFile()) {
|
|
||||||
if (path.endsWith(ext)) {
|
|
||||||
yield path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (const file of fs.readdirSync(path)) {
|
|
||||||
const stat = fs.lstatSync(path);
|
|
||||||
const filePath = fspath.join(path, file);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
for (const targetPath of walk(filePath, ext)) {
|
|
||||||
yield targetPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (stat.isFile()) {
|
|
||||||
if (filePath.endsWith(ext)) {
|
|
||||||
yield filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function test(context) {
|
|
||||||
if (vscode.workspace.workspaceFolders !== undefined &&
|
|
||||||
vscode.workspace.workspaceFolders.length !== 0) {
|
|
||||||
const wsPath = hdlPath.toSlash(vscode.workspace.workspaceFolders[0].uri.fsPath);
|
|
||||||
for (const file of walk(wsPath, '.v')) {
|
|
||||||
if (typeof file === 'string') {
|
|
||||||
const fast = await vlogFast(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=testMain.js.map
|
|
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"testMain.js","sourceRoot":"","sources":["testMain.ts"],"names":[],"mappings":";AACA,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAa,EAAE,GAAW;IACrC,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACpB,MAAM,IAAI,CAAC;SACd;KACJ;SAAM;QACH,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACrC,MAAM,IAAI,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACzC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;gBACpB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;oBAC1C,MAAM,UAAU,CAAC;iBACpB;aACJ;iBAAM,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;gBACtB,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBACxB,MAAM,QAAQ,CAAC;iBAClB;aACJ;SACJ;KACJ;AACL,CAAC;AAGD,KAAK,UAAU,IAAI,CAAC,OAAgC;IAChD,IAAI,MAAM,CAAC,SAAS,CAAC,gBAAgB,KAAK,SAAS;QAC/C,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YACnC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC1B,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;aACrC;SACJ;KACJ;AACL,CAAC"}
|
|
@ -1,35 +0,0 @@
|
|||||||
|
|
||||||
function* walk(path: AbsPath, ext: string): Generator {
|
|
||||||
if (fs.lstatSync(path).isFile()) {
|
|
||||||
if (path.endsWith(ext)) {
|
|
||||||
yield path;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (const file of fs.readdirSync(path)) {
|
|
||||||
const stat = fs.lstatSync(path);
|
|
||||||
const filePath = fspath.join(path, file);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
for (const targetPath of walk(filePath, ext)) {
|
|
||||||
yield targetPath;
|
|
||||||
}
|
|
||||||
} else if (stat.isFile()) {
|
|
||||||
if (filePath.endsWith(ext)) {
|
|
||||||
yield filePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function test(context: vscode.ExtensionContext) {
|
|
||||||
if (vscode.workspace.workspaceFolders !== undefined &&
|
|
||||||
vscode.workspace.workspaceFolders.length !== 0) {
|
|
||||||
const wsPath = hdlPath.toSlash(vscode.workspace.workspaceFolders[0].uri.fsPath);
|
|
||||||
for (const file of walk(wsPath, '.v')) {
|
|
||||||
if (typeof file === 'string') {
|
|
||||||
const fast = await vlogFast(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
const { vlogFast } = require('../../resources/hdlParser');
|
const { vlogFast } = require('../../resources/hdlParser');
|
||||||
|
|
||||||
const testFile = 'c:/Users/11934/Project/Digital-IDE/Digital-Test/Verilog/dependence_test/head_1.v';
|
const testFile = '../Digital-Test/Verilog/dependence_test/head_1.v';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const fast = await vlogFast(testFile);
|
const fast = await vlogFast(testFile);
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as fspath from 'path';
|
|
||||||
|
|
||||||
import { opeParam, MainOutput, AbsPath, ReportType } from './global';
|
import { opeParam, MainOutput, AbsPath, ReportType } from './global';
|
||||||
import { hdlParam } from './hdlParser';
|
import { hdlParam } from './hdlParser';
|
||||||
import * as manager from './manager';
|
import * as manager from './manager';
|
||||||
import * as func from './function';
|
import * as func from './function';
|
||||||
import { hdlMonitor } from './monitor';
|
import { hdlMonitor } from './monitor';
|
||||||
import { hdlPath } from './hdlFs';
|
|
||||||
import { extensionUrl } from '../resources/hdlParser';
|
import { extensionUrl } from '../resources/hdlParser';
|
||||||
|
|
||||||
async function registerCommand(context: vscode.ExtensionContext) {
|
async function registerCommand(context: vscode.ExtensionContext) {
|
||||||
@ -22,14 +19,20 @@ async function registerCommand(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
|
|
||||||
async function launch(context: vscode.ExtensionContext) {
|
async function launch(context: vscode.ExtensionContext) {
|
||||||
await manager.prjManage.initialise(context);
|
|
||||||
await registerCommand(context);
|
|
||||||
hdlMonitor.start();
|
|
||||||
|
|
||||||
MainOutput.report('Digital-IDE has launched, Version: 0.3.0');
|
vscode.window.withProgress({
|
||||||
|
location: vscode.ProgressLocation.Window,
|
||||||
|
title: 'Initialization (Digtial-IDE)'
|
||||||
|
}, async () => {
|
||||||
|
await manager.prjManage.initialise(context);
|
||||||
|
await registerCommand(context);
|
||||||
|
hdlMonitor.start();
|
||||||
|
});
|
||||||
|
|
||||||
|
MainOutput.report('Digital-IDE has launched, Version: 0.3.2');
|
||||||
MainOutput.report('OS: ' + opeParam.os);
|
MainOutput.report('OS: ' + opeParam.os);
|
||||||
|
|
||||||
console.log(hdlParam);
|
// console.log(hdlParam);
|
||||||
|
|
||||||
// show welcome information (if first install)
|
// show welcome information (if first install)
|
||||||
const welcomeSetting = vscode.workspace.getConfiguration('digital-ide.welcome');
|
const welcomeSetting = vscode.workspace.getConfiguration('digital-ide.welcome');
|
||||||
|
@ -95,6 +95,9 @@ function registerLsp(context: vscode.ExtensionContext) {
|
|||||||
lspCore.hdlSymbolStorage.initialise();
|
lspCore.hdlSymbolStorage.initialise();
|
||||||
lspLinter.vlogLinterManager.initialise();
|
lspLinter.vlogLinterManager.initialise();
|
||||||
lspLinter.vhdlLinterManager.initialise();
|
lspLinter.vhdlLinterManager.initialise();
|
||||||
|
|
||||||
|
vscode.commands.registerCommand('digital-ide.lsp.vlog.linter.pick', lspLinter.pickVlogLinter);
|
||||||
|
vscode.commands.registerCommand('digital-ide.lsp.vhdl.linter.pick', lspLinter.pickVhdlLinter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
112
src/function/lsp/linter/command.ts
Normal file
112
src/function/lsp/linter/command.ts
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
import { vivadoLinter } from './vivado';
|
||||||
|
import { modelsimLinter } from './modelsim';
|
||||||
|
import { verilatorLinter } from './verilator';
|
||||||
|
import { HdlLangID } from '../../../global/enum';
|
||||||
|
import { vlogLinterManager } from './vlog';
|
||||||
|
import { vhdlLinterManager } from './vhdl';
|
||||||
|
import { easyExec } from '../../../global/util';
|
||||||
|
|
||||||
|
let _selectVlogLinter: string | null = null;
|
||||||
|
let _selectVhdlLinter: string | null = null;
|
||||||
|
|
||||||
|
interface LinterItem extends vscode.QuickPickItem {
|
||||||
|
name: string
|
||||||
|
available: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
async function makeDefaultPickItem(): Promise<LinterItem> {
|
||||||
|
return {
|
||||||
|
label: '$(getting-started-beginner) default',
|
||||||
|
name: 'default',
|
||||||
|
available: true,
|
||||||
|
description: 'Digital-IDE build in diagnostic tool',
|
||||||
|
detail: 'inner build is ready'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function makeVivadoPickItem(langID: HdlLangID): Promise<LinterItem> {
|
||||||
|
const executablePath = vivadoLinter.getExecutableFilePath(langID);
|
||||||
|
const linterName = vivadoLinter.executableFileMap.get(langID);
|
||||||
|
if (executablePath) {
|
||||||
|
const { stderr } = await easyExec(executablePath, []);
|
||||||
|
if (stderr.length > 0) {
|
||||||
|
return {
|
||||||
|
label: '$(extensions-warning-message) vivado',
|
||||||
|
name: 'vivado',
|
||||||
|
available: false,
|
||||||
|
description: `vivado diagnostic tool ${linterName}`,
|
||||||
|
detail: `${executablePath} is not available`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
label: '$(getting-started-beginner) vivado',
|
||||||
|
name: 'vivado',
|
||||||
|
available: true,
|
||||||
|
description: `vivado diagnostic tool ${linterName}`,
|
||||||
|
detail: `${executablePath} is ready`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function makeModelsimPickItem(langID: HdlLangID): Promise<LinterItem> {
|
||||||
|
const executablePath = modelsimLinter.getExecutableFilePath(langID);
|
||||||
|
const linterName = modelsimLinter.executableFileMap.get(langID);
|
||||||
|
if (executablePath) {
|
||||||
|
const { stderr } = await easyExec(executablePath, []);
|
||||||
|
if (stderr.length > 0) {
|
||||||
|
return {
|
||||||
|
label: '$(extensions-warning-message) modelsim',
|
||||||
|
name: 'modelsim',
|
||||||
|
available: false,
|
||||||
|
description: `modelsim diagnostic tool ${linterName}`,
|
||||||
|
detail: `${executablePath} is not available`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
label: '$(getting-started-beginner) modelsim',
|
||||||
|
name: 'modelsim',
|
||||||
|
available: true,
|
||||||
|
description: `modelsim diagnostic tool ${linterName}`,
|
||||||
|
detail: `${executablePath} is ready`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pickVlogLinter() {
|
||||||
|
const pickWidget = vscode.window.createQuickPick<LinterItem>();
|
||||||
|
pickWidget.placeholder = 'select a linter for code diagnostic';
|
||||||
|
pickWidget.canSelectMany = false;
|
||||||
|
pickWidget.items = [
|
||||||
|
await makeDefaultPickItem(),
|
||||||
|
await makeVivadoPickItem(HdlLangID.Verilog),
|
||||||
|
await makeModelsimPickItem(HdlLangID.Verilog)
|
||||||
|
];
|
||||||
|
|
||||||
|
pickWidget.onDidChangeSelection(items => {
|
||||||
|
const selectedItem = items[0];
|
||||||
|
_selectVlogLinter = selectedItem.name;
|
||||||
|
});
|
||||||
|
|
||||||
|
pickWidget.onDidAccept(() => {
|
||||||
|
if (_selectVlogLinter) {
|
||||||
|
const vlogLspConfig = vscode.workspace.getConfiguration('digital-ide.function.lsp.linter.vlog');
|
||||||
|
vlogLspConfig.update('diagnostor', _selectVlogLinter);
|
||||||
|
pickWidget.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
pickWidget.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pickVhdlLinter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export {
|
||||||
|
pickVlogLinter,
|
||||||
|
pickVhdlLinter
|
||||||
|
};
|
@ -1,8 +1,11 @@
|
|||||||
import { vlogLinterManager } from './vlog';
|
import { vlogLinterManager } from './vlog';
|
||||||
import { vhdlLinterManager } from './vhdl';
|
import { vhdlLinterManager } from './vhdl';
|
||||||
|
|
||||||
|
import { pickVlogLinter, pickVhdlLinter } from './command';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
vlogLinterManager,
|
vlogLinterManager,
|
||||||
vhdlLinterManager
|
vhdlLinterManager,
|
||||||
|
pickVlogLinter,
|
||||||
|
pickVhdlLinter
|
||||||
};
|
};
|
@ -125,7 +125,7 @@ class ModelsimLinter implements BaseLinter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
|
public getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
|
||||||
// modelsim install path stored in prj.modelsim.install.path
|
// modelsim install path stored in prj.modelsim.install.path
|
||||||
const modelsimConfig = vscode.workspace.getConfiguration('digital-ide.prj.modelsim');
|
const modelsimConfig = vscode.workspace.getConfiguration('digital-ide.prj.modelsim');
|
||||||
const modelsimInstallPath = modelsimConfig.get('install.path', '');
|
const modelsimInstallPath = modelsimConfig.get('install.path', '');
|
||||||
@ -167,7 +167,7 @@ class ModelsimLinter implements BaseLinter {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.executableInvokeNameMap.set(langID, undefined);
|
this.executableInvokeNameMap.set(langID, undefined);
|
||||||
LspOutput.report(`fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true);
|
LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ class VerilatorLinter implements BaseLinter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
|
public getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
|
||||||
// verilator install path stored in prj.verilator.install.path
|
// verilator install path stored in prj.verilator.install.path
|
||||||
const verilatorConfig = vscode.workspace.getConfiguration('digital-ide.prj.verilator');
|
const verilatorConfig = vscode.workspace.getConfiguration('digital-ide.prj.verilator');
|
||||||
const verilatorInstallPath = verilatorConfig.get('install.path', '');
|
const verilatorInstallPath = verilatorConfig.get('install.path', '');
|
||||||
@ -146,7 +146,9 @@ class VerilatorLinter implements BaseLinter {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.executableInvokeNameMap.set(langID, undefined);
|
this.executableInvokeNameMap.set(langID, undefined);
|
||||||
LspOutput.report(`fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true);
|
console.log(stderr);
|
||||||
|
|
||||||
|
LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ class VivadoLinter implements BaseLinter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
|
public getExecutableFilePath(langID: HdlLangID): string | Path | undefined {
|
||||||
// vivado install path stored in prj.vivado.install.path
|
// vivado install path stored in prj.vivado.install.path
|
||||||
const vivadoConfig = vscode.workspace.getConfiguration('digital-ide.prj.vivado');
|
const vivadoConfig = vscode.workspace.getConfiguration('digital-ide.prj.vivado');
|
||||||
const vivadoInstallPath = vivadoConfig.get('install.path', '');
|
const vivadoInstallPath = vivadoConfig.get('install.path', '');
|
||||||
@ -164,7 +164,7 @@ class VivadoLinter implements BaseLinter {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
this.executableInvokeNameMap.set(langID, undefined);
|
this.executableInvokeNameMap.set(langID, undefined);
|
||||||
LspOutput.report(`fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true);
|
LspOutput.report(`Fail to execute ${executorPath}! Reason: ${stderr}`, ReportType.Error, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,13 @@ import { defaultVlogLinter } from './default';
|
|||||||
import { modelsimLinter } from './modelsim';
|
import { modelsimLinter } from './modelsim';
|
||||||
import { vivadoLinter } from './vivado';
|
import { vivadoLinter } from './vivado';
|
||||||
import { hdlFile, hdlPath } from '../../../hdlFs';
|
import { hdlFile, hdlPath } from '../../../hdlFs';
|
||||||
|
import { isVerilogFile } from '../../../hdlFs/file';
|
||||||
|
|
||||||
class VlogLinterManager implements BaseManager {
|
class VlogLinterManager implements BaseManager {
|
||||||
currentLinter: BaseLinter | undefined;
|
currentLinter: BaseLinter | undefined;
|
||||||
activateList: Map<string, boolean> = new Map<string, boolean>();
|
activateList: Map<string, boolean> = new Map<string, boolean>();
|
||||||
activateLinterName: string;
|
activateLinterName: string;
|
||||||
|
statusBarItem: vscode.StatusBarItem;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.activateList.set('vivado', false);
|
this.activateList.set('vivado', false);
|
||||||
@ -18,6 +20,24 @@ class VlogLinterManager implements BaseManager {
|
|||||||
this.activateList.set('default', false);
|
this.activateList.set('default', false);
|
||||||
this.activateLinterName = 'default';
|
this.activateLinterName = 'default';
|
||||||
|
|
||||||
|
// make a status bar for rendering
|
||||||
|
this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
||||||
|
this.statusBarItem.command = 'digital-ide.lsp.vlog.linter.pick';
|
||||||
|
|
||||||
|
// when changing file, hide if langID is not verilog
|
||||||
|
vscode.window.onDidChangeActiveTextEditor(editor => {
|
||||||
|
if (!editor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const currentFileName = hdlPath.toSlash(editor.document.fileName);
|
||||||
|
|
||||||
|
if (isVerilogFile(currentFileName)) {
|
||||||
|
this.statusBarItem.show();
|
||||||
|
} else {
|
||||||
|
this.statusBarItem.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// update when user's config is changed
|
// update when user's config is changed
|
||||||
vscode.workspace.onDidChangeConfiguration(() => {
|
vscode.workspace.onDidChangeConfiguration(() => {
|
||||||
const diagnostor = this.getUserDiagnostorSelection();
|
const diagnostor = this.getUserDiagnostorSelection();
|
||||||
@ -27,7 +47,6 @@ class VlogLinterManager implements BaseManager {
|
|||||||
this.updateLinter();
|
this.updateLinter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialise(): Promise<void> {
|
async initialise(): Promise<void> {
|
||||||
@ -75,12 +94,24 @@ class VlogLinterManager implements BaseManager {
|
|||||||
|
|
||||||
if (this.activateList.get('vivado') === false) {
|
if (this.activateList.get('vivado') === false) {
|
||||||
launch = await selectedLinter.initialise(HdlLangID.Verilog);
|
launch = await selectedLinter.initialise(HdlLangID.Verilog);
|
||||||
this.activateList.set('vivado', true);
|
if (launch) {
|
||||||
LspOutput.report('<vlog lsp manager> vivado linter has been activated', ReportType.Info);
|
this.statusBarItem.text = '$(getting-started-beginner) Linter(Vivado)';
|
||||||
|
|
||||||
|
this.activateList.set('vivado', true);
|
||||||
|
LspOutput.report('<vlog lsp manager> vivado linter has been activated', ReportType.Info);
|
||||||
|
} else {
|
||||||
|
this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground');
|
||||||
|
this.statusBarItem.tooltip = 'Fail to launch vivado linter';
|
||||||
|
this.statusBarItem.text = '$(extensions-warning-message) Linter(vivado)';
|
||||||
|
|
||||||
|
LspOutput.report('<vlog lsp manager> Fail to launch vivado linter', ReportType.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentLinter = selectedLinter;
|
this.currentLinter = selectedLinter;
|
||||||
this.activateLinterName = 'vivado';
|
this.activateLinterName = 'vivado';
|
||||||
|
this.statusBarItem.show();
|
||||||
|
|
||||||
return launch;
|
return launch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,12 +121,26 @@ class VlogLinterManager implements BaseManager {
|
|||||||
|
|
||||||
if (this.activateList.get('modelsim') === false) {
|
if (this.activateList.get('modelsim') === false) {
|
||||||
launch = await selectedLinter.initialise(HdlLangID.Verilog);
|
launch = await selectedLinter.initialise(HdlLangID.Verilog);
|
||||||
this.activateList.set('modelsim', true);
|
if (launch) {
|
||||||
LspOutput.report('<vlog lsp manager> modelsim linter has been activated', ReportType.Info);
|
this.statusBarItem.text = '$(getting-started-beginner) Linter(modelsim)';
|
||||||
|
|
||||||
|
this.activateList.set('modelsim', true);
|
||||||
|
LspOutput.report('<vlog lsp manager> modelsim linter has been activated', ReportType.Info);
|
||||||
|
} else {
|
||||||
|
this.statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground');
|
||||||
|
this.statusBarItem.tooltip = 'Fail to launch modelsim linter';
|
||||||
|
this.statusBarItem.text = '$(extensions-warning-message) Linter(modelsim)';
|
||||||
|
|
||||||
|
LspOutput.report('<vlog lsp manager> Fail to launch modelsim linter', ReportType.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentLinter = selectedLinter;
|
this.currentLinter = selectedLinter;
|
||||||
this.activateLinterName = 'modelsim';
|
this.activateLinterName = 'modelsim';
|
||||||
|
this.statusBarItem.show();
|
||||||
|
|
||||||
return launch;
|
return launch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +149,18 @@ class VlogLinterManager implements BaseManager {
|
|||||||
let launch = true;
|
let launch = true;
|
||||||
|
|
||||||
if (this.activateList.get('default') === false) {
|
if (this.activateList.get('default') === false) {
|
||||||
|
if (launch) {
|
||||||
|
this.statusBarItem.text = '$(getting-started-beginner) Linter(default)';
|
||||||
|
|
||||||
this.activateList.set('default', true);
|
this.activateList.set('default', true);
|
||||||
LspOutput.report('<vlog lsp manager> default build-in linter has been activated', ReportType.Info);
|
LspOutput.report('<vlog lsp manager> default build-in linter has been activated', ReportType.Info);
|
||||||
|
} else {
|
||||||
|
this.statusBarItem.backgroundColor = undefined;
|
||||||
|
this.statusBarItem.tooltip = 'Fail to launch default linter';
|
||||||
|
this.statusBarItem.text = '$(extensions-warning-message) Linter(default)';
|
||||||
|
|
||||||
|
LspOutput.report('<vlog lsp manager> Fail to launch default linter', ReportType.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentLinter = selectedLinter;
|
this.currentLinter = selectedLinter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user