Update comments

This commit is contained in:
CismonX 2020-10-19 01:31:43 +08:00
parent f4eef662a2
commit ea3b0182c3
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
4 changed files with 24 additions and 6 deletions

View File

@ -1 +1 @@
# Change Log # Changelog

View File

@ -8,7 +8,7 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
/** /**
* Provide code completion info for Texinfo source code. * Provide code completion info for Texinfo documents.
*/ */
export class CompletionItemProvider implements vscode.CompletionItemProvider { export class CompletionItemProvider implements vscode.CompletionItemProvider {
@ -53,7 +53,7 @@ export class CompletionItemProvider implements vscode.CompletionItemProvider {
command('bye', 'stop formatting'), command('bye', 'stop formatting'),
command('c', 'Begin a line comment'), command('c', 'Begin a line comment'),
snippet('header', 'c', 'Declare header block', 1, '@c %**start of header\n\n@c %**end of header', snippet('header', 'c', 'Declare header block', 1, '@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$3\n@c %**${2:end of header}'),
...braceCommand('caption', 'Define the full caption for a @float', 1, 'definition'), ...braceCommand('caption', 'Define the full caption for a @float', 1, 'definition'),
...blockCommand('cartouche', 'Highlight by drawing a box with rounded corners around it'), ...blockCommand('cartouche', 'Highlight by drawing a box with rounded corners around it'),
command('center', 'Center the line of text following the command'), command('center', 'Center the line of text following the command'),
@ -136,14 +136,32 @@ function command(name: string, detail: string, extraArgs?: {
}; };
} }
/**
* Build the completion items for a block command.
*
* @param name The command name
* @param detail The command description
*/
function blockCommand(name: string, detail: string) { function blockCommand(name: string, detail: string) {
return [blockSnippet(name, detail), command(name, detail, { sortOrder: 1 })]; return [blockSnippet(name, detail), command(name, detail, { sortOrder: 1 })];
} }
/**
* Build the completion items for a brace command.
*
* @param name The command name
* @param detail The command description
*/
function braceCommand(name: string, detail: string, numArgsRequired: number, ...args: string[]) { function braceCommand(name: string, detail: string, numArgsRequired: number, ...args: string[]) {
return [commandSnippet(name, detail, numArgsRequired, ...args), command(name, detail, { sortOrder: 1 })]; return [commandSnippet(name, detail, numArgsRequired, ...args), command(name, detail, { sortOrder: 1 })];
} }
/**
* Build the completion items for a line command where the argument is an enum.
*
* @param name The command name
* @param detail The command description
*/
function lineCommandEnum(name: string, detail: string, ...items: string[]) { function lineCommandEnum(name: string, detail: string, ...items: string[]) {
return [ return [
snippet(name, name, detail, 0, `@${name} ${items.join('/')}`, `${name} \${1|${items.join(',')}|}`), snippet(name, name, detail, 0, `@${name} ${items.join('/')}`, `${name} \${1|${items.join(',')}|}`),
@ -152,7 +170,7 @@ function lineCommandEnum(name: string, detail: string, ...items: string[]) {
} }
/** /**
* Build the completion item for a snippet of a command (with arguments). * Build the completion item for a snippet of a brace command.
* *
* @param name The command name. * @param name The command name.
* @param detail The command description. * @param detail The command description.

View File

@ -8,7 +8,7 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
/** /**
* Provide folding range info for Texinfo source code. * Provide folding range info for Texinfo documents.
*/ */
export class FoldingRangeProvider implements vscode.FoldingRangeProvider { export class FoldingRangeProvider implements vscode.FoldingRangeProvider {

View File

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