Compare commits

...

15 Commits

Author SHA1 Message Date
CismonX ed968839b6
chore: fix typos
ci/woodpecker/push/woodpecker Pipeline was successful Details
2024-04-20 08:34:46 +08:00
CismonX f8bcf86fb1
chore: prepare for v0.3.0
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
2024-04-04 08:46:50 +08:00
CismonX 8f289fbcb8
chore: update docs
ci/woodpecker/push/woodpecker Pipeline was successful Details
2024-04-04 08:13:38 +08:00
CismonX afe3694a88
refactor: underscore-prefix kwargs
ci/woodpecker/push/woodpecker Pipeline was successful Details
so that they could be mangled by terser, producing shorter output
2024-04-04 07:01:37 +08:00
CismonX 530902128c
feat: support GNU Texinfo 7.1
* update version indicator
* add completion for several @-commands
2024-04-04 07:01:26 +08:00
CismonX 1294764698
chore: switch to woodpecker ci
and remove build status badge from README.md
2024-04-02 15:33:03 +08:00
CismonX 9de1ba26b0
chore: release logo into public domain 2024-04-02 14:31:11 +08:00
CismonX 13feb8a1f4
refactor: improve build scripts 2024-04-02 14:12:03 +08:00
CismonX ad685014d2
feat: support makeinfo customization variables 2024-04-02 13:38:42 +08:00
CismonX 3f8c23d917
chore: target ES2021
Since we're now using Node.js >= 18, it is safe to target ES2021.

With features like optional chaining, null coalescing (assignment),
the compiler could emit shorter code, leading to smaller package size.
2024-04-02 08:51:01 +08:00
CismonX 3b3478decb
chore: update dependencies 2024-04-02 08:05:38 +08:00
CismonX a5837defce
fix link
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2022-02-10 02:49:27 +08:00
CismonX 5e86022e32
fix link; update gitignore
continuous-integration/drone/push Build is passing Details
2022-02-10 02:46:03 +08:00
CismonX 229d84bd2d
bugfix: snippet completion for block commands
continuous-integration/drone/push Build is passing Details
2022-02-02 14:53:46 +08:00
CismonX c3e33c3340
Update dependencies 2022-02-02 14:32:45 +08:00
17 changed files with 3701 additions and 2300 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@
# this notice are preserved. This file is offered as-is, without any warranty. # this notice are preserved. This file is offered as-is, without any warranty.
# #
*.asc
*.vsix *.vsix
.vscode/ .vscode/
node_modules/ node_modules/

View File

@ -8,7 +8,7 @@
**/*.map **/*.map
**/*.ts **/*.ts
.drone.yml .woodpecker.yml
.gitignore .gitignore
.gitattributes .gitattributes
.travis.yml .travis.yml

View File

@ -6,12 +6,16 @@
# this notice are preserved. This file is offered as-is, without any warranty. # this notice are preserved. This file is offered as-is, without any warranty.
# #
kind: pipeline # For history build logs,
type: docker # see <https://ci.cismon.net/repos/cismonx/vscode-texinfo>.
name: default
steps: steps:
- name: build - name: build
image: node:14.18 image: node:18-alpine
when:
- event: [push, tag, manual]
branch: primary
commands: commands:
- npm --unsafe-perm ci - apk add --no-cache perl unzip
- npm ci
- npm run package - npm run package

View File

@ -1,13 +1,22 @@
<!-- <!--
Copyright (C) 2020,2021 CismonX <admin@cismon.net> Copyright (C) 2020,2021,2022,2024 CismonX <admin@cismon.net>
Copying and distribution of this file, with or without modification, are Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty, provided the copyright notice and permitted in any medium without royalty, provided the copyright notice and
this notice are preserved. This file is offered as-is, without any warranty. this notice are preserved. This file is offered as-is, without any warranty.
--> -->
# Changelog # Changelog
## v0.3.0 - 04/04/2024
* Add configuration for customization variables (`makeinfo -c KEY=VAL`).
* Support GNU Texinfo 7.1.
## v0.2.4 - 02/02/2022
* Fix a bug which breaks the snippet completion of block commands.
## v0.2.3 - 10/23/2021 ## v0.2.3 - 10/23/2021
* Fix a bug which prevents diagnostic info from displaying correctly in GNU Texinfo 6.8, and on Windows platform. * Fix a bug which prevents diagnostic info from displaying correctly in GNU Texinfo 6.8, and on Windows platform.

View File

@ -15,17 +15,11 @@ file format restrictions.
assets/texinfo.png assets/texinfo.png
They should be treated as if they each contains the following text: This file is released into the public domain using [CC0].
Copyright (C) 2020,2021 CismonX <admin@cismon.net>
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty, provided the copyright notice and
this notice are preserved. This file is offered as-is, without any warranty.
## Files from other projects ## Files from other projects
Source code from the projects listed below are **not** part of vscode-texinfo. Source code from the projects listed below are *not* part of vscode-texinfo.
However, when building the project, they are downloaded, compiled, and packaged However, when building the project, they are downloaded, compiled, and packaged
into a single binary file alongside with vscode-texinfo. into a single binary file alongside with vscode-texinfo.
@ -44,6 +38,7 @@ separate programs.
<!-- Reference Links --> <!-- Reference Links -->
[CC0]: https://creativecommons.org/public-domain/cc0/
[Texinfo syntax highlighting]: https://github.com/Alhadis/language-texinfo [Texinfo syntax highlighting]: https://github.com/Alhadis/language-texinfo
[Visual Studio Code]: https://github.com/microsoft/vscode [Visual Studio Code]: https://github.com/microsoft/vscode
[GNU Texinfo]: https://www.gnu.org/software/texinfo [GNU Texinfo]: https://www.gnu.org/software/texinfo

