feat: support GNU Texinfo 7.1
* update version indicator * add completion for several @-commands
This commit is contained in:
parent
1294764698
commit
530902128c
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* indicator.ts
|
* indicator.ts
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020,2021 CismonX <admin@cismon.net>
|
* Copyright (C) 2020,2021,2024 CismonX <admin@cismon.net>
|
||||||
*
|
*
|
||||||
* This file is part of vscode-texinfo.
|
* This file is part of vscode-texinfo.
|
||||||
*
|
*
|
||||||
|
@ -85,16 +85,19 @@ export default class Indicator implements vscode.Disposable
|
||||||
const output
|
const output
|
||||||
= await exec(options.makeinfo, ['--version'], options.maxSize);
|
= await exec(options.makeinfo, ['--version'], options.maxSize);
|
||||||
const result = output.data?.match(/\(GNU texinfo\) (.*)\n/);
|
const result = output.data?.match(/\(GNU texinfo\) (.*)\n/);
|
||||||
let tooltip = '', icon: string, version = '';
|
const version = result?.[1] ?? '';
|
||||||
if (result && result[1]) {
|
let tooltip = '', icon: string;
|
||||||
version = result[1];
|
if (version) {
|
||||||
if (!isNaN(+version) && +version < 6.8) {
|
icon = '$(check)';
|
||||||
icon = '$(warning)';
|
const verArr = version.split('.');
|
||||||
tooltip = `GNU Texinfo (${options.makeinfo}) ` +
|
if (version.length >= 2) {
|
||||||
`is outdated (${version} < 6.8).`;
|
const verMajor = parseInt(verArr[0], 10);
|
||||||
} else {
|
const verMinor = parseInt(verArr[1], 10);
|
||||||
// Unrecognizable version. Assume it is okay.
|
if (verMajor < 7 || verMinor < 1) {
|
||||||
icon = '$(check)';
|
icon = '$(warning)';
|
||||||
|
tooltip = `GNU Texinfo (${options.makeinfo}) ` +
|
||||||
|
`is outdated (${version} < 7.1).`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._canDisplayPreview = true;
|
this._canDisplayPreview = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,7 +37,7 @@ export default class CompletionItemProvider
|
||||||
* GNU Free Documentation License, version 1.3.
|
* GNU Free Documentation License, version 1.3.
|
||||||
*
|
*
|
||||||
* According to GFDL, this usage is considered "aggregation with
|
* According to GFDL, this usage is considered "aggregation with
|
||||||
* independent work", which means that GFDL applies to lines 50-1117 of
|
* independent work", which means that GFDL applies to lines 50-1141 of
|
||||||
* this file, while the remainder is under GPL like other source code files
|
* this file, while the remainder is under GPL like other source code files
|
||||||
* of the project.
|
* of the project.
|
||||||
*
|
*
|
||||||
|
@ -230,6 +230,9 @@ export default class CompletionItemProvider
|
||||||
'Define a new index, print entries in an @code font',
|
'Define a new index, print entries in an @code font',
|
||||||
'index-name',
|
'index-name',
|
||||||
),
|
),
|
||||||
|
...blockCommand('defblock',
|
||||||
|
'Start a block containing definitions',
|
||||||
|
),
|
||||||
...lineCommandX('defcv',
|
...lineCommandX('defcv',
|
||||||
'Format a description for a variable associated with a class',
|
'Format a description for a variable associated with a class',
|
||||||
'category', 'class', 'name',
|
'category', 'class', 'name',
|
||||||
|
@ -245,7 +248,11 @@ export default class CompletionItemProvider
|
||||||
...lineCommandX('defivar',
|
...lineCommandX('defivar',
|
||||||
'Format a description for an instance variable ' +
|
'Format a description for an instance variable ' +
|
||||||
'in object-oriented programming',
|
'in object-oriented programming',
|
||||||
'class', 'instance-variable-name'
|
'class', 'instance-variable-name',
|
||||||
|
),
|
||||||
|
...lineCommandX('defline',
|
||||||
|
'Give the heading prototype line for a symbol being defined',
|
||||||
|
'category', 'name', 'arguments',
|
||||||
),
|
),
|
||||||
...lineCommandX('defmac',
|
...lineCommandX('defmac',
|
||||||
'Format a description for a macro',
|
'Format a description for a macro',
|
||||||
|
@ -297,6 +304,11 @@ export default class CompletionItemProvider
|
||||||
'object-oriented programming',
|
'object-oriented programming',
|
||||||
'class', 'data-type', 'variable-name',
|
'class', 'data-type', 'variable-name',
|
||||||
),
|
),
|
||||||
|
...lineCommandX('deftypeline',
|
||||||
|
'Give the heading prototype line for a symbol being ' +
|
||||||
|
'defined, with data types',
|
||||||
|
'category', 'data-type', 'name', 'arguments',
|
||||||
|
),
|
||||||
...lineCommandX('deftypemethod',
|
...lineCommandX('deftypemethod',
|
||||||
'Format a description for a typed method in ' +
|
'Format a description for a typed method in ' +
|
||||||
'object-oriented programming',
|
'object-oriented programming',
|
||||||
|
@ -346,6 +358,9 @@ export default class CompletionItemProvider
|
||||||
...blockCommand('display',
|
...blockCommand('display',
|
||||||
'Begin a kind of example',
|
'Begin a kind of example',
|
||||||
),
|
),
|
||||||
|
...blockCommand('displaymath',
|
||||||
|
'Format a block of math in "display" format',
|
||||||
|
),
|
||||||
...braceCommand('dmn',
|
...braceCommand('dmn',
|
||||||
'Format a unit of measure, as in 12pt',
|
'Format a unit of measure, as in 12pt',
|
||||||
1, 'dimension',
|
1, 'dimension',
|
||||||
|
@ -552,6 +567,9 @@ export default class CompletionItemProvider
|
||||||
...blockCommand('ifinfo',
|
...blockCommand('ifinfo',
|
||||||
'Begin text that will appear only in Info format',
|
'Begin text that will appear only in Info format',
|
||||||
),
|
),
|
||||||
|
...blockCommand('iflatex',
|
||||||
|
'Begin text that will appear only in LaTeX format',
|
||||||
|
),
|
||||||
...blockCommand('ifplaintext',
|
...blockCommand('ifplaintext',
|
||||||
'Begin text that will appear only in plain text format',
|
'Begin text that will appear only in plain text format',
|
||||||
),
|
),
|
||||||
|
@ -574,6 +592,9 @@ export default class CompletionItemProvider
|
||||||
...blockCommand('ifnotinfo',
|
...blockCommand('ifnotinfo',
|
||||||
'Begin text to be ignored in Info format',
|
'Begin text to be ignored in Info format',
|
||||||
),
|
),
|
||||||
|
...blockCommand('ifnotlatex',
|
||||||
|
'Begin text to be ignored in LaTeX format',
|
||||||
|
),
|
||||||
...blockCommand('ifnotplaintext',
|
...blockCommand('ifnotplaintext',
|
||||||
'Begin text to be ignored in plain text format',
|
'Begin text to be ignored in plain text format',
|
||||||
),
|
),
|
||||||
|
@ -657,6 +678,9 @@ export default class CompletionItemProvider
|
||||||
'Add entry to the index of keys',
|
'Add entry to the index of keys',
|
||||||
'entry',
|
'entry',
|
||||||
),
|
),
|
||||||
|
...blockCommand('latex',
|
||||||
|
'Enter LaTeX completely',
|
||||||
|
),
|
||||||
command('LaTeX',
|
command('LaTeX',
|
||||||
'Generate the LaTeX logo',
|
'Generate the LaTeX logo',
|
||||||
{ hasEmptyBrace: true },
|
{ hasEmptyBrace: true },
|
||||||
|
|
Loading…
Reference in New Issue