update
This commit is contained in:
parent
43a3154398
commit
67d743b77a
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"root": true,
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "off"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,7 @@ out/test/**
|
||||||
src/**
|
src/**
|
||||||
.gitignore
|
.gitignore
|
||||||
.yarnrc
|
.yarnrc
|
||||||
|
.travis.yml
|
||||||
**/tsconfig.json
|
**/tsconfig.json
|
||||||
**/.eslintrc.json
|
|
||||||
**/*.map
|
**/*.map
|
||||||
**/*.ts
|
**/*.ts
|
||||||
|
|
|
@ -61,12 +61,6 @@
|
||||||
"strip-json-comments": "^3.1.1"
|
"strip-json-comments": "^3.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/color-name": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"@types/eslint-visitor-keys": {
|
"@types/eslint-visitor-keys": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
|
||||||
|
@ -80,15 +74,15 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.11.5",
|
"version": "14.11.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.8.tgz",
|
||||||
"integrity": "sha512-jVFzDV6NTbrLMxm4xDSIW/gKnk8rQLF9wAzLWIOg+5nU6ACrIMndeBdXci0FGtqJbP9tQvm6V39eshc96TO2wQ==",
|
"integrity": "sha512-KPcKqKm5UKDkaYPTuXSx8wEP7vE9GnuaXIZKijwRYcePpZFDVuy2a57LarFKiORbHOuTOOwYzxVxcUzsh2P2Pw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/vscode": {
|
"@types/vscode": {
|
||||||
"version": "1.49.0",
|
"version": "1.50.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.49.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.50.0.tgz",
|
||||||
"integrity": "sha512-wfNQmLmm1VdMBr6iuNdprWmC1YdrgZ9dQzadv+l2eSjJlElOdJw8OTm4RU4oGTBcfvG6RZI2jOcppkdSS18mZw==",
|
"integrity": "sha512-QnIeyi4L2DiD9M2bAQKRzT/EQvc80qP9UL6JD5TiLlNRL1khIDg4ej4mDSRbtFrDAsRntFI1RhMvdomUThMsqg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
|
@ -163,9 +157,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "7.4.0",
|
"version": "7.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||||
"integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==",
|
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn-jsx": {
|
"acorn-jsx": {
|
||||||
|
@ -255,12 +249,11 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-styles": {
|
"ansi-styles": {
|
||||||
"version": "4.2.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/color-name": "^1.1.1",
|
|
||||||
"color-convert": "^2.0.1"
|
"color-convert": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -410,9 +403,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "7.10.0",
|
"version": "7.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.11.0.tgz",
|
||||||
"integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==",
|
"integrity": "sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
|
@ -425,7 +418,7 @@
|
||||||
"enquirer": "^2.3.5",
|
"enquirer": "^2.3.5",
|
||||||
"eslint-scope": "^5.1.1",
|
"eslint-scope": "^5.1.1",
|
||||||
"eslint-utils": "^2.1.0",
|
"eslint-utils": "^2.1.0",
|
||||||
"eslint-visitor-keys": "^1.3.0",
|
"eslint-visitor-keys": "^2.0.0",
|
||||||
"espree": "^7.3.0",
|
"espree": "^7.3.0",
|
||||||
"esquery": "^1.2.0",
|
"esquery": "^1.2.0",
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
|
@ -452,6 +445,14 @@
|
||||||
"table": "^5.2.3",
|
"table": "^5.2.3",
|
||||||
"text-table": "^0.2.0",
|
"text-table": "^0.2.0",
|
||||||
"v8-compile-cache": "^2.0.3"
|
"v8-compile-cache": "^2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"eslint-visitor-keys": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-scope": {
|
"eslint-scope": {
|
||||||
|
|
24
package.json
24
package.json
|
@ -15,12 +15,12 @@
|
||||||
},
|
},
|
||||||
"icon": "assets/texinfo.png",
|
"icon": "assets/texinfo.png",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^14.11.5",
|
"@types/node": "^14.11.8",
|
||||||
"@types/vscode": "^1.49.0",
|
"@types/vscode": "^1.50.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.8.0",
|
"@typescript-eslint/eslint-plugin": "^3.8.0",
|
||||||
"@typescript-eslint/parser": "^3.8.0",
|
"@typescript-eslint/parser": "^3.8.0",
|
||||||
"cson": "^7.20.0",
|
"cson": "^7.20.0",
|
||||||
"eslint": "^7.10.0",
|
"eslint": "^7.11.0",
|
||||||
"language-texinfo": "^1.0.0",
|
"language-texinfo": "^1.0.0",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
|
@ -35,8 +35,24 @@
|
||||||
"lint": "eslint --ext ts --fix src",
|
"lint": "eslint --ext ts --fix src",
|
||||||
"watch": "tsc -watch -p ./"
|
"watch": "tsc -watch -p ./"
|
||||||
},
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"comma-dangle": ["warn", "always-multiline"],
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||||
|
"@typescript-eslint/semi": "warn"
|
||||||
|
}
|
||||||
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.49.0"
|
"vscode": "^1.40.0"
|
||||||
},
|
},
|
||||||
"categories": [
|
"categories": [
|
||||||
"Programming Languages",
|
"Programming Languages",
|
||||||
|
|
|
@ -14,14 +14,13 @@ export class CompletionItemProvider implements vscode.CompletionItemProvider {
|
||||||
|
|
||||||
private readonly completionItems = [
|
private readonly completionItems = [
|
||||||
command('c', 'Line comment'),
|
command('c', 'Line comment'),
|
||||||
snippet('header', 'c', 'Declare header block', 1,
|
snippet('header', 'c', 'Declare header block', 1, '@c %**start of header\n\n@c %**end of header',
|
||||||
'@c %**start of header\n\n@c %**end of header',
|
|
||||||
'c %**${1:start of header}\n$2\n@c %**${3:end of header}'),
|
'c %**${1:start of header}\n$2\n@c %**${3:end of header}'),
|
||||||
command('setfilename', 'Set output file name'),
|
command('setfilename', 'Set output file name'),
|
||||||
command('settitle', 'Set document title'),
|
command('settitle', 'Set document title'),
|
||||||
command('copying', 'Declare copying permissions', { sortOrder: 1 }),
|
command('copying', 'Declare copying permissions', { sortOrder: 1 }),
|
||||||
blockSnippet('copying', 'Declare copying permissions'),
|
blockSnippet('copying', 'Declare copying permissions'),
|
||||||
command('copyright', 'The \'©\' symbol', { hasEmptyArguments: true }),
|
command('copyright', 'The "©" symbol', { hasEmptyArguments: true }),
|
||||||
command('insertcopying', 'Include permissions text'),
|
command('insertcopying', 'Include permissions text'),
|
||||||
command('titlepage', 'Declare title page', { sortOrder: 1 }),
|
command('titlepage', 'Declare title page', { sortOrder: 1 }),
|
||||||
blockSnippet('titlepage', 'Declare title page'),
|
blockSnippet('titlepage', 'Declare title page'),
|
||||||
|
@ -76,10 +75,10 @@ function command(name: string, detail: string, extraArgs?: {
|
||||||
label: '@' + name,
|
label: '@' + name,
|
||||||
kind: vscode.CompletionItemKind.Function,
|
kind: vscode.CompletionItemKind.Function,
|
||||||
detail: detail,
|
detail: detail,
|
||||||
sortText: name + extraArgs?.sortOrder?.toString() ?? '',
|
sortText: name + (extraArgs?.sortOrder?.toString() ?? ''),
|
||||||
filterText: name,
|
filterText: name,
|
||||||
insertText: name + extraArgs?.hasEmptyArguments ? '{}' : '',
|
insertText: name + (extraArgs?.hasEmptyArguments ? '{}' : ''),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function blockSnippet(name: string, detail: string): vscode.CompletionItem {
|
function blockSnippet(name: string, detail: string): vscode.CompletionItem {
|
||||||
|
@ -112,7 +111,7 @@ function snippet(
|
||||||
sortText: keyword + sortOrder.toString(),
|
sortText: keyword + sortOrder.toString(),
|
||||||
filterText: keyword,
|
filterText: keyword,
|
||||||
insertText: new vscode.SnippetString(insertText),
|
insertText: new vscode.SnippetString(insertText),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,5 +120,5 @@ function snippet(
|
||||||
* @param snippet The snippet code
|
* @param snippet The snippet code
|
||||||
*/
|
*/
|
||||||
function snippetDocumentation(snippet: string) {
|
function snippetDocumentation(snippet: string) {
|
||||||
return new vscode.MarkdownString(`\`\`\`texinfo\n${snippet}\n\`\`\``);
|
return new vscode.MarkdownString('```texinfo\n' + snippet + '\n```');
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export class Converter {
|
||||||
* Convert a Texinfo document to HTML.
|
* Convert a Texinfo document to HTML.
|
||||||
*
|
*
|
||||||
* @param path Path to the Texinfo document.
|
* @param path Path to the Texinfo document.
|
||||||
* @yields HTML code, or `undefined` if conversion fails.
|
* @returns HTML code, or `undefined` if conversion fails.
|
||||||
*/
|
*/
|
||||||
static async convertToHtml(path: string) {
|
static async convertToHtml(path: string) {
|
||||||
return await new Converter().convert(path);
|
return await new Converter().convert(path);
|
||||||
|
|
|
@ -17,10 +17,7 @@ let options: Options | undefined;
|
||||||
export class Options {
|
export class Options {
|
||||||
|
|
||||||
private static get instance() {
|
private static get instance() {
|
||||||
if (options === undefined) {
|
return options ?? (options = new Options('texinfo'));
|
||||||
options = new Options('texinfo');
|
|
||||||
}
|
|
||||||
return options;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static clear() {
|
static clear() {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import * as vscode from 'vscode';
|
||||||
*
|
*
|
||||||
* @param message The message to be displayed on the prompt.
|
* @param message The message to be displayed on the prompt.
|
||||||
* @param confirm Text to be displayed on the "Confirm" button.
|
* @param confirm Text to be displayed on the "Confirm" button.
|
||||||
* @yields Whether the user clicked the "Confirm" button.
|
* @returns Whether the user clicked the "Confirm" button.
|
||||||
*/
|
*/
|
||||||
export async function prompt(message: string, confirm: string) {
|
export async function prompt(message: string, confirm: string) {
|
||||||
return confirm === await vscode.window.showInformationMessage(message, confirm, 'Cancel');
|
return confirm === await vscode.window.showInformationMessage(message, confirm, 'Cancel');
|
||||||
|
@ -26,7 +26,7 @@ export async function prompt(message: string, confirm: string) {
|
||||||
* @param path Path to the executable file.
|
* @param path Path to the executable file.
|
||||||
* @param args Arguments to be passed to the command.
|
* @param args Arguments to be passed to the command.
|
||||||
* @param maxBuffer Max output buffer size.
|
* @param maxBuffer Max output buffer size.
|
||||||
* @yields The output data, or `undefined` if execution fails.
|
* @returns The output data, or `undefined` if execution fails.
|
||||||
*/
|
*/
|
||||||
export function exec(path: string, args: string[], maxBuffer: number) {
|
export function exec(path: string, args: string[], maxBuffer: number) {
|
||||||
return new Promise<string | undefined>((resolve) => {
|
return new Promise<string | undefined>((resolve) => {
|
||||||
|
@ -55,7 +55,7 @@ export function transformHtmlImageUri(htmlCode: string, transformer: (src: strin
|
||||||
elements.forEach((element) => {
|
elements.forEach((element) => {
|
||||||
const src = element.getAttribute('src');
|
const src = element.getAttribute('src');
|
||||||
src && element.setAttribute('src', transformer(src));
|
src && element.setAttribute('src', transformer(src));
|
||||||
})
|
});
|
||||||
// If nothing is transformed, return the original HTML code, for better performance.
|
// If nothing is transformed, return the original HTML code, for better performance.
|
||||||
return elements.length === 0 ? htmlCode : dom.outerHTML;
|
return elements.length === 0 ? htmlCode : dom.outerHTML;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "CommonJS",
|
||||||
"target": "ES2019",
|
"target": "ES2019",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"lib": [
|
"lib": [
|
||||||
|
|
Loading…
Reference in New Issue