merge
This commit is contained in:
commit
87e49a0bff
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,4 +10,4 @@ out-js/
|
||||
*.pyd
|
||||
resources/hdlParser/parser.js
|
||||
resources/hdlParser/parser.wasm
|
||||
resources/dide-viewer/view/
|
||||
resources/dide-viewer/view/*
|
@ -566,21 +566,21 @@ img {
|
||||
.diagram-container .digrame-port-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 60px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.diagram-container .i-port-name {
|
||||
font-size: 20px;
|
||||
font-size: 16px;
|
||||
padding: 3px 8px;
|
||||
}
|
||||
|
||||
.diagram-container .o-port-name {
|
||||
font-size: 20px;
|
||||
font-size: 16px;
|
||||
padding: 3px 8px;
|
||||
}
|
||||
|
||||
.diagram-container .io-port-name {
|
||||
font-size: 20px;
|
||||
font-size: 16px;
|
||||
padding: 3px 8px;
|
||||
|
||||
}
|
||||
@ -600,7 +600,7 @@ img {
|
||||
}
|
||||
|
||||
.diagram-container .arrow-wrapper {
|
||||
height: 60px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.diagram-container .port-width-left-caption {
|
||||
|
10
package.json
10
package.json
@ -693,6 +693,11 @@
|
||||
"when": "resourceLangId == vhdl",
|
||||
"command": "digital-ide.vhdl2vlog",
|
||||
"group": "navigation@9"
|
||||
},
|
||||
{
|
||||
"when": "resourceLangId == verilog || resourceLangId == systemverilog || resourceLangId == vhdl",
|
||||
"command": "digital-ide.hdlDoc.exportFile",
|
||||
"group": "navigation@10"
|
||||
}
|
||||
],
|
||||
"explorer/context": [
|
||||
@ -735,6 +740,11 @@
|
||||
"when": "resourceLangId == vhdl",
|
||||
"command": "digital-ide.vhdl2vlog",
|
||||
"group": "navigation@12"
|
||||
},
|
||||
{
|
||||
"when": "resourceLangId == verilog || resourceLangId == systemverilog || resourceLangId == vhdl",
|
||||
"command": "digital-ide.hdlDoc.exportFile",
|
||||
"group": "navigation@13"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -28,8 +28,8 @@
|
||||
"digital-ide.hard.gui.title": "打开界面",
|
||||
"digital-ide.hard.exit.title": "退出当前项目",
|
||||
"digital-ide.pickLibrary.title": "从自定义选择自由和普遍",
|
||||
"digital-ide.pl.setSrcTop.title": "设置为 源文件(src)的顶层文件",
|
||||
"digital-ide.pl.setSimTop.title": "设置为 测试文件(sim) 的顶层文件",
|
||||
"digital-ide.pl.setSrcTop.title": "设置为 src 的顶层文件",
|
||||
"digital-ide.pl.setSimTop.title": "设置为 sim 的顶层文件",
|
||||
"digital-ide.pl.addDevice.title": "添加 device",
|
||||
"digital-ide.pl.delDevice.title": "删除 device",
|
||||
"digital-ide.pl.addFile.title": "添加文件",
|
||||
|
1
resources/dide-viewer/index.js
Normal file
1
resources/dide-viewer/index.js
Normal file
@ -0,0 +1 @@
|
||||
// require view folder
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -52,7 +52,14 @@ function catString(...strings: string[]): string {
|
||||
return strings.join('');
|
||||
}
|
||||
|
||||
const ThemeColorConfig : { specify: undefined | ThemeType } = {
|
||||
specify: undefined
|
||||
};
|
||||
|
||||
function getThemeColorKind(): ThemeType {
|
||||
if (ThemeColorConfig.specify !== undefined) {
|
||||
return ThemeColorConfig.specify;
|
||||
}
|
||||
const currentColorKind = vscode.window.activeColorTheme.kind;
|
||||
if (currentColorKind === vscode.ColorThemeKind.Dark ||
|
||||
currentColorKind === vscode.ColorThemeKind.HighContrast) {
|
||||
@ -175,7 +182,7 @@ abstract class RenderString {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
abstract render(): string;
|
||||
abstract render(userStyle?: ThemeType): string;
|
||||
}
|
||||
|
||||
interface MarkdownStringValue {
|
||||
@ -328,8 +335,8 @@ async function getWavedromsFromFile(path: string): Promise<WavedromString[] | un
|
||||
|
||||
const fileStream = fs.createReadStream(path, 'utf-8');
|
||||
const rl = readline.createInterface({
|
||||
input: fileStream,
|
||||
crlfDelay: Infinity
|
||||
input: fileStream,
|
||||
crlfDelay: Infinity
|
||||
});
|
||||
|
||||
for await (const line of rl) {
|
||||
@ -390,5 +397,6 @@ export {
|
||||
makeWaveDromSVG,
|
||||
getWavedromsFromFile,
|
||||
getThemeColorKind,
|
||||
Count
|
||||
Count,
|
||||
ThemeColorConfig
|
||||
};
|
@ -6,7 +6,8 @@ import { hdlFile, hdlPath } from "../../hdlFs";
|
||||
import { HdlModuleParam, HdlModulePort, HdlModulePortType } from "../../hdlParser/common";
|
||||
import { getThemeColorKind } from "./common";
|
||||
|
||||
const arrowSvgCache: Record<string, string> = {
|
||||
|
||||
const lightArrowSvgCache: Record<string, string> = {
|
||||
'left': '',
|
||||
'right': '',
|
||||
'left-right': '',
|
||||
@ -14,10 +15,21 @@ const arrowSvgCache: Record<string, string> = {
|
||||
'right-dot': ''
|
||||
};
|
||||
|
||||
const darkArrowSvgCache: Record<string, string> = {
|
||||
'left': '',
|
||||
'right': '',
|
||||
'left-right': '',
|
||||
'left-dot': '',
|
||||
'right-dot': ''
|
||||
};
|
||||
|
||||
|
||||
function getArrowSvgString(name: 'left' | 'right' | 'left-right' | 'left-dot' | 'right-dot'): string {
|
||||
const themeType = getThemeColorKind();
|
||||
const arrowSvgCache = (themeType === ThemeType.Light) ? lightArrowSvgCache: darkArrowSvgCache;
|
||||
|
||||
let svgString = arrowSvgCache[name];
|
||||
if (svgString.length === 0) {
|
||||
const themeType = getThemeColorKind();
|
||||
const iconFile = name + '-arrow.svg';
|
||||
const svgDir = hdlPath.join(opeParam.extensionPath, 'images', 'svg');
|
||||
const svgPath = hdlPath.join(svgDir, themeType, iconFile);
|
||||
|
@ -4,9 +4,10 @@ import * as fs from 'fs';
|
||||
|
||||
import { opeParam, MainOutput, AbsPath } from '../../global';
|
||||
|
||||
import { Count, MarkdownString, WavedromString } from './common';
|
||||
import { Count, MarkdownString, ThemeColorConfig, WavedromString } from './common';
|
||||
import { getRenderList, getCurrentRenderList } from './markdown';
|
||||
import { hdlPath, hdlIcon, hdlFile } from '../../hdlFs';
|
||||
import { ThemeType } from '../../global/enum';
|
||||
|
||||
const _cache = {
|
||||
css : ''
|
||||
@ -102,15 +103,17 @@ function makeWavedromRenderErrorHTML() {
|
||||
* @description make the html string of a finial display style
|
||||
* @param usage in whick module is used
|
||||
*/
|
||||
async function makeShowHTML(usage: string): Promise<string> {
|
||||
async function makeShowHTML(usage: 'webview' | 'pdf' | 'html' | 'markdown'): Promise<string> {
|
||||
// start to render the real html
|
||||
let body = '';
|
||||
const userStyle = (usage === 'webview' || usage === 'markdown') ? undefined : ThemeType.Light;
|
||||
ThemeColorConfig.specify = userStyle;
|
||||
|
||||
const renderList = await getCurrentRenderList();
|
||||
if (!renderList || renderList.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// start to render the real html
|
||||
let body = '';
|
||||
|
||||
for (const r of renderList) {
|
||||
const renderResult = r.render();
|
||||
if (renderResult) {
|
||||
@ -134,6 +137,8 @@ async function makeShowHTML(usage: string): Promise<string> {
|
||||
cssString = cssString.replace(/\.vscode-light/g, '#write');
|
||||
}
|
||||
const html = makeFinalHTML(body, cssString);
|
||||
ThemeColorConfig.specify = undefined;
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import { MarkdownString, RenderString, RenderType,
|
||||
import { hdlPath, hdlFile } from '../../hdlFs';
|
||||
|
||||
import { getSymbolComments } from '../lsp/util/feature';
|
||||
import { HdlLangID } from '../../global/enum';
|
||||
import { HdlLangID, ThemeType } from '../../global/enum';
|
||||
import { makeDiagram } from './diagram';
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ async function getDocsFromModule(module: HdlModule): Promise<MarkdownString> {
|
||||
|
||||
const infos = [
|
||||
`**File:** ${fspath.basename(module.file.path)}`,
|
||||
`${portNum} params, ${paramNum} ports`,
|
||||
`${paramNum} params, ${portNum} ports`,
|
||||
'top module ' + topModuleDesc
|
||||
];
|
||||
md.addUnorderedList(infos);
|
||||
@ -151,7 +151,7 @@ async function getDocsFromModule(module: HdlModule): Promise<MarkdownString> {
|
||||
makeTableFromObjArray(md, module.ports, 'ports',
|
||||
['name', 'type', 'width', 'desc'],
|
||||
['Port Name', 'Direction', 'Range', 'Description']);
|
||||
md.addEnter();
|
||||
md.addEnter();
|
||||
|
||||
|
||||
// dependency section
|
||||
|
@ -99,6 +99,10 @@ async function exportCurrentFileDocAsPDF() {
|
||||
fs.writeFileSync(tempHtmlPath, html);
|
||||
await htmlFile2PdfFile(tempHtmlPath, pdfPath);
|
||||
hdlFile.rmSync(tempHtmlPath);
|
||||
|
||||
// 在当前编辑器中打开生成的 pdf
|
||||
vscode.window.showInformationMessage('pdf generated at ' + pdfPath);
|
||||
|
||||
} catch (error) {
|
||||
MainOutput.report("error happen in export pdf: " + error, ReportType.Error);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user