diff --git a/package.json b/package.json index e1cbd28..e068d20 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/converter.ts b/src/converter.ts index 075bf88..aec294e 100644 --- a/src/converter.ts +++ b/src/converter.ts @@ -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); } } diff --git a/src/utils.ts b/src/utils.ts index d2cf254..363f4b4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -31,13 +31,11 @@ export async function prompt(message: string, confirm: string) { export function exec(path: string, args: string[], maxBuffer: number) { return new Promise((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); } });