This commit is contained in:
CismonX 2020-10-05 02:16:08 +08:00
parent 9fb645a4d1
commit d91cf96895
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
3 changed files with 39 additions and 27 deletions

View File

@ -13,6 +13,27 @@
"type": "git",
"url": "https://github.com/texinfo-lang/vscode-texinfo"
},
"devDependencies": {
"@types/node": "^14.11.2",
"@types/vscode": "^1.49.0",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.10.0",
"typescript": "^4.0.3"
},
"dependencies": {
"cson": "^7.20.0",
"language-texinfo": "^1.0.0",
"node-html-parser": "^1.2.21"
},
"scripts": {
"vscode:prepublish": "npm run lint && npm run build",
"compile": "tsc -p ./",
"prepare": "sh ./scripts/prepare.sh",
"build": "npm run prepare && npm run compile",
"lint": "eslint --ext ts --fix src",
"watch": "tsc -watch -p ./"
},
"engines": {
"vscode": "^1.49.0"
},
@ -30,11 +51,18 @@
"commands": [
{
"command": "texinfo.showPreview",
"title": "Show preview (as HTML)",
"title": "Show preview",
"icon": "$(open-preview)"
}
],
"menus": {
"commandPalette": [
{
"command": "texinfo.showPreview",
"when": "editorLangId == texinfo",
"group": "navigation"
}
],
"editor/title": [
{
"command": "texinfo.showPreview",
@ -43,6 +71,14 @@
}
]
},
"keybindings": [
{
"command": "texinfo.showPreview",
"key": "ctrl+k v",
"mac": "cmd+k v",
"when": "editorLangId == texinfo"
}
],
"configuration": {
"title": "Texinfo",
"properties": {
@ -110,26 +146,5 @@
"configuration": "./language-configuration.json"
}
]
},
"scripts": {
"vscode:prepublish": "npm run lint && npm run build",
"compile": "tsc -p ./",
"prepare": "sh ./scripts/prepare.sh",
"build": "npm run prepare && npm run compile",
"lint": "eslint --ext ts --fix src",
"watch": "tsc -watch -p ./"
},
"devDependencies": {
"@types/node": "^14.11.2",
"@types/vscode": "^1.49.0",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.10.0",
"typescript": "^4.0.3"
},
"dependencies": {
"cson": "^7.20.0",
"language-texinfo": "^1.0.0",
"node-html-parser": "^1.2.21"
}
}

View File

@ -37,8 +37,7 @@ export class Converter {
}
private async convert(path: string) {
const makeinfo = Options.makeinfo;
const maxBuffer = Options.maxSize * 1024 * 1024;
return await utils.exec(makeinfo, this.options.concat(path), maxBuffer);
return await utils.exec(Options.makeinfo, this.options.concat(path), maxBuffer);
}
}

View File

@ -31,13 +31,11 @@ export async function prompt(message: string, confirm: string) {
export function exec(path: string, args: string[], maxBuffer: number) {
return new Promise<string | undefined>((resolve) => {
child_process.execFile(path, args, { maxBuffer: maxBuffer }, (error, stdout, stderr) => {
if (stderr) {
console.log(stderr);
}
if (error) {
console.error(error);
resolve(undefined);
} else {
stderr && console.log(stderr);
resolve(stdout);
}
});