Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
ed968839b6 | |||
f8bcf86fb1 | |||
8f289fbcb8 | |||
afe3694a88 | |||
530902128c | |||
1294764698 | |||
9de1ba26b0 | |||
13feb8a1f4 | |||
ad685014d2 | |||
3f8c23d917 | |||
3b3478decb | |||
a5837defce | |||
5e86022e32 | |||
229d84bd2d | |||
c3e33c3340 | |||
2275b94c1d | |||
7820db6955 | |||
26c8d32129 | |||
c111ec89a0 | |||
3896bf44db |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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/
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
**/*.map
|
**/*.map
|
||||||
**/*.ts
|
**/*.ts
|
||||||
.drone.yml
|
.woodpecker.yml
|
||||||
.gitignore
|
.gitignore
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.travis.yml
|
.travis.yml
|
||||||
|
|
|
@ -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
|
21
CHANGELOG.md
21
CHANGELOG.md
|
@ -1,13 +1,26 @@
|
||||||
<!--
|
<!--
|
||||||
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
|
||||||
|
|
||||||
|
* Fix a bug which prevents diagnostic info from displaying correctly in GNU Texinfo 6.8, and on Windows platform.
|
||||||
|
|
||||||
## v0.2.2 - 10/03/2021
|
## v0.2.2 - 10/03/2021
|
||||||
|
|
||||||
* Fix a bug which breaks configuration `preview.includePaths` on Windows.
|
* Fix a bug which breaks configuration `preview.includePaths` on Windows.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2021 CismonX <admin@cismon.net>
|
Copyright (C) 2021 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.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# License Notice
|
# License Notice
|
||||||
|
@ -13,34 +13,32 @@ this notice are preserved. This file is offered as-is, without any warranty.
|
||||||
Project files listed below cannot carry a license notice by themselves, due to
|
Project files listed below cannot carry a license notice by themselves, due to
|
||||||
file format restrictions.
|
file format restrictions.
|
||||||
|
|
||||||
```text
|
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].
|
||||||
|
|
||||||
```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.
|
|
||||||
```
|
|
||||||
|
|
||||||
## 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.
|
||||||
|
|
||||||
| Project | Copyright Holder | License |
|
| Project | Copyright Holder | License |
|
||||||
| - | - | - |
|
| - | - | - |
|
||||||
| [Texinfo syntax highlighting](https://github.com/Alhadis/language-texinfo) | John Gardner | [ISC](https://github.com/Alhadis/language-texinfo/blob/master/LICENSE.md) |
|
| [Texinfo syntax highlighting] | John Gardner | [ISC](https://github.com/Alhadis/language-texinfo/blob/master/LICENSE.md) |
|
||||||
|
|
||||||
The following projects are required during runtime of vscode-texinfo, but as
|
The following projects are required during runtime of vscode-texinfo, but as
|
||||||
separate programs.
|
separate programs.
|
||||||
|
|
||||||
| Project | Copyright Holder | License |
|
| Project | Copyright Holder | License |
|
||||||
| - | - | - |
|
| - | - | - |
|
||||||
| [Visual Studio Code](https://github.com/microsoft/vscode) | Microsoft Corporation | [MIT](https://github.com/microsoft/vscode/blob/main/LICENSE.txt) |
|
| [Visual Studio Code] | Microsoft Corporation | [MIT](https://github.com/microsoft/vscode/blob/main/LICENSE.txt) |
|
||||||
| [GNU Texinfo](https://www.gnu.org/software/texinfo) | Free Software Foundation | [GPL-3.0](https://git.savannah.gnu.org/cgit/texinfo.git/tree/COPYING)-or-later |
|
| [GNU Texinfo] | Free Software Foundation | [GPL-3.0](https://git.savannah.gnu.org/cgit/texinfo.git/tree/COPYING)-or-later |
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 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
|
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
5591
package-lock.json
generated
5591
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
52
package.json
52
package.json
|
@ -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.2",
|
"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.20",
|
"@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": "^4.32.0",
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||||
"@typescript-eslint/parser": "^4.32.0",
|
"@typescript-eslint/parser": "^7.5.0",
|
||||||
"cson": "^7.20.0",
|
"@vscode/vsce": "^2.24.0",
|
||||||
"eslint": "^7.32.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.2.1",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^4.4.3",
|
"typescript": "^5.4.3",
|
||||||
"vsce": "^1.100.1",
|
"webpack": "^5.91.0",
|
||||||
"webpack": "^5.56.0",
|
"webpack-cli": "^5.1.4"
|
||||||
"webpack-cli": "^4.8.0"
|
|
||||||
},
|
},
|
||||||
"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)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -97,7 +97,9 @@ export default class ContextMapping implements vscode.Disposable
|
||||||
|
|
||||||
private _onDocumentSave(document: vscode.TextDocument) {
|
private _onDocumentSave(document: vscode.TextDocument) {
|
||||||
const documentContext = this._tryGetDocumentContext(document);
|
const documentContext = this._tryGetDocumentContext(document);
|
||||||
if (documentContext === undefined) return;
|
if (documentContext === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
documentContext.foldingRange.clear();
|
documentContext.foldingRange.clear();
|
||||||
documentContext.getPreview()?.updateWebview();
|
documentContext.getPreview()?.updateWebview();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -54,7 +54,9 @@ export default class FoldingRangeContext
|
||||||
*/
|
*/
|
||||||
update(events: readonly vscode.TextDocumentContentChangeEvent[]) {
|
update(events: readonly vscode.TextDocumentContentChangeEvent[]) {
|
||||||
this._contentMayChange = true;
|
this._contentMayChange = true;
|
||||||
if (this._foldingRanges === undefined) return false;
|
if (this._foldingRanges === undefined) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const eol = this._document.eol === vscode.EndOfLine.LF ? '\n' : '\r\n';
|
const eol = this._document.eol === vscode.EndOfLine.LF ? '\n' : '\r\n';
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
// Clear cached folding range when line count changes.
|
// Clear cached folding range when line count changes.
|
||||||
|
@ -147,7 +149,9 @@ export default class FoldingRangeContext
|
||||||
}
|
}
|
||||||
// Process block.
|
// Process block.
|
||||||
if (line.startsWith('@end ')) {
|
if (line.startsWith('@end ')) {
|
||||||
if (verbatim) continue;
|
if (verbatim) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const name = line.substring(5).trimRight();
|
const name = line.substring(5).trimRight();
|
||||||
if (name === 'verbatim') {
|
if (name === 'verbatim') {
|
||||||
verbatim = true;
|
verbatim = true;
|
||||||
|
@ -193,14 +197,20 @@ export default class FoldingRangeContext
|
||||||
private _getLastTextLine(lineNum: number, limit = 3) {
|
private _getLastTextLine(lineNum: number, limit = 3) {
|
||||||
for (let idx = lineNum; idx > lineNum - limit; --idx) {
|
for (let idx = lineNum; idx > lineNum - limit; --idx) {
|
||||||
const line = this._document.lineAt(idx).text;
|
const line = this._document.lineAt(idx).text;
|
||||||
if (line.startsWith('@node ')) return idx - 1;
|
if (line.startsWith('@node ')) {
|
||||||
if (line === '') return idx;
|
return idx - 1;
|
||||||
|
}
|
||||||
|
if (line === '') {
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return lineNum;
|
return lineNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _processComment(lineText: string, lineNum: number) {
|
private _processComment(lineText: string, lineNum: number) {
|
||||||
if (!lineText.startsWith('@c')) return false;
|
if (!lineText.startsWith('@c')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (lineText.charAt(2) != ' ' && !lineText.startsWith('omment ', 2)) {
|
if (lineText.charAt(2) != ' ' && !lineText.startsWith('omment ', 2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +243,9 @@ export default class FoldingRangeContext
|
||||||
lastLineNum: number,
|
lastLineNum: number,
|
||||||
) {
|
) {
|
||||||
const result = lineText.match(FoldingRangeContext._nodeFormat);
|
const result = lineText.match(FoldingRangeContext._nodeFormat);
|
||||||
if (result === null) return false;
|
if (result === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Node identifier.
|
// Node identifier.
|
||||||
if (result[1] !== undefined) {
|
if (result[1] !== undefined) {
|
||||||
this._nodes.push(new vscode.CodeLens(lineNumToRange(lineNum), {
|
this._nodes.push(new vscode.CodeLens(lineNumToRange(lineNum), {
|
||||||
|
|
|
@ -127,7 +127,9 @@ export default class PreviewContext
|
||||||
* preview with code lens.
|
* preview with code lens.
|
||||||
*/
|
*/
|
||||||
private get _script() {
|
private get _script() {
|
||||||
if (!this._globalContext.options.enableCodeLens) return undefined;
|
if (!this._globalContext.options.enableCodeLens) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
return "window.addEventListener('message', event => {" +
|
return "window.addEventListener('message', event => {" +
|
||||||
"const message = event.data;" +
|
"const message = event.data;" +
|
||||||
"switch (message.command) {" +
|
"switch (message.command) {" +
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
* vscode-texinfo. If not, see <https://www.gnu.org/licenses/>.
|
* vscode-texinfo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import * as path from 'path';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { lineNumToRange } from './utils/misc';
|
import { escapeStringForRegExp, lineNumToRange } from './utils/misc';
|
||||||
import { isDefined } from './utils/types';
|
import { isDefined } from './utils/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,10 +45,19 @@ export default class Diagnosis implements vscode.Disposable
|
||||||
* @param logText
|
* @param logText
|
||||||
*/
|
*/
|
||||||
update(document: vscode.TextDocument, logText: string) {
|
update(document: vscode.TextDocument, logText: string) {
|
||||||
const fileName = document.uri.path;
|
const fileName = path.basename(document.uri.path);
|
||||||
|
const regex = new RegExp(`${escapeStringForRegExp(fileName)}:\\d+:`);
|
||||||
const diagnostics = logText.split('\n')
|
const diagnostics = logText.split('\n')
|
||||||
.filter(line => line.startsWith(fileName))
|
.map(line => line.length > 0 ? line.match(regex) : null)
|
||||||
.map(line => logToDiagnostic(line.substring(fileName.length + 1)))
|
.map(result => {
|
||||||
|
const index = result?.index;
|
||||||
|
const line = result?.input;
|
||||||
|
if (index === undefined || line === undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const logText = line.substring(index + fileName.length + 1);
|
||||||
|
return logToDiagnostic(logText);
|
||||||
|
})
|
||||||
.filter(isDefined);
|
.filter(isDefined);
|
||||||
this._diagnostics.set(document.uri, diagnostics);
|
this._diagnostics.set(document.uri, diagnostics);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)';
|
||||||
|
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)';
|
icon = '$(warning)';
|
||||||
tooltip = `GNU Texinfo (${options.makeinfo}) ` +
|
tooltip = `GNU Texinfo (${options.makeinfo}) ` +
|
||||||
`is outdated (${version} < 6.8).`;
|
`is outdated (${version} < 7.1).`;
|
||||||
} else {
|
}
|
||||||
// Unrecognizable version. Assume it is okay.
|
|
||||||
icon = '$(check)';
|
|
||||||
}
|
}
|
||||||
this._canDisplayPreview = true;
|
this._canDisplayPreview = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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');
|
||||||
|
|
||||||
|
|
|
@ -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 table’s first column without highlighting',
|
'Print the table’s 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',
|
||||||
|
@ -1156,7 +1180,9 @@ export default class CompletionItemProvider
|
||||||
this._oldOptions = newOptions;
|
this._oldOptions = newOptions;
|
||||||
this._completionItems = undefined;
|
this._completionItems = undefined;
|
||||||
}
|
}
|
||||||
if (position.character === 1) return this._getCompletionItems();
|
if (position.character === 1) {
|
||||||
|
return this._getCompletionItems();
|
||||||
|
}
|
||||||
// Check whether the '@' character is escaped.
|
// Check whether the '@' character is escaped.
|
||||||
const secondCharBeforeWord = new vscode.Range(
|
const secondCharBeforeWord = new vscode.Range(
|
||||||
position.translate(0, -2),
|
position.translate(0, -2),
|
||||||
|
@ -1187,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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,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 })];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1234,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 })];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1246,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 })];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1274,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 }),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1288,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 }),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,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}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import * as path from 'path';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import Logger from '../logger';
|
import Logger from '../logger';
|
||||||
import Options from '../options';
|
import Options from '../options';
|
||||||
import { exec } from './misc';
|
import { exec, normalizePath } from './misc';
|
||||||
import { Operator } from './types';
|
import { Operator } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,8 +32,8 @@ import { Operator } from './types';
|
||||||
export default class Converter
|
export default class Converter
|
||||||
{
|
{
|
||||||
async toHTML(imgTransformer: Operator<vscode.Uri>, insertScript?: string) {
|
async toHTML(imgTransformer: Operator<vscode.Uri>, insertScript?: string) {
|
||||||
const pathUri = vscode.Uri.file(path.dirname(this._path));
|
const pathUri = vscode.Uri.file(path.dirname(this._pathName) + '/');
|
||||||
const newPath = imgTransformer(pathUri).toString() + '/';
|
const newPath = normalizePath(imgTransformer(pathUri).toString());
|
||||||
const options = ['-o-', '--no-split', '--html',
|
const options = ['-o-', '--no-split', '--html',
|
||||||
`--error-limit=${this._options.errorLimit}`,
|
`--error-limit=${this._options.errorLimit}`,
|
||||||
`--init-file=${this._initFile}`,
|
`--init-file=${this._initFile}`,
|
||||||
|
@ -48,37 +48,27 @@ 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,
|
||||||
options.concat(this._path),
|
options.concat(normalizePath(this._pathName)),
|
||||||
this._options.maxSize,
|
this._options.maxSize,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
path: string,
|
private readonly _pathName: string,
|
||||||
private readonly _initFile: string,
|
private readonly _initFile: string,
|
||||||
private readonly _options: Options,
|
private readonly _options: Options,
|
||||||
private readonly _logger: Logger,
|
private readonly _logger: Logger,
|
||||||
) {
|
) {}
|
||||||
if (process.platform === 'win32') {
|
|
||||||
// TODO:
|
|
||||||
// On Windows, when passing the path of input file to makeinfo,
|
|
||||||
// using backslashes in path name breaks some other command line
|
|
||||||
// options (notably, -I).
|
|
||||||
// Not sure if this is a bug of makeinfo, or perl, or neither.
|
|
||||||
// We should look into this issue sometime later.
|
|
||||||
this._path = path.replace(/\\/g, '/');
|
|
||||||
} else {
|
|
||||||
this._path = path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly _path: string;
|
|
||||||
|
|
||||||
private _addIncludePaths(paths: readonly string[], options: string[]) {
|
private _addIncludePaths(paths: readonly string[], options: string[]) {
|
||||||
if (paths.length === 0) return;
|
if (paths.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const separator = process.platform === 'win32' ? ';' : ':';
|
const separator = process.platform === 'win32' ? ';' : ':';
|
||||||
options.push('-I', paths.join(separator));
|
options.push('-I', paths.join(separator));
|
||||||
}
|
}
|
||||||
|
@ -87,13 +77,22 @@ 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) return;
|
if (!cssFileURI) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const uri = vscode.Uri.parse(cssFileURI, true);
|
const uri = vscode.Uri.parse(cssFileURI, true);
|
||||||
switch (uri.scheme) {
|
switch (uri.scheme) {
|
||||||
case 'file':
|
case 'file':
|
||||||
options.push(`--css-include=${uri.path}`);
|
options.push(`--css-include=${normalizePath(uri.fsPath)}`);
|
||||||
break;
|
break;
|
||||||
case 'http':
|
case 'http':
|
||||||
case 'https':
|
case 'https':
|
||||||
|
|
|
@ -20,9 +20,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as child_process from 'child_process';
|
import * as child_process from 'child_process';
|
||||||
|
import * as path from 'path';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { ExecResult } from './types';
|
import { ExecResult } from './types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escape string to match verbatim in regular expression.
|
||||||
|
*
|
||||||
|
* @param str The string to be escaped.
|
||||||
|
* @returns The escaped string.
|
||||||
|
*/
|
||||||
|
export function escapeStringForRegExp(str: string) {
|
||||||
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute command and fetch output.
|
* Execute command and fetch output.
|
||||||
*
|
*
|
||||||
|
@ -35,7 +46,7 @@ export function exec(path: string, args: string[], maxBuffer: number) {
|
||||||
return new Promise<ExecResult>(
|
return new Promise<ExecResult>(
|
||||||
resolve => child_process.execFile(path, args,
|
resolve => child_process.execFile(path, args,
|
||||||
{
|
{
|
||||||
env: { ...process.env, LC_MESSAGES: 'en_US' },
|
env: { ...process.env, LC_MESSAGES: 'en_US.UTF-8' },
|
||||||
maxBuffer: maxBuffer,
|
maxBuffer: maxBuffer,
|
||||||
},
|
},
|
||||||
(error, stdout, stderr) => resolve(error
|
(error, stdout, stderr) => resolve(error
|
||||||
|
@ -94,8 +105,8 @@ export function isAlnum(charCode: number) {
|
||||||
/**
|
/**
|
||||||
* Get corresponding HTML cross-reference name by node name.
|
* Get corresponding HTML cross-reference name by node name.
|
||||||
*
|
*
|
||||||
* See section *HTML Cross-reference Node Name Expansion* in
|
* See section *HTML Cross-reference Node Name Expansion* in the
|
||||||
* the Texinfo manual.
|
* GNU Texinfo manual.
|
||||||
*
|
*
|
||||||
* TODO: Node name is not displayed verbatim, leading to wrong HTML xref when
|
* TODO: Node name is not displayed verbatim, leading to wrong HTML xref when
|
||||||
* containing commands. Fix this when migrating to LSP.
|
* containing commands. Fix this when migrating to LSP.
|
||||||
|
@ -116,3 +127,18 @@ export function getNodeHtmlRef(nodeName: string) {
|
||||||
? result
|
? result
|
||||||
: 'g_t_00' + firstCharCode.toString(16) + result.substring(1);
|
: 'g_t_00' + firstCharCode.toString(16) + result.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizePath(pathName: string) {
|
||||||
|
pathName = path.normalize(pathName);
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
// On Windows, when passing the path of input file to makeinfo,
|
||||||
|
// using backslashes in path name breaks some other command line
|
||||||
|
// options (notably, -I).
|
||||||
|
// Not sure if this is a bug of makeinfo, or perl, or neither.
|
||||||
|
//
|
||||||
|
// TODO: We should look into this issue sometime later.
|
||||||
|
return pathName.replace(/\\/g, '/');
|
||||||
|
} else {
|
||||||
|
return pathName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2019",
|
"target": "ES2021",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user