Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
CismonX | ed968839b6 | |
CismonX | f8bcf86fb1 | |
CismonX | 8f289fbcb8 | |
CismonX | afe3694a88 | |
CismonX | 530902128c | |
CismonX | 1294764698 | |
CismonX | 9de1ba26b0 | |
CismonX | 13feb8a1f4 | |
CismonX | ad685014d2 | |
CismonX | 3f8c23d917 | |
CismonX | 3b3478decb | |
CismonX | a5837defce | |
CismonX | 5e86022e32 |
|
@ -6,6 +6,7 @@
|
|||
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||
#
|
||||
|
||||
*.asc
|
||||
*.vsix
|
||||
.vscode/
|
||||
node_modules/
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
**/*.map
|
||||
**/*.ts
|
||||
.drone.yml
|
||||
.woodpecker.yml
|
||||
.gitignore
|
||||
.gitattributes
|
||||
.travis.yml
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||
#
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
# For history build logs,
|
||||
# see <https://ci.cismon.net/repos/cismonx/vscode-texinfo>.
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: node:14.18
|
||||
image: node:18-alpine
|
||||
when:
|
||||
- event: [push, tag, manual]
|
||||
branch: primary
|
||||
commands:
|
||||
- npm --unsafe-perm ci
|
||||
- apk add --no-cache perl unzip
|
||||
- npm ci
|
||||
- npm run package
|
|
@ -1,5 +1,5 @@
|
|||
<!--
|
||||
Copyright (C) 2020,2021,2022 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
|
||||
permitted in any medium without royalty, provided the copyright notice and
|
||||
|
@ -8,6 +8,11 @@
|
|||
|
||||
# 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.
|
||||
|
|
|
@ -15,17 +15,11 @@ file format restrictions.
|
|||
|
||||
assets/texinfo.png
|
||||
|
||||
They should be treated as if they each contains the following text:
|
||||
|
||||
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.
|
||||
This file is released into the public domain using [CC0].
|
||||
|
||||
## 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
|
||||
into a single binary file alongside with vscode-texinfo.
|
||||
|
||||
|
@ -44,6 +38,7 @@ separate programs.
|
|||
|
||||
<!-- Reference Links -->
|
||||
|
||||
[CC0]: https://creativecommons.org/public-domain/cc0/
|
||||
[Texinfo syntax highlighting]: https://github.com/Alhadis/language-texinfo
|
||||
[Visual Studio Code]: https://github.com/microsoft/vscode
|
||||
[GNU Texinfo]: https://www.gnu.org/software/texinfo
|
||||
|
|
19
README.md
19
README.md
|
@ -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
|
||||
permitted in any medium without royalty, provided the copyright notice and
|
||||
|
@ -8,14 +8,13 @@
|
|||
|
||||
# vscode-texinfo
|
||||
|
||||
[![Build Status]][Drone CI] [![License]](LICENSE)
|
||||
[![License]](LICENSE)
|
||||
|
||||
## About
|
||||
|
||||
vscode-texinfo is an extension of Visual Studio Code which aims at improving
|
||||
user experience for editing Texinfo documents.
|
||||
vscode-texinfo is an extension of [Visual Studio Code] which provides the
|
||||
following features for editing [Texinfo] documents:
|
||||
|
||||
Major features include:
|
||||
* Syntax Highlighting
|
||||
* Code Completion
|
||||
* HTML Preview
|
||||
|
@ -25,12 +24,12 @@ Major features include:
|
|||
|
||||
## Getting Started
|
||||
|
||||
For instructions about how to install, use, and contribute to vscode-texinfo,
|
||||
see the [online user manual].
|
||||
For instructions on how to install, use, and contribute to vscode-texinfo,
|
||||
see the [user manual].
|
||||
|
||||
<!-- Reference Links -->
|
||||
|
||||
[Build Status]: https://shields.io/drone/build/CismonX/vscode-texinfo?server=https%3A%2F%2Fdrone.cismon.net
|
||||
[Drone CI]: https://drone.cismon.net/CismonX/vscode-texinfo
|
||||
[Visual Studio Code]: https://github.com/microsoft/vscode
|
||||
[Texinfo]: https://www.gnu.org/software/texinfo/
|
||||
[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
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
@set vscode-docs-url https://code.visualstudio.com/docs
|
||||
@set vscode-api-url https://code.visualstudio.com/api
|
||||
@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
|
||||
\global\def\linkcolor{0 0 1}
|
||||
|
@ -20,7 +22,7 @@
|
|||
This manual is for vscode-texinfo (version @value{VERSION}), an extension of
|
||||
Visual Studio Code.
|
||||
|
||||
Copyright @copyright{} 2021 CismonX <admin@@cismon.net>
|
||||
Copyright @copyright{} 2021,2024 CismonX <admin@@cismon.net>
|
||||
|
||||
@quotation
|
||||
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
|
||||
Visual Studio Code.
|
||||
|
||||
Copyright @copyright{} 2021 CismonX <admin@@cismon.net>
|
||||
Copyright @copyright{} 2021,2024 CismonX <admin@@cismon.net>
|
||||
|
||||
This manual is licensed under a
|
||||
@url{https://creativecommons.org/licenses/by-sa/4.0/,
|
||||
|
@ -72,8 +74,8 @@ Creative Commons Attribution-ShareAlike 4.0 International License}.
|
|||
@chapter Overview
|
||||
|
||||
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
|
||||
non-GNU free software projects.
|
||||
the official documentation format for GNU projects, but not as popular in
|
||||
modern non-GNU free software projects.
|
||||
|
||||
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
|
||||
|
@ -99,11 +101,11 @@ version 3 of the License}, or (at your option) any later version.
|
|||
@node 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
|
||||
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.
|
||||
|
||||
|
||||
|
@ -120,7 +122,7 @@ binary release, which is proprietary software. You can also build it from
|
|||
|
||||
@quotation Note
|
||||
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.
|
||||
@end quotation
|
||||
|
||||
|
@ -139,7 +141,7 @@ and you can find and install this extension (Extension ID:
|
|||
@section Manual Installation
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@ifhtml
|
||||
@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}
|
||||
wget -O- '@value{sv-home-url}/people/viewgpg.php?user_id=214244' \
|
||||
| gpg --import
|
||||
wget -O- @value{sv-releases-url}/vscode-texinfo/@value{vsix-name}.sig.asc \
|
||||
| gpg --verify - @value{vsix-name}
|
||||
@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
|
||||
palette: @code{Extensions: Install from VSIX...}.
|
||||
|
@ -178,7 +164,7 @@ palette: @code{Extensions: Install from VSIX...}.
|
|||
@node 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:
|
||||
|
||||
|
@ -370,7 +356,7 @@ the extension. To manually trigger a refresh, click the status bar item.
|
|||
@section HTML Preview
|
||||
|
||||
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
|
||||
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.
|
||||
@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}.
|
||||
|
||||
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})
|
||||
@item @code{texinfo.preview.includePaths}: Array of extra paths to search for
|
||||
@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
|
||||
trigger an error.
|
||||
@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
|
||||
@code{@@set}). If a variable has a value, use the ASCII space character to
|
||||
separate key and value.
|
||||
@item @code{texinfo.preview.customizationVariables}: Array of customization
|
||||
variables. (@code{-c KEY=VALUE})
|
||||
@end itemize
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
52
package.json
52
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"_copyrightNotice": [
|
||||
"Copyright (C) 2020,2021,2022 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 permitted in any medium without royalty, provided the copyright notice and this notice are preserved.",
|
||||
"This file is offered as-is, without any warranty."
|
||||
|
@ -9,37 +9,37 @@
|
|||
"displayName": "Texinfo Language Support",
|
||||
"description": "Texinfo language support for Visual Studio Code",
|
||||
"publisher": "cismonx",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"author": {
|
||||
"name": "CismonX",
|
||||
"email": "admin@cismon.net",
|
||||
"url": "https://cismon.net"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"homepage": "https://sv.gnu.org/p/vscode-texinfo",
|
||||
"homepage": "https://savannah.nongnu.org/p/vscode-texinfo",
|
||||
"repository": {
|
||||
"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",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.17.29",
|
||||
"@types/vscode": "~1.40.0",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
||||
"@typescript-eslint/parser": "^5.10.2",
|
||||
"cson": "^7.20.0",
|
||||
"eslint": "^8.8.0",
|
||||
"@types/node": "^18.11.9",
|
||||
"@types/vscode": "~1.82.0",
|
||||
"@types/webpack": "^5.28.5",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
"@typescript-eslint/parser": "^7.5.0",
|
||||
"@vscode/vsce": "^2.24.0",
|
||||
"cson": "^8.4.0",
|
||||
"eslint": "^8.57.0",
|
||||
"json": "^11.0.0",
|
||||
"json5": "^2.2.0",
|
||||
"json5": "^2.2.3",
|
||||
"language-texinfo": "^1.1.0",
|
||||
"minify-xml": "^3.3.1",
|
||||
"ts-loader": "^9.2.6",
|
||||
"ts-node": "^10.4.0",
|
||||
"typescript": "^4.5.5",
|
||||
"vsce": "^2.6.6",
|
||||
"webpack": "^5.68.0",
|
||||
"webpack-cli": "^4.9.2"
|
||||
"minify-xml": "^4.4.1",
|
||||
"ts-loader": "^9.5.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.3",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "webpack --mode production",
|
||||
|
@ -79,7 +79,7 @@
|
|||
}
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.40.0"
|
||||
"vscode": "^1.82.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages",
|
||||
|
@ -87,9 +87,6 @@
|
|||
"Other"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"activationEvents": [
|
||||
"onLanguage:texinfo"
|
||||
],
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
|
@ -166,7 +163,7 @@
|
|||
"texinfo.makeinfo": {
|
||||
"type": "string",
|
||||
"default": "makeinfo",
|
||||
"description": "Path to the makeinfo (or texi2any) command."
|
||||
"description": "Path to the makeinfo (or texi2any) program."
|
||||
},
|
||||
"texinfo.preview.customCSS": {
|
||||
"type": "string",
|
||||
|
@ -204,12 +201,17 @@
|
|||
"texinfo.preview.noValidation": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Supress node cross-reference validation."
|
||||
"description": "Suppress node cross-reference validation."
|
||||
},
|
||||
"texinfo.preview.variables": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"description": "Define variables (as with @set)."
|
||||
},
|
||||
"texinfo.preview.customizationVariables": {
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"description": "Set customization variables (format: KEY=VAL)"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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
|
||||
# permitted in any medium without royalty, provided the copyright notice and
|
||||
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||
#
|
||||
|
||||
VSIX_FILE_NAME=texinfo-$(json -f package.json version).vsix
|
||||
PACKAGE_JSON_CLEANUP_JS=$(cat ./scripts/package-json-cleanup.js)
|
||||
set -e
|
||||
|
||||
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
|
||||
# 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
|
||||
json5 -o language-configuration.json{,}
|
||||
json5 language-configuration.json > _ && mv _ language-configuration.json
|
||||
# Remove comments from Markdown files.
|
||||
tail -n +9 README.md > _ && mv _ README.md
|
||||
tail -n +9 CHANGELOG.md > _ && mv _ CHANGELOG.md
|
||||
|
||||
cd ext
|
||||
# Minify Perl scripts.
|
||||
# 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
|
||||
rm html-preview.pm.bak
|
||||
fi
|
||||
cd ../../..
|
||||
|
||||
cd ../../..
|
||||
# Re-package .vsix file.
|
||||
node ./scripts/make-vsix.js $VSIX_FILE_NAME
|
||||
rm -r $VSIX_FILE_NAME.d
|
||||
node ./scripts/make-vsix.js "$vsix_file_name"
|
||||
rm -r "$vsix_file_name.d"
|
||||
|
|
|
@ -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
|
||||
# permitted in any medium without royalty, provided the copyright notice and
|
||||
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||
#
|
||||
|
||||
SRC_PATH=./node_modules/language-texinfo
|
||||
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
|
||||
set -e
|
||||
|
||||
VERSION=$(json -f package.json version)
|
||||
echo "@set VERSION $VERSION" > ./doc/version.texi
|
||||
src_path=./node_modules/language-texinfo
|
||||
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
|
||||
|
|
|
@ -30,7 +30,7 @@ import { FoldingRange, Optional } from '../utils/types';
|
|||
export default class DocumentSymbolContext
|
||||
{
|
||||
get documentSymbols() {
|
||||
return this._documentSymbols ??= this._calculcateDocumentSymbols();
|
||||
return this._documentSymbols ??= this._calculateDocumentSymbols();
|
||||
}
|
||||
|
||||
clear() {
|
||||
|
@ -46,7 +46,7 @@ export default class DocumentSymbolContext
|
|||
/**
|
||||
* Calculate document symbols based on folding ranges.
|
||||
*/
|
||||
private _calculcateDocumentSymbols() {
|
||||
private _calculateDocumentSymbols() {
|
||||
const ranges = Array<Optional<FoldingRange>>(this._document.lineCount);
|
||||
this._documentContext.foldingRange.foldingRanges
|
||||
.filter(range => range.kind === undefined)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -85,16 +85,19 @@ export default class Indicator implements vscode.Disposable
|
|||
const output
|
||||
= await exec(options.makeinfo, ['--version'], options.maxSize);
|
||||
const result = output.data?.match(/\(GNU texinfo\) (.*)\n/);
|
||||
let tooltip = '', icon: string, version = '';
|
||||
if (result && result[1]) {
|
||||
version = result[1];
|
||||
if (!isNaN(+version) && +version < 6.8) {
|
||||
icon = '$(warning)';
|
||||
tooltip = `GNU Texinfo (${options.makeinfo}) ` +
|
||||
`is outdated (${version} < 6.8).`;
|
||||
} else {
|
||||
// Unrecognizable version. Assume it is okay.
|
||||
icon = '$(check)';
|
||||
const version = result?.[1] ?? '';
|
||||
let tooltip = '', icon: string;
|
||||
if (version) {
|
||||
icon = '$(check)';
|
||||
const verArr = version.split('.');
|
||||
if (version.length >= 2) {
|
||||
const verMajor = parseInt(verArr[0], 10);
|
||||
const verMinor = parseInt(verArr[1], 10);
|
||||
if (verMajor < 7 || verMinor < 1) {
|
||||
icon = '$(warning)';
|
||||
tooltip = `GNU Texinfo (${options.makeinfo}) ` +
|
||||
`is outdated (${version} < 7.1).`;
|
||||
}
|
||||
}
|
||||
this._canDisplayPreview = true;
|
||||
} else {
|
||||
|
|
|
@ -80,6 +80,10 @@ export default class Options
|
|||
return this._getArray('preview.variables');
|
||||
}
|
||||
|
||||
get customizationVariables() {
|
||||
return this._getArray('preview.customizationVariables');
|
||||
}
|
||||
|
||||
private readonly _configuration
|
||||
= vscode.workspace.getConfiguration('texinfo');
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ export default class CompletionItemProvider
|
|||
* GNU Free Documentation License, version 1.3.
|
||||
*
|
||||
* 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
|
||||
* of the project.
|
||||
*
|
||||
|
@ -49,24 +49,24 @@ export default class CompletionItemProvider
|
|||
return this._completionItems ??= [
|
||||
command('ampchar',
|
||||
'Insert an ampersand, "&"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('atchar',
|
||||
'Insert an at sign, "@"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('backslashchar',
|
||||
'Insert a blackslash, "\\"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command(
|
||||
'lbracechar',
|
||||
'Insert a left brace, "{"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('rbracechar',
|
||||
'Insert a right brace, "}"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('abbr',
|
||||
'Indicate a general abbreviation',
|
||||
|
@ -84,7 +84,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('alias',
|
||||
'Defines a new command to be just like an existing one',
|
||||
{ snippet: true },
|
||||
{ _snippet: true },
|
||||
),
|
||||
...lineCommandEnum('allowcodebreaks',
|
||||
'Control breaking at "-" and "_" in TeX',
|
||||
|
@ -116,7 +116,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('arrow',
|
||||
'Generate a right arrow glyph, "→"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('asis',
|
||||
'Print the table’s first column without highlighting',
|
||||
|
@ -134,7 +134,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('bullet',
|
||||
'Generate a large round dot, "•"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('bye',
|
||||
'Stop formatting',
|
||||
|
@ -182,7 +182,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('click',
|
||||
'Represent a single "click" in a GUI',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('clicksequence',
|
||||
'Represent a sequence of clicks in a GUI',
|
||||
|
@ -206,7 +206,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('comma',
|
||||
'Insert a comma character, ","',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('command',
|
||||
'Indicate a command name',
|
||||
|
@ -224,12 +224,15 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('copyright',
|
||||
'The copyright symbol, "©"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...lineCommand('defcodeindex',
|
||||
'Define a new index, print entries in an @code font',
|
||||
'index-name',
|
||||
),
|
||||
...blockCommand('defblock',
|
||||
'Start a block containing definitions',
|
||||
),
|
||||
...lineCommandX('defcv',
|
||||
'Format a description for a variable associated with a class',
|
||||
'category', 'class', 'name',
|
||||
|
@ -245,7 +248,11 @@ export default class CompletionItemProvider
|
|||
...lineCommandX('defivar',
|
||||
'Format a description for an instance variable ' +
|
||||
'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',
|
||||
'Format a description for a macro',
|
||||
|
@ -297,6 +304,11 @@ export default class CompletionItemProvider
|
|||
'object-oriented programming',
|
||||
'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',
|
||||
'Format a description for a typed method in ' +
|
||||
'object-oriented programming',
|
||||
|
@ -346,6 +358,9 @@ export default class CompletionItemProvider
|
|||
...blockCommand('display',
|
||||
'Begin a kind of example',
|
||||
),
|
||||
...blockCommand('displaymath',
|
||||
'Format a block of math in "display" format',
|
||||
),
|
||||
...braceCommand('dmn',
|
||||
'Format a unit of measure, as in 12pt',
|
||||
1, 'dimension',
|
||||
|
@ -371,7 +386,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('dots',
|
||||
'Generate an ellipsis, "…"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('email',
|
||||
'Indicate an electronic mail address',
|
||||
|
@ -387,7 +402,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('enddots',
|
||||
'Generate an end-of-sentence ellipsis, "..."',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...blockCommand('enumerate',
|
||||
'Begin a numbered list, using @item for each entry',
|
||||
|
@ -399,12 +414,12 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('equiv',
|
||||
'Insert a glyph indicating exact equivalence, "≡"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('error',
|
||||
'Indicate that the following text is an error message, ' +
|
||||
'"error→"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('errormsg',
|
||||
'Report message as an error to standard error, ' +
|
||||
|
@ -413,7 +428,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('euro',
|
||||
'Generate the Euro currency sign, "€"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...headingFootingCommand('evenfooting',
|
||||
'Generate page footers that are the same for ' +
|
||||
|
@ -442,7 +457,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('expansion',
|
||||
'Indicate the result of a macro expansion with a glyph, "→"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('file',
|
||||
'Highlight the name of a file',
|
||||
|
@ -494,14 +509,14 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('geq',
|
||||
'Generate a greater-than-or-equal sign, "≥"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...blockCommand('group',
|
||||
'Disallow page breaks within following text',
|
||||
),
|
||||
command('hashchar',
|
||||
'Insert a hash character, "#"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...lineCommand('heading',
|
||||
'Print an unnumbered section-like heading',
|
||||
|
@ -552,6 +567,9 @@ export default class CompletionItemProvider
|
|||
...blockCommand('ifinfo',
|
||||
'Begin text that will appear only in Info format',
|
||||
),
|
||||
...blockCommand('iflatex',
|
||||
'Begin text that will appear only in LaTeX format',
|
||||
),
|
||||
...blockCommand('ifplaintext',
|
||||
'Begin text that will appear only in plain text format',
|
||||
),
|
||||
|
@ -574,6 +592,9 @@ export default class CompletionItemProvider
|
|||
...blockCommand('ifnotinfo',
|
||||
'Begin text to be ignored in Info format',
|
||||
),
|
||||
...blockCommand('ifnotlatex',
|
||||
'Begin text to be ignored in LaTeX format',
|
||||
),
|
||||
...blockCommand('ifnotplaintext',
|
||||
'Begin text to be ignored in plain text format',
|
||||
),
|
||||
|
@ -598,7 +619,7 @@ export default class CompletionItemProvider
|
|||
'Insert paragraph indentation',
|
||||
),
|
||||
...blockCommand('indentedblock',
|
||||
'Indent a block of arbitary text on the left',
|
||||
'Indent a block of arbitrary text on the left',
|
||||
),
|
||||
...braceCommand('indicateurl',
|
||||
'Indicate text that is a URL',
|
||||
|
@ -657,13 +678,16 @@ export default class CompletionItemProvider
|
|||
'Add entry to the index of keys',
|
||||
'entry',
|
||||
),
|
||||
...blockCommand('latex',
|
||||
'Enter LaTeX completely',
|
||||
),
|
||||
command('LaTeX',
|
||||
'Generate the LaTeX logo',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('leq',
|
||||
'Generate a less-than-or-equal sign, "≤"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...blockCommand('lisp',
|
||||
'Begin an example of Lisp code',
|
||||
|
@ -692,7 +716,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('minus',
|
||||
'Generate a minus sign, "-"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...blockCommand('multitable',
|
||||
'Begin a multi-column table',
|
||||
|
@ -736,7 +760,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('pagesizes',
|
||||
'Change page dimensions',
|
||||
{ snippet: true },
|
||||
{ _snippet: true },
|
||||
),
|
||||
...lineCommand('paragraphindent',
|
||||
'Indent paragraphs by spaces',
|
||||
|
@ -752,15 +776,15 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('point',
|
||||
'Indicate the position of point in a buffer with "∗"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('pounds',
|
||||
'Generate the pounds sterling currency sign, "£"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('print',
|
||||
'Indicate printed output to the reader with "-|"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...lineCommand('printindex',
|
||||
'Generate the alphabetized index for index name',
|
||||
|
@ -777,19 +801,19 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('quotedblleft',
|
||||
'Produce quotation mark "“"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('quotedblright',
|
||||
'Produce quotation mark "”"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('quoteleft',
|
||||
'Produce quotation mark "‘"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('quoteright',
|
||||
'Produce quotation mark "’"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('r',
|
||||
'Set text in the regular roman font',
|
||||
|
@ -810,11 +834,11 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('registeredsymbol',
|
||||
'Generate the legal symbol, "®"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('result',
|
||||
'Indicate the result of an expression with "⇒"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('samp',
|
||||
'Indicate a literal example of a sequence of characters',
|
||||
|
@ -952,14 +976,14 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('TeX',
|
||||
'Generate the TeX logo',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...blockCommand('tex',
|
||||
'Enter TeX completely',
|
||||
),
|
||||
command('textdegree',
|
||||
'Generate the degree symbol, "◦"',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
command('thischapter',
|
||||
'Insert the number and name of the current chapter',
|
||||
|
@ -982,7 +1006,7 @@ export default class CompletionItemProvider
|
|||
command('tie',
|
||||
'Generate a normal interword space at which a line break ' +
|
||||
'is not allowed',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...braceCommand('tieaccent',
|
||||
'Generate a tie-after accent over the two characters',
|
||||
|
@ -1005,7 +1029,7 @@ export default class CompletionItemProvider
|
|||
),
|
||||
command('today',
|
||||
'Insert the current date',
|
||||
{ hasEmptyBrace: true },
|
||||
{ _hasEmptyBrace: true },
|
||||
),
|
||||
...lineCommand('top',
|
||||
'Mark the topmost @node in the file',
|
||||
|
@ -1189,20 +1213,20 @@ function command(name: string, detail: string, extraArgs?: {
|
|||
/**
|
||||
* Whether this command has a snippet.
|
||||
*/
|
||||
snippet?: boolean,
|
||||
_snippet?: boolean,
|
||||
/**
|
||||
* Whether this command takes no arguments and braces are required.
|
||||
*/
|
||||
hasEmptyBrace?: boolean,
|
||||
_hasEmptyBrace?: boolean,
|
||||
}): CompletionItem {
|
||||
return {
|
||||
label: '@' + name,
|
||||
kind: vscode.CompletionItemKind.Function,
|
||||
detail: detail,
|
||||
sortText: name + (extraArgs?.snippet ? '1' : ''),
|
||||
sortText: name + (extraArgs?._snippet ? '1' : ''),
|
||||
filterText: name,
|
||||
insertText: name + (extraArgs?.hasEmptyBrace ? '{}' : ''),
|
||||
snippet: extraArgs?.snippet,
|
||||
insertText: name + (extraArgs?._hasEmptyBrace ? '{}' : ''),
|
||||
snippet: extraArgs?._snippet,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1219,7 +1243,7 @@ function blockCommand(
|
|||
...args: string[]
|
||||
) {
|
||||
return [blockSnippet(name, detail, ...args),
|
||||
command(name, detail, { snippet: true })];
|
||||
command(name, detail, { _snippet: true })];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1236,7 +1260,7 @@ function braceCommand(
|
|||
...args: string[]
|
||||
) {
|
||||
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[]) {
|
||||
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} \${1|${items.join(',')}|}`,
|
||||
),
|
||||
command(name, detail, { snippet: true }),
|
||||
command(name, detail, { _snippet: true }),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1290,7 +1314,7 @@ function headingFootingCommand(name: string, detail: string) {
|
|||
return [
|
||||
snippet(name, name, detail, 0, `@${name} left @| center @| right`,
|
||||
name + ' ${1:left} @| ${2:center} @| ${3:right}'),
|
||||
command(name, detail, { snippet: true }),
|
||||
command(name, detail, { _snippet: true }),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ export default class Converter
|
|||
}
|
||||
this._addIncludePaths(this._options.includePaths, options);
|
||||
this._defineVariables(this._options.variables, options);
|
||||
this._setCustomizationVariables(
|
||||
this._options.customizationVariables, options);
|
||||
this._includeCustomCSS(this._options.customCSS, options);
|
||||
return await exec(
|
||||
this._options.makeinfo,
|
||||
|
@ -75,6 +77,13 @@ export default class Converter
|
|||
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[]) {
|
||||
if (!cssFileURI) {
|
||||
return;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2019",
|
||||
"target": "ES2021",
|
||||
"outDir": "out",
|
||||
"esModuleInterop": true,
|
||||
"strictNullChecks": true,
|
||||
|
|
Loading…
Reference in New Issue