View File

@ -1,5 +1,5 @@
<!-- <!--
Copyright (C) 2020,2021 CismonX <admin@cismon.net> Copyright (C) 2020,2021,2024 CismonX <admin@cismon.net>
Copying and distribution of this file, with or without modification, are Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty, provided the copyright notice and permitted in any medium without royalty, provided the copyright notice and
@ -8,14 +8,13 @@
# vscode-texinfo # vscode-texinfo
[![Build Status]][Drone CI] [![License]](LICENSE) [![License]](LICENSE)
## About ## About
vscode-texinfo is an extension of Visual Studio Code which aims at improving vscode-texinfo is an extension of [Visual Studio Code] which provides the
user experience for editing Texinfo documents. following features for editing [Texinfo] documents:
Major features include:
* Syntax Highlighting * Syntax Highlighting
* Code Completion * Code Completion
* HTML Preview * HTML Preview
@ -25,12 +24,12 @@ Major features include:
## Getting Started ## Getting Started
For instructions about how to install, use, and contribute to vscode-texinfo, For instructions on how to install, use, and contribute to vscode-texinfo,
see the [online user manual]. see the [user manual].
<!-- Reference Links --> <!-- Reference Links -->
[Build Status]: https://shields.io/drone/build/CismonX/vscode-texinfo?server=https%3A%2F%2Fdrone.cismon.net [Visual Studio Code]: https://github.com/microsoft/vscode
[Drone CI]: https://drone.cismon.net/CismonX/vscode-texinfo [Texinfo]: https://www.gnu.org/software/texinfo/
[License]: https://img.shields.io/badge/license-GPL--3.0--or--later-blue.svg [License]: https://img.shields.io/badge/license-GPL--3.0--or--later-blue.svg
[online user manual]: https://nongnu.org/vscode-texinfo/manual [user manual]: https://nongnu.org/vscode-texinfo/manual

View File

@ -9,6 +9,8 @@
@set vscode-docs-url https://code.visualstudio.com/docs @set vscode-docs-url https://code.visualstudio.com/docs
@set vscode-api-url https://code.visualstudio.com/api @set vscode-api-url https://code.visualstudio.com/api
@set gnu-texinfo-docs https://www.gnu.org/software/texinfo/manual/texinfo @set gnu-texinfo-docs https://www.gnu.org/software/texinfo/manual/texinfo
@set sv-home-url https://sv.nongnu.org
@set sv-releases-url https://dl.sv.nongnu.org/releases
@tex @tex
\global\def\linkcolor{0 0 1} \global\def\linkcolor{0 0 1}
@ -20,7 +22,7 @@
This manual is for vscode-texinfo (version @value{VERSION}), an extension of This manual is for vscode-texinfo (version @value{VERSION}), an extension of
Visual Studio Code. Visual Studio Code.
Copyright @copyright{} 2021 CismonX <admin@@cismon.net> Copyright @copyright{} 2021,2024 CismonX <admin@@cismon.net>
@quotation @quotation
This manual is licensed under a This manual is licensed under a
@ -51,7 +53,7 @@ Creative Commons Attribution-ShareAlike 4.0 International License}.
This manual is for vscode-texinfo (version @value{VERSION}), an extension of This manual is for vscode-texinfo (version @value{VERSION}), an extension of
Visual Studio Code. Visual Studio Code.
Copyright @copyright{} 2021 CismonX <admin@@cismon.net> Copyright @copyright{} 2021,2024 CismonX <admin@@cismon.net>
This manual is licensed under a This manual is licensed under a
@url{https://creativecommons.org/licenses/by-sa/4.0/, @url{https://creativecommons.org/licenses/by-sa/4.0/,
@ -72,8 +74,8 @@ Creative Commons Attribution-ShareAlike 4.0 International License}.
@chapter Overview @chapter Overview
Texinfo is a typesetting language designed for writing software manuals. It's Texinfo is a typesetting language designed for writing software manuals. It's
the official documention format for GNU projects, but not as popular in modern the official documentation format for GNU projects, but not as popular in
non-GNU free software projects. modern non-GNU free software projects.
One of the main reasons is the lack of editor support. While Emacs does offer a One of the main reasons is the lack of editor support. While Emacs does offer a
``texinfo-mode'', however, Emacs is not widely used among average software ``texinfo-mode'', however, Emacs is not widely used among average software
@ -99,11 +101,11 @@ version 3 of the License}, or (at your option) any later version.
@node Contributing @node Contributing
@section Contributing @section Contributing
This project is hosted on @url{https://sv.gnu.org/p/vscode-texinfo, Savannah}. This project is hosted on @url{@value{sv-home-url}/p/vscode-texinfo, Savannah}.
Any kind of contribution is welcome, including bug reports, patches, and Any kind of contribution is welcome, including bug reports, patches, and
general discussions regarding the usage of vscode-texinfo. general discussions regarding the usage of vscode-texinfo.
Before you submit something, please make sure that you have read this manual, Before you post something, please make sure that you have read this manual,
and no one else has posted the same content. and no one else has posted the same content.
@ -120,7 +122,7 @@ binary release, which is proprietary software. You can also build it from
@quotation Note @quotation Note
Theoretically vscode-texinfo can work with any version of Visual Studio Code Theoretically vscode-texinfo can work with any version of Visual Studio Code
since 1.40, but not all versions are tested. It's recommended to install a since 1.82, but not all versions are tested. It's recommended to install a
latest release. latest release.
@end quotation @end quotation
@ -139,7 +141,7 @@ and you can find and install this extension (Extension ID:
@section Manual Installation @section Manual Installation
You can manually download the @code{.vsix} file, from either Savannah's You can manually download the @code{.vsix} file, from either Savannah's
@url{https://dl.sv.gnu.org/releases/vscode-texinfo/, download area}, @url{@value{sv-releases-url}/vscode-texinfo/, download area},
@url{https://open-vsx.org/extension/CismonX/texinfo, Open VSX Registry}, or the @url{https://open-vsx.org/extension/CismonX/texinfo, Open VSX Registry}, or the
proprietary Visual Studio Marketplace. proprietary Visual Studio Marketplace.
@ -148,28 +150,12 @@ you should check whether the file matches a trusted signature:
@set vsix-name texinfo-@value{VERSION}.vsix @set vsix-name texinfo-@value{VERSION}.vsix
@ifhtml
@example @example
wget -O cismonx.gpg.asc "https://sv.gnu.org/people/viewgpg.php?user_id=214244" wget -O- '@value{sv-home-url}/people/viewgpg.php?user_id=214244' \
gpg --import cismonx.gpg.asc | gpg --import
wget -O- @value{sv-releases-url}/vscode-texinfo/@value{vsix-name}.sig.asc \
wget https://dl.sv.gnu.org/releases/vscode-texinfo/@value{vsix-name}.sig.asc | gpg --verify - @value{vsix-name}
gpg --verify @value{vsix-name}.sig.asc @value{vsix-name}
@end example @end example
@end ifhtml
@ifnothtml
@example
wget -O cismonx.gpg.asc \
"https://sv.gnu.org/people/viewgpg.php?user_id=214244"
gpg --import cismonx.gpg.asc
wget "https://dl.sv.gnu.org/releases/vscode-texinfo/
@value{vsix-name}.sig.asc"
gpg --verify @value{vsix-name}.sig.asc @value{vsix-name}
@end example
@end ifnothtml
Finally, install the @code{.vsix} file to Visual Studio Code via command Finally, install the @code{.vsix} file to Visual Studio Code via command
palette: @code{Extensions: Install from VSIX...}. palette: @code{Extensions: Install from VSIX...}.
@ -178,7 +164,7 @@ palette: @code{Extensions: Install from VSIX...}.
@node Build from Source @node Build from Source
@section Build from Source @section Build from Source
You can generate the @code{.vsix} file from the source code of vscode-texinfo. The @code{.vsix} file can be built from the source code of vscode-texinfo.
First, clone the source code repository: First, clone the source code repository:
@ -370,7 +356,7 @@ the extension. To manually trigger a refresh, click the status bar item.
@section HTML Preview @section HTML Preview
You can generate the HTML preview of a Texinfo document in Visual Studio Code, You can generate the HTML preview of a Texinfo document in Visual Studio Code,
to see how the document looks like when displayed online. to see how the document looks like when displayed in a web browser.
In the active text editor which contains a Texinfo document, click the ``Show In the active text editor which contains a Texinfo document, click the ``Show
Preview'' button on the top right of the editor. A webview will be created in a Preview'' button on the top right of the editor. A webview will be created in a
@ -427,7 +413,7 @@ allow @@-commands}, which is not handled in vscode-texinfo due to performance
considerations. For these nodes, this feature does not work. considerations. For these nodes, this feature does not work.
@end quotation @end quotation
To disable this feature and hide the code lenses, switch off the configuation To disable this feature and hide the code lenses, switch off the configuration
item @code{texinfo.enableCodeLens}. item @code{texinfo.enableCodeLens}.
See the Visual Studio Code User Guide for more information about See the Visual Studio Code User Guide for more information about
@ -445,7 +431,7 @@ HTML previews.
can produce before quitting. (@code{--error-limit=NUM}) can produce before quitting. (@code{--error-limit=NUM})
@item @code{texinfo.preview.includePaths}: Array of extra paths to search for @item @code{texinfo.preview.includePaths}: Array of extra paths to search for
@code{@@include} files. (@code{-I PATH}) @code{@@include} files. (@code{-I PATH})
@item @code{texinfo.preview.maxSize}: Max allowed size for the genereated HTML @item @code{texinfo.preview.maxSize}: Max allowed size for the generated HTML
file before it's displayed in the preview. Files larger than this limit will file before it's displayed in the preview. Files larger than this limit will
trigger an error. trigger an error.
@item @code{texinfo.preview.noHeaders}: When enabled, headers and menus are no @item @code{texinfo.preview.noHeaders}: When enabled, headers and menus are no
@ -457,6 +443,8 @@ are not validated. (@code{--no-validate})
@item @code{texinfo.preview.variables}: Array of variables to define (as with @item @code{texinfo.preview.variables}: Array of variables to define (as with
@code{@@set}). If a variable has a value, use the ASCII space character to @code{@@set}). If a variable has a value, use the ASCII space character to
separate key and value. separate key and value.
@item @code{texinfo.preview.customizationVariables}: Array of customization
variables. (@code{-c KEY=VALUE})
@end itemize @end itemize

5599
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"_copyrightNotice": [ "_copyrightNotice": [
"Copyright (C) 2020,2021 CismonX <admin@cismon.net>", "Copyright (C) 2020,2021,2022,2024 CismonX <admin@cismon.net>",
"Copying and distribution of this file, with or without modification,", "Copying and distribution of this file, with or without modification,",
"are permitted in any medium without royalty, provided the copyright notice and this notice are preserved.", "are permitted in any medium without royalty, provided the copyright notice and this notice are preserved.",
"This file is offered as-is, without any warranty." "This file is offered as-is, without any warranty."
@ -9,37 +9,37 @@
"displayName": "Texinfo Language Support", "displayName": "Texinfo Language Support",
"description": "Texinfo language support for Visual Studio Code", "description": "Texinfo language support for Visual Studio Code",
"publisher": "cismonx", "publisher": "cismonx",
"version": "0.2.3", "version": "0.3.0",
"author": { "author": {
"name": "CismonX", "name": "CismonX",
"email": "admin@cismon.net", "email": "admin@cismon.net",
"url": "https://cismon.net" "url": "https://cismon.net"
}, },
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"homepage": "https://sv.gnu.org/p/vscode-texinfo", "homepage": "https://savannah.nongnu.org/p/vscode-texinfo",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git.sv.gnu.org/cgit/vscode-texinfo.git" "url": "https://git.savannah.nongnu.org/cgit/vscode-texinfo.git"
}, },
"icon": "assets/texinfo.png", "icon": "assets/texinfo.png",
"devDependencies": { "devDependencies": {
"@types/node": "^14.17.29", "@types/node": "^18.11.9",
"@types/vscode": "~1.40.0", "@types/vscode": "~1.82.0",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.5",
"@typescript-eslint/eslint-plugin": "^5.1.0", "@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^5.1.0", "@typescript-eslint/parser": "^7.5.0",
"cson": "^7.20.0", "@vscode/vsce": "^2.24.0",
"eslint": "^8.1.0", "cson": "^8.4.0",
"eslint": "^8.57.0",
"json": "^11.0.0", "json": "^11.0.0",
"json5": "^2.2.0", "json5": "^2.2.3",
"language-texinfo": "^1.1.0", "language-texinfo": "^1.1.0",
"minify-xml": "^3.2.0", "minify-xml": "^4.4.1",
"ts-loader": "^9.2.6", "ts-loader": "^9.5.1",
"ts-node": "^10.4.0", "ts-node": "^10.9.2",
"typescript": "^4.4.4", "typescript": "^5.4.3",
"vsce": "^1.100.2", "webpack": "^5.91.0",
"webpack": "^5.59.1", "webpack-cli": "^5.1.4"
"webpack-cli": "^4.9.1"
}, },
"scripts": { "scripts": {
"vscode:prepublish": "webpack --mode production", "vscode:prepublish": "webpack --mode production",
@ -79,7 +79,7 @@
} }
}, },
"engines": { "engines": {
"vscode": "^1.40.0" "vscode": "^1.82.0"
}, },
"categories": [ "categories": [
"Programming Languages", "Programming Languages",
@ -87,9 +87,6 @@
"Other" "Other"
], ],
"main": "./out/extension.js", "main": "./out/extension.js",
"activationEvents": [
"onLanguage:texinfo"
],
"contributes": { "contributes": {
"commands": [ "commands": [
{ {
@ -166,7 +163,7 @@
"texinfo.makeinfo": { "texinfo.makeinfo": {
"type": "string", "type": "string",
"default": "makeinfo", "default": "makeinfo",
"description": "Path to the makeinfo (or texi2any) command." "description": "Path to the makeinfo (or texi2any) program."
}, },
"texinfo.preview.customCSS": { "texinfo.preview.customCSS": {
"type": "string", "type": "string",
@ -204,12 +201,17 @@
"texinfo.preview.noValidation": { "texinfo.preview.noValidation": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "Supress node cross-reference validation." "description": "Suppress node cross-reference validation."
}, },
"texinfo.preview.variables": { "texinfo.preview.variables": {
"type": "array", "type": "array",
"default": [], "default": [],
"description": "Define variables (as with @set)." "description": "Define variables (as with @set)."
},
"texinfo.preview.customizationVariables": {
"type": "array",
"default": [],
"description": "Set customization variables (format: KEY=VAL)"
} }
} }
}, },

View File

@ -1,41 +1,45 @@
#!/usr/bin/env bash #!/bin/sh
# #
# Copyright (C) 2021 CismonX <admin@cismon.net> # Copyright (C) 2021,2024 CismonX <admin@cismon.net>
# #
# Copying and distribution of this file, with or without modification, are # Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty, provided the copyright notice and # permitted in any medium without royalty, provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty. # this notice are preserved. This file is offered as-is, without any warranty.
# #
VSIX_FILE_NAME=texinfo-$(json -f package.json version).vsix set -e
PACKAGE_JSON_CLEANUP_JS=$(cat ./scripts/package-json-cleanup.js)
vsce package --baseContentUrl=$(json -f package.json repository.url)/tree version=$(json -f package.json version)
vsix_file_name=texinfo-$version.vsix
vsce package --baseContentUrl="$(json -f package.json repository.url)/tree"
unzip -d "$vsix_file_name.d" "$vsix_file_name"
cd "$vsix_file_name.d"
minify_xml() {
minify-xml --no-shorten-namespaces --no-remove-unused-namespaces \
--no-remove-unused-default-namespace -i "$1"
}
minify_xml '[Content_Types].xml'
minify_xml extension.vsixmanifest
unzip -d $VSIX_FILE_NAME{.d,}
cd $VSIX_FILE_NAME.d
MINIFY_XML_OPTIONS='--no-shorten-namespaces
--no-remove-unused-namespaces
--no-remove-unused-default-namespace'
minify-xml $MINIFY_XML_OPTIONS --output \[Content_Types\].xml{,}
minify-xml $MINIFY_XML_OPTIONS --output extension.vsixmanifest{,}
cd extension cd extension
# Minify JSON files. # Minify JSON files.
json -j0 -I -e "$PACKAGE_JSON_CLEANUP_JS" -f package.json json -j0 -I -e "$(cat ../../scripts/package-json-cleanup.js)" -f package.json
perl -pi -e 'chomp if eof' package.json perl -pi -e 'chomp if eof' package.json
json5 -o language-configuration.json{,} json5 language-configuration.json > _ && mv _ language-configuration.json
# Remove comments from Markdown files. # Remove comments from Markdown files.
tail -n +9 README.md > _ && mv _ README.md tail -n +9 README.md > _ && mv _ README.md
tail -n +9 CHANGELOG.md > _ && mv _ CHANGELOG.md tail -n +9 CHANGELOG.md > _ && mv _ CHANGELOG.md
cd ext cd ext
# Minify Perl scripts. # Minify Perl scripts.
# You can install perltidy with `cpan Perl::Tidy` # You can install perltidy with `cpan Perl::Tidy`
if [[ -x "$(command -v perltidy)" ]]; then if command -v perltidy; then
perltidy --mangle -dac -b html-preview.pm perltidy --mangle -dac -b html-preview.pm
rm html-preview.pm.bak rm html-preview.pm.bak
fi fi
cd ../../..
cd ../../..
# Re-package .vsix file. # Re-package .vsix file.
node ./scripts/make-vsix.js $VSIX_FILE_NAME node ./scripts/make-vsix.js "$vsix_file_name"
rm -r $VSIX_FILE_NAME.d rm -r "$vsix_file_name.d"

View File

@ -1,17 +1,21 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright (C) 2020,2021 CismonX <admin@cismon.net> # Copyright (C) 2020,2021,2024 CismonX <admin@cismon.net>
# #
# Copying and distribution of this file, with or without modification, are # Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty, provided the copyright notice and # permitted in any medium without royalty, provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty. # this notice are preserved. This file is offered as-is, without any warranty.
# #
SRC_PATH=./node_modules/language-texinfo set -e
DEST_PATH=./out/grammars
mkdir -p $DEST_PATH
# Convert TextMate grammar to JSON, as VSCode cannot recognize CSON ones.
cson2json $SRC_PATH/grammars/texinfo.cson | json5 > $DEST_PATH/texinfo.json
VERSION=$(json -f package.json version) src_path=./node_modules/language-texinfo
echo "@set VERSION $VERSION" > ./doc/version.texi dest_path=./out/grammars
mkdir -p $dest_path
# Convert TextMate grammar to JSON, since VSCode cannot recognize CSON ones.
cson2json $src_path/grammars/texinfo.cson | json5 > $dest_path/texinfo.json
version=$(json -f package.json version)
echo "@set VERSION $version" > ./doc/version.texi

View File

@ -30,7 +30,7 @@ import { FoldingRange, Optional } from '../utils/types';
export default class DocumentSymbolContext export default class DocumentSymbolContext
{ {
get documentSymbols() { get documentSymbols() {
return this._documentSymbols ??= this._calculcateDocumentSymbols(); return this._documentSymbols ??= this._calculateDocumentSymbols();
} }
clear() { clear() {
@ -46,7 +46,7 @@ export default class DocumentSymbolContext
/** /**
* Calculate document symbols based on folding ranges. * Calculate document symbols based on folding ranges.
*/ */
private _calculcateDocumentSymbols() { private _calculateDocumentSymbols() {
const ranges = Array<Optional<FoldingRange>>(this._document.lineCount); const ranges = Array<Optional<FoldingRange>>(this._document.lineCount);
this._documentContext.foldingRange.foldingRanges this._documentContext.foldingRange.foldingRanges
.filter(range => range.kind === undefined) .filter(range => range.kind === undefined)

View File

@ -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 {

View File

@ -80,6 +80,10 @@ export default class Options
return this._getArray('preview.variables'); return this._getArray('preview.variables');
} }
get customizationVariables() {
return this._getArray('preview.customizationVariables');
}
private readonly _configuration private readonly _configuration
= vscode.workspace.getConfiguration('texinfo'); = vscode.workspace.getConfiguration('texinfo');

View File

@ -1,7 +1,7 @@
/** /**
* providers/completion_item.ts * providers/completion_item.ts
* *
* Copyright (C) 2020,2021 CismonX <admin@cismon.net> * Copyright (C) 2020,2021,2022 CismonX <admin@cismon.net>
* *
* This file is part of vscode-texinfo. * This file is part of vscode-texinfo.
* *
@ -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.
* *
@ -49,24 +49,24 @@ export default class CompletionItemProvider
return this._completionItems ??= [ return this._completionItems ??= [
command('ampchar', command('ampchar',
'Insert an ampersand, "&"', 'Insert an ampersand, "&"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('atchar', command('atchar',
'Insert an at sign, "@"', 'Insert an at sign, "@"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('backslashchar', command('backslashchar',
'Insert a blackslash, "\\"', 'Insert a blackslash, "\\"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command( command(
'lbracechar', 'lbracechar',
'Insert a left brace, "{"', 'Insert a left brace, "{"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('rbracechar', command('rbracechar',
'Insert a right brace, "}"', 'Insert a right brace, "}"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('abbr', ...braceCommand('abbr',
'Indicate a general abbreviation', 'Indicate a general abbreviation',
@ -84,7 +84,7 @@ export default class CompletionItemProvider
), ),
command('alias', command('alias',
'Defines a new command to be just like an existing one', 'Defines a new command to be just like an existing one',
{ snippet: true }, { _snippet: true },
), ),
...lineCommandEnum('allowcodebreaks', ...lineCommandEnum('allowcodebreaks',
'Control breaking at "-" and "_" in TeX', 'Control breaking at "-" and "_" in TeX',
@ -116,7 +116,7 @@ export default class CompletionItemProvider
), ),
command('arrow', command('arrow',
'Generate a right arrow glyph, "→"', 'Generate a right arrow glyph, "→"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('asis', command('asis',
'Print the tables first column without highlighting', 'Print the tables first column without highlighting',
@ -134,7 +134,7 @@ export default class CompletionItemProvider
), ),
command('bullet', command('bullet',
'Generate a large round dot, "•"', 'Generate a large round dot, "•"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('bye', command('bye',
'Stop formatting', 'Stop formatting',
@ -182,7 +182,7 @@ export default class CompletionItemProvider
), ),
command('click', command('click',
'Represent a single "click" in a GUI', 'Represent a single "click" in a GUI',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('clicksequence', ...braceCommand('clicksequence',
'Represent a sequence of clicks in a GUI', 'Represent a sequence of clicks in a GUI',
@ -206,7 +206,7 @@ export default class CompletionItemProvider
), ),
command('comma', command('comma',
'Insert a comma character, ","', 'Insert a comma character, ","',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('command', ...braceCommand('command',
'Indicate a command name', 'Indicate a command name',
@ -224,12 +224,15 @@ export default class CompletionItemProvider
), ),
command('copyright', command('copyright',
'The copyright symbol, "©"', 'The copyright symbol, "©"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...lineCommand('defcodeindex', ...lineCommand('defcodeindex',
'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',
@ -371,7 +386,7 @@ export default class CompletionItemProvider
), ),
command('dots', command('dots',
'Generate an ellipsis, "…"', 'Generate an ellipsis, "…"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('email', ...braceCommand('email',
'Indicate an electronic mail address', 'Indicate an electronic mail address',
@ -387,7 +402,7 @@ export default class CompletionItemProvider
), ),
command('enddots', command('enddots',
'Generate an end-of-sentence ellipsis, "..."', 'Generate an end-of-sentence ellipsis, "..."',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...blockCommand('enumerate', ...blockCommand('enumerate',
'Begin a numbered list, using @item for each entry', 'Begin a numbered list, using @item for each entry',
@ -399,12 +414,12 @@ export default class CompletionItemProvider
), ),
command('equiv', command('equiv',
'Insert a glyph indicating exact equivalence, "≡"', 'Insert a glyph indicating exact equivalence, "≡"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('error', command('error',
'Indicate that the following text is an error message, ' + 'Indicate that the following text is an error message, ' +
'"error→"', '"error→"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('errormsg', ...braceCommand('errormsg',
'Report message as an error to standard error, ' + 'Report message as an error to standard error, ' +
@ -413,7 +428,7 @@ export default class CompletionItemProvider
), ),
command('euro', command('euro',
'Generate the Euro currency sign, "€"', 'Generate the Euro currency sign, "€"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...headingFootingCommand('evenfooting', ...headingFootingCommand('evenfooting',
'Generate page footers that are the same for ' + 'Generate page footers that are the same for ' +
@ -442,7 +457,7 @@ export default class CompletionItemProvider
), ),
command('expansion', command('expansion',
'Indicate the result of a macro expansion with a glyph, "→"', 'Indicate the result of a macro expansion with a glyph, "→"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('file', ...braceCommand('file',
'Highlight the name of a file', 'Highlight the name of a file',
@ -494,14 +509,14 @@ export default class CompletionItemProvider
), ),
command('geq', command('geq',
'Generate a greater-than-or-equal sign, "≥"', 'Generate a greater-than-or-equal sign, "≥"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...blockCommand('group', ...blockCommand('group',
'Disallow page breaks within following text', 'Disallow page breaks within following text',
), ),
command('hashchar', command('hashchar',
'Insert a hash character, "#"', 'Insert a hash character, "#"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...lineCommand('heading', ...lineCommand('heading',
'Print an unnumbered section-like heading', 'Print an unnumbered section-like heading',
@ -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',
), ),
@ -598,7 +619,7 @@ export default class CompletionItemProvider
'Insert paragraph indentation', 'Insert paragraph indentation',
), ),
...blockCommand('indentedblock', ...blockCommand('indentedblock',
'Indent a block of arbitary text on the left', 'Indent a block of arbitrary text on the left',
), ),
...braceCommand('indicateurl', ...braceCommand('indicateurl',
'Indicate text that is a URL', 'Indicate text that is a URL',
@ -657,13 +678,16 @@ 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 },
), ),
command('leq', command('leq',
'Generate a less-than-or-equal sign, "≤"', 'Generate a less-than-or-equal sign, "≤"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...blockCommand('lisp', ...blockCommand('lisp',
'Begin an example of Lisp code', 'Begin an example of Lisp code',
@ -692,7 +716,7 @@ export default class CompletionItemProvider
), ),
command('minus', command('minus',
'Generate a minus sign, "-"', 'Generate a minus sign, "-"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...blockCommand('multitable', ...blockCommand('multitable',
'Begin a multi-column table', 'Begin a multi-column table',
@ -736,7 +760,7 @@ export default class CompletionItemProvider
), ),
command('pagesizes', command('pagesizes',
'Change page dimensions', 'Change page dimensions',
{ snippet: true }, { _snippet: true },
), ),
...lineCommand('paragraphindent', ...lineCommand('paragraphindent',
'Indent paragraphs by spaces', 'Indent paragraphs by spaces',
@ -752,15 +776,15 @@ export default class CompletionItemProvider
), ),
command('point', command('point',
'Indicate the position of point in a buffer with ""', 'Indicate the position of point in a buffer with ""',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('pounds', command('pounds',
'Generate the pounds sterling currency sign, "£"', 'Generate the pounds sterling currency sign, "£"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('print', command('print',
'Indicate printed output to the reader with "-|"', 'Indicate printed output to the reader with "-|"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...lineCommand('printindex', ...lineCommand('printindex',
'Generate the alphabetized index for index name', 'Generate the alphabetized index for index name',
@ -777,19 +801,19 @@ export default class CompletionItemProvider
), ),
command('quotedblleft', command('quotedblleft',
'Produce quotation mark "“"', 'Produce quotation mark "“"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('quotedblright', command('quotedblright',
'Produce quotation mark "”"', 'Produce quotation mark "”"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('quoteleft', command('quoteleft',
'Produce quotation mark ""', 'Produce quotation mark ""',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('quoteright', command('quoteright',
'Produce quotation mark ""', 'Produce quotation mark ""',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('r', ...braceCommand('r',
'Set text in the regular roman font', 'Set text in the regular roman font',
@ -810,11 +834,11 @@ export default class CompletionItemProvider
), ),
command('registeredsymbol', command('registeredsymbol',
'Generate the legal symbol, "®"', 'Generate the legal symbol, "®"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('result', command('result',
'Indicate the result of an expression with "⇒"', 'Indicate the result of an expression with "⇒"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('samp', ...braceCommand('samp',
'Indicate a literal example of a sequence of characters', 'Indicate a literal example of a sequence of characters',
@ -952,14 +976,14 @@ export default class CompletionItemProvider
), ),
command('TeX', command('TeX',
'Generate the TeX logo', 'Generate the TeX logo',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...blockCommand('tex', ...blockCommand('tex',
'Enter TeX completely', 'Enter TeX completely',
), ),
command('textdegree', command('textdegree',
'Generate the degree symbol, "◦"', 'Generate the degree symbol, "◦"',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
command('thischapter', command('thischapter',
'Insert the number and name of the current chapter', 'Insert the number and name of the current chapter',
@ -982,7 +1006,7 @@ export default class CompletionItemProvider
command('tie', command('tie',
'Generate a normal interword space at which a line break ' + 'Generate a normal interword space at which a line break ' +
'is not allowed', 'is not allowed',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...braceCommand('tieaccent', ...braceCommand('tieaccent',
'Generate a tie-after accent over the two characters', 'Generate a tie-after accent over the two characters',
@ -1005,7 +1029,7 @@ export default class CompletionItemProvider
), ),
command('today', command('today',
'Insert the current date', 'Insert the current date',
{ hasEmptyBrace: true }, { _hasEmptyBrace: true },
), ),
...lineCommand('top', ...lineCommand('top',
'Mark the topmost @node in the file', 'Mark the topmost @node in the file',
@ -1189,20 +1213,20 @@ function command(name: string, detail: string, extraArgs?: {
/** /**
* Whether this command has a snippet. * Whether this command has a snippet.
*/ */
snippet?: boolean, _snippet?: boolean,
/** /**
* Whether this command takes no arguments and braces are required. * Whether this command takes no arguments and braces are required.
*/ */
hasEmptyBrace?: boolean, _hasEmptyBrace?: boolean,
}): CompletionItem { }): CompletionItem {
return { return {
label: '@' + name, label: '@' + name,
kind: vscode.CompletionItemKind.Function, kind: vscode.CompletionItemKind.Function,
detail: detail, detail: detail,
sortText: name + (extraArgs?.snippet ? '1' : ''), sortText: name + (extraArgs?._snippet ? '1' : ''),
filterText: name, filterText: name,
insertText: name + (extraArgs?.hasEmptyBrace ? '{}' : ''), insertText: name + (extraArgs?._hasEmptyBrace ? '{}' : ''),
snippet: extraArgs?.snippet, snippet: extraArgs?._snippet,
}; };
} }
@ -1219,7 +1243,7 @@ function blockCommand(
...args: string[] ...args: string[]
) { ) {
return [blockSnippet(name, detail, ...args), return [blockSnippet(name, detail, ...args),
command(name, detail, { snippet: true })]; command(name, detail, { _snippet: true })];
} }
/** /**
@ -1236,7 +1260,7 @@ function braceCommand(
...args: string[] ...args: string[]
) { ) {
return [braceCommandSnippet(name, detail, numArgsRequired, ...args), return [braceCommandSnippet(name, detail, numArgsRequired, ...args),
command(name, detail, { snippet: true })]; command(name, detail, { _snippet: true })];
} }
/** /**
@ -1248,7 +1272,7 @@ function braceCommand(
*/ */
function lineCommand(name: string, detail: string, ...args: string[]) { function lineCommand(name: string, detail: string, ...args: string[]) {
return [lineCommandSnippet(name, detail, ...args), return [lineCommandSnippet(name, detail, ...args),
command(name, detail, { snippet: true })]; command(name, detail, { _snippet: true })];
} }
/** /**
@ -1276,7 +1300,7 @@ function lineCommandEnum(name: string, detail: string, ...items: string[]) {
`@${name} ${items.join('/')}`, `@${name} ${items.join('/')}`,
`${name} \${1|${items.join(',')}|}`, `${name} \${1|${items.join(',')}|}`,
), ),
command(name, detail, { snippet: true }), command(name, detail, { _snippet: true }),
]; ];
} }
@ -1290,7 +1314,7 @@ function headingFootingCommand(name: string, detail: string) {
return [ return [
snippet(name, name, detail, 0, `@${name} left @| center @| right`, snippet(name, name, detail, 0, `@${name} left @| center @| right`,
name + ' ${1:left} @| ${2:center} @| ${3:right}'), name + ' ${1:left} @| ${2:center} @| ${3:right}'),
command(name, detail, { snippet: true }), command(name, detail, { _snippet: true }),
]; ];
} }
@ -1351,7 +1375,7 @@ function blockSnippet(name: string, detail: string, ...args: string[]) {
.join(' '); .join(' ');
return snippet(name, name, detail, 0, return snippet(name, name, detail, 0,
`@${name} ${args.join(' ')}\n\n@end ${name}`, `@${name} ${args.join(' ')}\n\n@end ${name}`,
name + args.length ? ' ' : '' + argsIndexed + name + (args.length ? ' ' : '') + argsIndexed +
`\n$${args.length + 1}\n@end ${name}` `\n$${args.length + 1}\n@end ${name}`
); );
} }

View File

@ -48,6 +48,8 @@ export default class Converter
} }
this._addIncludePaths(this._options.includePaths, options); this._addIncludePaths(this._options.includePaths, options);
this._defineVariables(this._options.variables, options); this._defineVariables(this._options.variables, options);
this._setCustomizationVariables(
this._options.customizationVariables, options);
this._includeCustomCSS(this._options.customCSS, options); this._includeCustomCSS(this._options.customCSS, options);
return await exec( return await exec(
this._options.makeinfo, this._options.makeinfo,
@ -75,6 +77,13 @@ export default class Converter
variables.forEach(varName => options.push('-D', varName)); variables.forEach(varName => options.push('-D', varName));
} }
private _setCustomizationVariables(
variables: readonly string[],
options: string[],
) {
variables.forEach(varName => options.push('-c', varName));
}
private _includeCustomCSS(cssFileURI: string, options: string[]) { private _includeCustomCSS(cssFileURI: string, options: string[]) {
if (!cssFileURI) { if (!cssFileURI) {
return; return;

View File

@ -7,7 +7,7 @@
*/ */
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2019", "target": "ES2021",
"outDir": "out", "outDir": "out",
"esModuleInterop": true, "esModuleInterop": true,
"strictNullChecks": true, "strictNullChecks": true,