summaryrefslogtreecommitdiff
path: root/support/texlab
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-03-13 03:04:43 +0000
committerNorbert Preining <norbert@preining.info>2023-03-13 03:04:43 +0000
commite3c18c7072eebabaa706008b7fa42c73ec2ff83e (patch)
treebdd26a908e2baa0a97a38169346e53b9e6e51944 /support/texlab
parentb3d8df92a44aa1df24a0869d728b45b0baeaa54c (diff)
CTAN sync 202303130304
Diffstat (limited to 'support/texlab')
-rw-r--r--support/texlab/CHANGELOG.md22
-rw-r--r--support/texlab/Cargo.lock320
-rw-r--r--support/texlab/Cargo.toml9
-rw-r--r--support/texlab/README.md1
-rw-r--r--support/texlab/data/lang_data.json49
-rw-r--r--support/texlab/src/client.rs2
-rw-r--r--support/texlab/src/config.rs230
-rw-r--r--support/texlab/src/db.rs3
-rw-r--r--support/texlab/src/db/analysis.rs62
-rw-r--r--support/texlab/src/db/context.rs18
-rw-r--r--support/texlab/src/db/diagnostics.rs6
-rw-r--r--support/texlab/src/db/diagnostics/bib.rs4
-rw-r--r--support/texlab/src/db/diagnostics/log.rs4
-rw-r--r--support/texlab/src/db/diagnostics/tex.rs38
-rw-r--r--support/texlab/src/db/discovery.rs9
-rw-r--r--support/texlab/src/db/document.rs41
-rw-r--r--support/texlab/src/db/workspace.rs35
-rw-r--r--support/texlab/src/features/build.rs15
-rw-r--r--support/texlab/src/features/completion/builder.rs19
-rw-r--r--support/texlab/src/features/completion/user_command.rs2
-rw-r--r--support/texlab/src/features/definition.rs3
-rw-r--r--support/texlab/src/features/definition/command.rs2
-rw-r--r--support/texlab/src/features/definition/document.rs2
-rw-r--r--support/texlab/src/features/folding.rs2
-rw-r--r--support/texlab/src/features/formatting.rs18
-rw-r--r--support/texlab/src/features/formatting/bibtex_internal.rs15
-rw-r--r--support/texlab/src/features/formatting/latexindent.rs18
-rw-r--r--support/texlab/src/features/forward_search.rs34
-rw-r--r--support/texlab/src/features/highlight/label.rs2
-rw-r--r--support/texlab/src/features/hover.rs2
-rw-r--r--support/texlab/src/features/inlay_hint.rs2
-rw-r--r--support/texlab/src/features/inlay_hint/label.rs21
-rw-r--r--support/texlab/src/features/link.rs2
-rw-r--r--support/texlab/src/features/reference.rs1
-rw-r--r--support/texlab/src/features/rename.rs4
-rw-r--r--support/texlab/src/features/rename/command.rs4
-rw-r--r--support/texlab/src/features/symbol.rs4
-rw-r--r--support/texlab/src/features/symbol/bibtex.rs2
-rw-r--r--support/texlab/src/features/symbol/latex.rs29
-rw-r--r--support/texlab/src/features/symbol/types.rs10
-rw-r--r--support/texlab/src/features/workspace_command.rs106
-rw-r--r--support/texlab/src/features/workspace_command/change_environment.rs108
-rw-r--r--support/texlab/src/features/workspace_command/clean.rs95
-rw-r--r--support/texlab/src/features/workspace_command/dep_graph.rs57
-rw-r--r--support/texlab/src/lib.rs25
-rw-r--r--support/texlab/src/options.rs144
-rw-r--r--support/texlab/src/parser/latex.rs811
-rw-r--r--support/texlab/src/parser/latex/lexer.rs656
-rw-r--r--support/texlab/src/parser/latex/lexer/commands.rs93
-rw-r--r--support/texlab/src/parser/latex/lexer/types.rs132
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap16
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap27
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap8
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap11
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap6
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap1
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap7
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap1
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap1
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap1
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap1
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap8
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap61
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap62
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap33
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap5
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap10
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap14
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap4
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap3
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap2
-rw-r--r--support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap3
-rw-r--r--support/texlab/src/parser/test_data/latex/issue_853.txt8
-rw-r--r--support/texlab/src/parser/test_data/latex/issue_857.txt3
-rw-r--r--support/texlab/src/server.rs127
-rw-r--r--support/texlab/src/server/options.rs214
-rw-r--r--support/texlab/src/syntax/latex/cst.rs4
-rw-r--r--support/texlab/src/syntax/latex/kind.rs97
-rw-r--r--support/texlab/src/tests.rs5
-rw-r--r--support/texlab/src/util/chktex.rs2
-rw-r--r--support/texlab/src/util/cursor.rs27
-rw-r--r--support/texlab/src/util/label.rs22
-rw-r--r--support/texlab/src/util/lang_data.rs2
-rw-r--r--support/texlab/src/util/regex_filter.rs12
-rw-r--r--support/texlab/tests/lsp/fixture.rs17
-rw-r--r--support/texlab/tests/lsp/text_document/completion.rs33
-rw-r--r--support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap21
-rw-r--r--support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap11
-rw-r--r--support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap8
-rw-r--r--support/texlab/texlab.14
-rw-r--r--support/texlab/texlab.pdfbin26587 -> 26342 bytes
178 files changed, 2223 insertions, 2226 deletions
diff --git a/support/texlab/CHANGELOG.md b/support/texlab/CHANGELOG.md
index c2f8560a64..7853c1c9b6 100644
--- a/support/texlab/CHANGELOG.md
+++ b/support/texlab/CHANGELOG.md
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [5.4.0] - 2023-03-12
+
+### Added
+
+- Add experimental settings to allow extending the list of special environments:
+ - `texlab.experimental.mathEnvironments`
+ - `texlab.experimental.enumEnvironments`
+ - `texlab.experimental.verbatimEnvironments`
+- Add `texlab.changeEnvironment` workspace command ([#849](https://github.com/latex-lsp/texlab/issues/849))
+- Add `texlab.showDependencyGraph` workspace command
+
+### Changed
+
+- Do not show caption or section names in label inlay hints ([#858](https://github.com/latex-lsp/texlab/issues/858))
+- Include more user-defined commands in command completion
+
+### Fixed
+
+- Parse nested `\iffalse` blocks correctly ([#853](https://github.com/latex-lsp/texlab/issues/853))
+- Parse commands with multi-byte characters correctly ([#857](https://github.com/latex-lsp/texlab/issues/857))
+- Fix checking whether a document can be a root file
+
## [5.3.0] - 2023-02-25
### Added
diff --git a/support/texlab/Cargo.lock b/support/texlab/Cargo.lock
index 69c810d702..59566d3b49 100644
--- a/support/texlab/Cargo.lock
+++ b/support/texlab/Cargo.lock
@@ -95,18 +95,18 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
-version = "0.10.3"
+version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "bstr"
-version = "1.1.0"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b"
+checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1"
dependencies = [
"memchr",
"serde",
@@ -187,13 +187,13 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.1.6"
+version = "4.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
+checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5"
dependencies = [
"bitflags",
"clap_derive",
- "clap_lex 0.3.1",
+ "clap_lex 0.3.2",
"is-terminal",
"once_cell",
"strsim",
@@ -202,9 +202,9 @@ dependencies = [
[[package]]
name = "clap_derive"
-version = "4.1.0"
+version = "4.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
+checksum = "44bec8e5c9d09e439c4335b1af0abaab56dcf3b94999a936e1bb47b9134288f0"
dependencies = [
"heck",
"proc-macro-error",
@@ -224,9 +224,9 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
+checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09"
dependencies = [
"os_str_bytes",
]
@@ -240,7 +240,7 @@ dependencies = [
"encode_unicode",
"lazy_static",
"libc",
- "windows-sys",
+ "windows-sys 0.42.0",
]
[[package]]
@@ -319,9 +319,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
-version = "0.5.6"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
+checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c"
dependencies = [
"cfg-if",
"crossbeam-utils",
@@ -329,9 +329,9 @@ dependencies = [
[[package]]
name = "crossbeam-deque"
-version = "0.8.2"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
+checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
dependencies = [
"cfg-if",
"crossbeam-epoch",
@@ -340,14 +340,14 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
-version = "0.9.13"
+version = "0.9.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a"
+checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
dependencies = [
"autocfg",
"cfg-if",
"crossbeam-utils",
- "memoffset 0.7.1",
+ "memoffset 0.8.0",
"scopeguard",
]
@@ -363,9 +363,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.14"
+version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
+checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
dependencies = [
"cfg-if",
]
@@ -454,19 +454,6 @@ dependencies = [
]
[[package]]
-name = "env_logger"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
-dependencies = [
- "humantime",
- "is-terminal",
- "log",
- "regex",
- "termcolor",
-]
-
-[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -499,9 +486,9 @@ dependencies = [
[[package]]
name = "fastrand"
-version = "1.8.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
@@ -517,14 +504,14 @@ dependencies = [
[[package]]
name = "filetime"
-version = "0.2.19"
+version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9"
+checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
- "windows-sys",
+ "windows-sys 0.45.0",
]
[[package]]
@@ -576,15 +563,15 @@ dependencies = [
[[package]]
name = "futures-core"
-version = "0.3.25"
+version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
+checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
[[package]]
name = "futures-sink"
-version = "0.3.25"
+version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
+checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
[[package]]
name = "fuzzy-matcher"
@@ -657,9 +644,9 @@ dependencies = [
[[package]]
name = "heck"
-version = "0.4.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
@@ -680,6 +667,12 @@ dependencies = [
]
[[package]]
+name = "hermit-abi"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
+
+[[package]]
name = "human_name"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -700,12 +693,6 @@ dependencies = [
]
[[package]]
-name = "humantime"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
-
-[[package]]
name = "idna"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -780,24 +767,24 @@ dependencies = [
[[package]]
name = "io-lifetimes"
-version = "1.0.4"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
+checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3"
dependencies = [
"libc",
- "windows-sys",
+ "windows-sys 0.45.0",
]
[[package]]
name = "is-terminal"
-version = "0.4.2"
+version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
+checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
dependencies = [
- "hermit-abi 0.2.6",
+ "hermit-abi 0.3.1",
"io-lifetimes",
"rustix",
- "windows-sys",
+ "windows-sys 0.45.0",
]
[[package]]
@@ -821,15 +808,9 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
-
-[[package]]
-name = "jod-thread"
-version = "0.1.2"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b23360e99b8717f20aaa4598f5a6541efbe30630039fbc7706cf954a87947ae"
+checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
[[package]]
name = "joinery"
@@ -839,9 +820,9 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5"
[[package]]
name = "js-sys"
-version = "0.3.60"
+version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
+checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
dependencies = [
"wasm-bindgen",
]
@@ -874,9 +855,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.139"
+version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "linked-hash-map"
@@ -974,9 +955,9 @@ dependencies = [
[[package]]
name = "memoffset"
-version = "0.7.1"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
+checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
dependencies = [
"autocfg",
]
@@ -992,14 +973,14 @@ dependencies = [
[[package]]
name = "mio"
-version = "0.8.5"
+version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
+checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
dependencies = [
"libc",
"log",
"wasi",
- "windows-sys",
+ "windows-sys 0.45.0",
]
[[package]]
@@ -1026,7 +1007,7 @@ dependencies = [
"libc",
"mio",
"walkdir",
- "windows-sys",
+ "windows-sys 0.42.0",
]
[[package]]
@@ -1088,15 +1069,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.6"
+version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
+checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
- "windows-sys",
+ "windows-sys 0.45.0",
]
[[package]]
@@ -1107,9 +1088,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
-version = "2.5.4"
+version = "2.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f"
+checksum = "8cbd939b234e95d72bc393d51788aec68aeeb5d51e748ca08ff3aad58cb722f7"
dependencies = [
"thiserror",
"ucd-trie",
@@ -1117,9 +1098,9 @@ dependencies = [
[[package]]
name = "pest_derive"
-version = "2.5.4"
+version = "2.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8bf026e2d0581559db66d837fe5242320f525d85c76283c61f4d51a1238d65ea"
+checksum = "a81186863f3d0a27340815be8f2078dd8050b14cd71913db9fbda795e5f707d7"
dependencies = [
"pest",
"pest_generator",
@@ -1127,9 +1108,9 @@ dependencies = [
[[package]]
name = "pest_generator"
-version = "2.5.4"
+version = "2.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b27bd18aa01d91c8ed2b61ea23406a676b42d82609c6e2581fba42f0c15f17f"
+checksum = "75a1ef20bf3193c15ac345acb32e26b3dc3223aff4d77ae4fc5359567683796b"
dependencies = [
"pest",
"pest_meta",
@@ -1140,9 +1121,9 @@ dependencies = [
[[package]]
name = "pest_meta"
-version = "2.5.4"
+version = "2.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f02b677c1859756359fc9983c2e56a0237f18624a3789528804406b7e915e5d"
+checksum = "5e3b284b1f13a20dc5ebc90aff59a51b8d7137c221131b52a7260c08cbc1cc80"
dependencies = [
"once_cell",
"pest",
@@ -1261,9 +1242,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.50"
+version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
+checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [
"unicode-ident",
]
@@ -1294,9 +1275,9 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "rayon"
-version = "1.6.1"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7"
+checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
dependencies = [
"either",
"rayon-core",
@@ -1304,9 +1285,9 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.10.2"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b"
+checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
@@ -1352,15 +1333,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
-name = "remove_dir_all"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
-dependencies = [
- "winapi",
-]
-
-[[package]]
name = "rowan"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1381,34 +1353,34 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
-version = "0.36.7"
+version = "0.36.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
+checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
- "windows-sys",
+ "windows-sys 0.45.0",
]
[[package]]
name = "rustversion"
-version = "1.0.11"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
+checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
[[package]]
name = "ryu"
-version = "1.0.12"
+version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
+checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
[[package]]
name = "salsa-2022"
version = "0.1.0"
-source = "git+https://github.com/salsa-rs/salsa?rev=20c7834ff34fd00a41b59bec61f3d5c85ea3abd4#20c7834ff34fd00a41b59bec61f3d5c85ea3abd4"
+source = "git+https://github.com/salsa-rs/salsa?rev=ef7c0f12c8159e7025316e959c26f6278a576fa5#ef7c0f12c8159e7025316e959c26f6278a576fa5"
dependencies = [
"arc-swap",
"crossbeam",
@@ -1426,7 +1398,7 @@ dependencies = [
[[package]]
name = "salsa-2022-macros"
version = "0.1.0"
-source = "git+https://github.com/salsa-rs/salsa?rev=20c7834ff34fd00a41b59bec61f3d5c85ea3abd4#20c7834ff34fd00a41b59bec61f3d5c85ea3abd4"
+source = "git+https://github.com/salsa-rs/salsa?rev=ef7c0f12c8159e7025316e959c26f6278a576fa5#ef7c0f12c8159e7025316e959c26f6278a576fa5"
dependencies = [
"eyre",
"heck",
@@ -1452,18 +1424,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
-version = "1.0.152"
+version = "1.0.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
+checksum = "8cdd151213925e7f1ab45a9bbfb129316bd00799784b174b7cc7bcd16961c49e"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.152"
+version = "1.0.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
+checksum = "4fc80d722935453bcafdc2c9a73cd6fac4dc1938f0346035d84bf99fa9e33217"
dependencies = [
"proc-macro2",
"quote",
@@ -1472,9 +1444,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.93"
+version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
+checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
dependencies = [
"itoa",
"ryu",
@@ -1482,15 +1454,6 @@ dependencies = [
]
[[package]]
-name = "serde_millis"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6e2dc780ca5ee2c369d1d01d100270203c4ff923d2a4264812d723766434d00"
-dependencies = [
- "serde",
-]
-
-[[package]]
name = "serde_regex"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1502,9 +1465,9 @@ dependencies = [
[[package]]
name = "serde_repr"
-version = "0.1.10"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
+checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc"
dependencies = [
"proc-macro2",
"quote",
@@ -1560,9 +1523,9 @@ dependencies = [
[[package]]
name = "spin"
-version = "0.9.4"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09"
+checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc"
dependencies = [
"lock_api",
]
@@ -1597,9 +1560,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.107"
+version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
@@ -1608,16 +1571,15 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.3.0"
+version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
+checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95"
dependencies = [
"cfg-if",
"fastrand",
- "libc",
"redox_syscall",
- "remove_dir_all",
- "winapi",
+ "rustix",
+ "windows-sys 0.42.0",
]
[[package]]
@@ -1631,19 +1593,18 @@ dependencies = [
[[package]]
name = "texlab"
-version = "5.3.0"
+version = "5.4.0"
dependencies = [
"anyhow",
"assert_unordered",
"chrono",
- "clap 4.1.6",
+ "clap 4.1.8",
"criterion",
"crossbeam-channel",
"dashmap",
"dirs",
"encoding_rs",
"encoding_rs_io",
- "env_logger",
"fern",
"flate2",
"flume",
@@ -1652,7 +1613,6 @@ dependencies = [
"insta",
"isocountry",
"itertools",
- "jod-thread",
"log",
"logos",
"lsp-server",
@@ -1665,7 +1625,6 @@ dependencies = [
"salsa-2022",
"serde",
"serde_json",
- "serde_millis",
"serde_regex",
"serde_repr",
"smol_str",
@@ -1691,18 +1650,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]]
name = "thiserror"
-version = "1.0.38"
+version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
+checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.38"
+version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
+checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e"
dependencies = [
"proc-macro2",
"quote",
@@ -1711,10 +1670,11 @@ dependencies = [
[[package]]
name = "thread_local"
-version = "1.1.4"
+version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
+checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
+ "cfg-if",
"once_cell",
]
@@ -1748,9 +1708,9 @@ dependencies = [
[[package]]
name = "tinyvec_macros"
-version = "0.1.0"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "titlecase"
@@ -1777,9 +1737,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
[[package]]
name = "unicode-bidi"
-version = "0.3.10"
+version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58"
+checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c"
[[package]]
name = "unicode-case-mapping"
@@ -1789,9 +1749,9 @@ checksum = "916a391c62ffbc5b6220fdafa353e93b530d21904d82ca1a2e29cdb5cfb4399f"
[[package]]
name = "unicode-ident"
-version = "1.0.6"
+version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "unicode-normalization"
@@ -1804,9 +1764,9 @@ dependencies = [
[[package]]
name = "unicode-segmentation"
-version = "1.10.0"
+version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
+checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
[[package]]
name = "unidecode"
@@ -1851,9 +1811,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.83"
+version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
+checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -1861,9 +1821,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.83"
+version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
+checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
dependencies = [
"bumpalo",
"log",
@@ -1876,9 +1836,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.83"
+version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
+checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -1886,9 +1846,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.83"
+version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
+checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
dependencies = [
"proc-macro2",
"quote",
@@ -1899,15 +1859,15 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.83"
+version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
+checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
[[package]]
name = "web-sys"
-version = "0.3.60"
+version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
+checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -1960,6 +1920,30 @@ dependencies = [
]
[[package]]
+name = "windows-sys"
+version = "0.45.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/support/texlab/Cargo.toml b/support/texlab/Cargo.toml
index ede163972d..00d1cc4e21 100644
--- a/support/texlab/Cargo.toml
+++ b/support/texlab/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "texlab"
description = "LaTeX Language Server"
-version = "5.3.0"
+version = "5.4.0"
license = "GPL-3.0"
readme = "README.md"
authors = [
@@ -9,7 +9,7 @@ authors = [
"Patrick Förster <patrick.foerster@outlook.de>",
]
edition = "2021"
-rust-version = "1.64"
+rust-version = "1.65"
homepage = "https://github.com/latex-lsp/texlab"
repository = "https://github.com/latex-lsp/texlab"
documentation = "https://github.com/latex-lsp/texlab"
@@ -60,7 +60,6 @@ rowan = "0.15.10"
rustc-hash = "1.1.0"
serde = "1.0.152"
serde_json = "1.0.93"
-serde_millis = "0.1.1"
serde_regex = "1.1.0"
serde_repr = "0.1.10"
smol_str = { version = "0.1.24", features = ["serde"] }
@@ -73,15 +72,13 @@ unicode-normalization = "0.1.22"
[dependencies.salsa]
git = "https://github.com/salsa-rs/salsa"
-rev = "20c7834ff34fd00a41b59bec61f3d5c85ea3abd4"
+rev = "ef7c0f12c8159e7025316e959c26f6278a576fa5"
package = "salsa-2022"
[dev-dependencies]
assert_unordered = "0.3.5"
criterion = { version = "0.4.0" }
-env_logger = "0.10.0"
insta = { version = "1.28.0", features = ["glob", "redactions", "json"] }
-jod-thread = "0.1.2"
[profile.release]
lto = "thin"
diff --git a/support/texlab/README.md b/support/texlab/README.md
index 6e96e40f75..988eda832e 100644
--- a/support/texlab/README.md
+++ b/support/texlab/README.md
@@ -1,6 +1,5 @@
[![CI](https://github.com/latex-lsp/texlab/workflows/CI/badge.svg)](https://github.com/latex-lsp/texlab/actions)
[![Coverage](https://codecov.io/gh/latex-lsp/texlab/branch/master/graph/badge.svg)](https://codecov.io/gh/latex-lsp/texlab)
-![Rust](https://img.shields.io/badge/rustc-1.60%2B-blue)
[![Wiki](https://img.shields.io/badge/docs-Wiki-success)](https://github.com/latex-lsp/texlab/wiki)
[![GitHub release](https://img.shields.io/github/release/latex-lsp/texlab?label=github)](https://github.com/latex-lsp/texlab/releases)
diff --git a/support/texlab/data/lang_data.json b/support/texlab/data/lang_data.json
index 8cba6d297c..3e22e41320 100644
--- a/support/texlab/data/lang_data.json
+++ b/support/texlab/data/lang_data.json
@@ -1054,52 +1054,5 @@
"topaths",
"trees",
"turtle"
- ],
- "mathEnvironments": [
- "align",
- "align*",
- "alignat",
- "alignat*",
- "aligned",
- "aligned*",
- "alignedat",
- "alignedat*",
- "array",
- "array*",
- "Bmatrix",
- "Bmatrix*",
- "bmatrix",
- "bmatrix*",
- "cases",
- "cases*",
- "CD",
- "CD*",
- "eqnarray",
- "eqnarray*",
- "equation",
- "equation*",
- "subequations",
- "subequations*",
- "gather",
- "gather*",
- "gathered",
- "gathered*",
- "matrix",
- "matrix*",
- "multline",
- "multline*",
- "pmatrix",
- "pmatrix*",
- "smallmatrix",
- "smallmatrix*",
- "split",
- "split*",
- "subarray",
- "subarray*",
- "Vmatrix",
- "Vmatrix*",
- "vmatrix",
- "vmatrix*"
- ],
- "enumEnvironments": ["enumerate", "itemize", "description"]
+ ]
}
diff --git a/support/texlab/src/client.rs b/support/texlab/src/client.rs
index ab912653b0..0439445092 100644
--- a/support/texlab/src/client.rs
+++ b/support/texlab/src/client.rs
@@ -10,7 +10,7 @@ use lsp_server::{ErrorCode, Message, Request, RequestId, Response};
use lsp_types::{notification::ShowMessage, MessageType, ShowMessageParams};
use serde::{de::DeserializeOwned, Serialize};
-use crate::Options;
+use crate::server::options::Options;
#[derive(Debug)]
struct RawClient {
diff --git a/support/texlab/src/config.rs b/support/texlab/src/config.rs
new file mode 100644
index 0000000000..33cbacd3be
--- /dev/null
+++ b/support/texlab/src/config.rs
@@ -0,0 +1,230 @@
+use std::time::Duration;
+
+use regex::Regex;
+use rustc_hash::FxHashSet;
+
+#[derive(Debug)]
+pub struct Config {
+ pub root_dir: Option<String>,
+ pub build: BuildConfig,
+ pub diagnostics: DiagnosticsConfig,
+ pub formatting: FormattingConfig,
+ pub synctex: Option<SynctexConfig>,
+ pub symbols: SymbolConfig,
+ pub syntax: SyntaxConfig,
+}
+
+#[derive(Debug)]
+pub struct BuildConfig {
+ pub program: String,
+ pub args: Vec<String>,
+ pub on_save: bool,
+ pub forward_search_after: bool,
+ pub output_dir: String,
+}
+
+#[derive(Debug)]
+pub struct DiagnosticsConfig {
+ pub allowed_patterns: Vec<Regex>,
+ pub ignored_patterns: Vec<Regex>,
+ pub chktex: ChktexConfig,
+ pub delay: Duration,
+}
+
+#[derive(Debug)]
+pub struct ChktexConfig {
+ pub on_open: bool,
+ pub on_save: bool,
+ pub on_edit: bool,
+}
+
+#[derive(Debug)]
+pub struct SynctexConfig {
+ pub program: String,
+ pub args: Vec<String>,
+}
+
+#[derive(Debug)]
+pub struct FormattingConfig {
+ pub tex_formatter: Formatter,
+ pub bib_formatter: Formatter,
+ pub latex_indent: LatexIndentConfig,
+ pub line_length: usize,
+}
+
+#[derive(Debug)]
+pub enum Formatter {
+ Null,
+ Server,
+ LatexIndent,
+}
+
+#[derive(Debug)]
+pub struct LatexIndentConfig {
+ pub local: Option<String>,
+ pub modify_line_breaks: bool,
+}
+
+#[derive(Debug)]
+pub struct SymbolConfig {
+ pub allowed_patterns: Vec<Regex>,
+ pub ignored_patterns: Vec<Regex>,
+}
+
+#[derive(Debug)]
+pub struct SyntaxConfig {
+ pub math_environments: FxHashSet<String>,
+ pub enum_environments: FxHashSet<String>,
+ pub verbatim_environments: FxHashSet<String>,
+}
+
+impl Default for Config {
+ fn default() -> Self {
+ Self {
+ root_dir: None,
+ build: BuildConfig::default(),
+ diagnostics: DiagnosticsConfig::default(),
+ formatting: FormattingConfig::default(),
+ synctex: None,
+ symbols: SymbolConfig::default(),
+ syntax: SyntaxConfig::default(),
+ }
+ }
+}
+
+impl Default for BuildConfig {
+ fn default() -> Self {
+ Self {
+ program: String::from("latexmk"),
+ args: ["-pdf", "-interaction=nonstopmode", "-synctex=1", "%f"]
+ .into_iter()
+ .map(String::from)
+ .collect(),
+ on_save: false,
+ forward_search_after: false,
+ output_dir: String::from("."),
+ }
+ }
+}
+
+impl Default for DiagnosticsConfig {
+ fn default() -> Self {
+ Self {
+ allowed_patterns: Vec::new(),
+ ignored_patterns: Vec::new(),
+ delay: Duration::from_millis(300),
+ chktex: ChktexConfig::default(),
+ }
+ }
+}
+
+impl Default for ChktexConfig {
+ fn default() -> Self {
+ Self {
+ on_open: false,
+ on_save: false,
+ on_edit: false,
+ }
+ }
+}
+
+impl Default for FormattingConfig {
+ fn default() -> Self {
+ Self {
+ tex_formatter: Formatter::LatexIndent,
+ bib_formatter: Formatter::Server,
+ line_length: 80,
+ latex_indent: LatexIndentConfig::default(),
+ }
+ }
+}
+
+impl Default for LatexIndentConfig {
+ fn default() -> Self {
+ Self {
+ local: None,
+ modify_line_breaks: false,
+ }
+ }
+}
+
+impl Default for SymbolConfig {
+ fn default() -> Self {
+ Self {
+ allowed_patterns: Vec::new(),
+ ignored_patterns: Vec::new(),
+ }
+ }
+}
+
+impl Default for SyntaxConfig {
+ fn default() -> Self {
+ let math_environments = [
+ "align",
+ "align*",
+ "alignat",
+ "alignat*",
+ "aligned",
+ "aligned*",
+ "alignedat",
+ "alignedat*",
+ "array",
+ "array*",
+ "Bmatrix",
+ "Bmatrix*",
+ "bmatrix",
+ "bmatrix*",
+ "cases",
+ "cases*",
+ "CD",
+ "CD*",
+ "eqnarray",
+ "eqnarray*",
+ "equation",
+ "equation*",
+ "IEEEeqnarray",
+ "IEEEeqnarray*",
+ "subequations",
+ "subequations*",
+ "gather",
+ "gather*",
+ "gathered",
+ "gathered*",
+ "matrix",
+ "matrix*",
+ "multline",
+ "multline*",
+ "pmatrix",
+ "pmatrix*",
+ "smallmatrix",
+ "smallmatrix*",
+ "split",
+ "split*",
+ "subarray",
+ "subarray*",
+ "Vmatrix",
+ "Vmatrix*",
+ "vmatrix",
+ "vmatrix*",
+ ]
+ .into_iter()
+ .map(String::from)
+ .collect();
+
+ let enum_environments = ["enumerate", "itemize", "description"]
+ .into_iter()
+ .map(String::from)
+ .collect();
+
+ let verbatim_environments = ["pycode", "minted", "asy", "lstlisting", "verbatim"]
+ .into_iter()
+ .map(String::from)
+ .collect();
+
+ Self {
+ math_environments,
+ enum_environments,
+ verbatim_environments,
+ }
+ }
+}
diff --git a/support/texlab/src/db.rs b/support/texlab/src/db.rs
index 64165b76c2..521655ce80 100644
--- a/support/texlab/src/db.rs
+++ b/support/texlab/src/db.rs
@@ -1,11 +1,12 @@
pub mod analysis;
+mod context;
pub mod diagnostics;
mod discovery;
mod document;
pub mod parse;
mod workspace;
-pub use {discovery::*, document::*, workspace::*};
+pub use {context::*, discovery::*, document::*, workspace::*};
#[salsa::interned]
pub struct Word {
diff --git a/support/texlab/src/db/analysis.rs b/support/texlab/src/db/analysis.rs
index 13b5bb1cb3..1f1bd508a8 100644
--- a/support/texlab/src/db/analysis.rs
+++ b/support/texlab/src/db/analysis.rs
@@ -1,6 +1,6 @@
pub mod label;
-use rowan::{ast::AstNode, TextRange};
+use rowan::{ast::AstNode, NodeOrToken, TextRange};
use crate::{
syntax::latex::{self, HasCurly},
@@ -169,30 +169,42 @@ impl TexAnalysis {
let mut command_name_ranges = Vec::new();
let mut environment_names = Vec::new();
- for node in root.descendants() {
- TexLink::of_include(db, node.clone(), &mut links)
- .or_else(|| TexLink::of_import(db, node.clone(), &mut links))
- .or_else(|| label::Name::of_definition(db, node.clone(), &mut labels))
- .or_else(|| label::Name::of_reference(db, node.clone(), &mut labels))
- .or_else(|| label::Name::of_reference_range(db, node.clone(), &mut labels))
- .or_else(|| label::Number::of_number(db, node.clone(), &mut label_numbers))
- .or_else(|| {
- TheoremEnvironment::of_definition(db, node.clone(), &mut theorem_environments)
- })
- .or_else(|| GraphicsPath::of_command(db, node.clone(), &mut graphics_paths))
- .or_else(|| {
- let range = latex::GenericCommand::cast(node.clone())?
- .name()?
- .text_range();
-
- command_name_ranges.push(range);
- Some(())
- })
- .or_else(|| {
- let begin = latex::Begin::cast(node.clone())?;
- environment_names.push(begin.name()?.key()?.to_string());
- Some(())
- });
+ for element in root.descendants_with_tokens() {
+ match element {
+ NodeOrToken::Token(token) if token.kind() == latex::COMMAND_NAME => {
+ command_name_ranges.push(token.text_range());
+ }
+ NodeOrToken::Token(_) => {}
+ NodeOrToken::Node(node) => {
+ TexLink::of_include(db, node.clone(), &mut links)
+ .or_else(|| TexLink::of_import(db, node.clone(), &mut links))
+ .or_else(|| label::Name::of_definition(db, node.clone(), &mut labels))
+ .or_else(|| label::Name::of_reference(db, node.clone(), &mut labels))
+ .or_else(|| label::Name::of_reference_range(db, node.clone(), &mut labels))
+ .or_else(|| label::Number::of_number(db, node.clone(), &mut label_numbers))
+ .or_else(|| {
+ TheoremEnvironment::of_definition(
+ db,
+ node.clone(),
+ &mut theorem_environments,
+ )
+ })
+ .or_else(|| GraphicsPath::of_command(db, node.clone(), &mut graphics_paths))
+ .or_else(|| {
+ let range = latex::GenericCommand::cast(node.clone())?
+ .name()?
+ .text_range();
+
+ command_name_ranges.push(range);
+ Some(())
+ })
+ .or_else(|| {
+ let begin = latex::Begin::cast(node.clone())?;
+ environment_names.push(begin.name()?.key()?.to_string());
+ Some(())
+ });
+ }
+ };
}
Self::new(
diff --git a/support/texlab/src/db/context.rs b/support/texlab/src/db/context.rs
new file mode 100644
index 0000000000..c6277eb099
--- /dev/null
+++ b/support/texlab/src/db/context.rs
@@ -0,0 +1,18 @@
+use crate::Config;
+
+/// Contains the global context of the server throughout the application.
+#[salsa::input(singleton)]
+pub struct ServerContext {
+ /// The server configuration which is extracted from either
+ /// the `workspace/configuration` or `workspace/didChangeConfiguration` messages.
+ #[return_ref]
+ pub config: Config,
+
+ /// Disable usage of `isIncomplete = false` in completion lists.
+ ///
+ /// Due to the large number of completion results,
+ /// the server can only send a subset of the items most of the time.
+ /// When the filtered list is small enough, `CompletionList.isIncomplete` can be set to `false`.
+ /// On VSCode, this optimization should not be done so this flag is needed.
+ pub always_incomplete_completion_list: bool,
+}
diff --git a/support/texlab/src/db/diagnostics.rs b/support/texlab/src/db/diagnostics.rs
index 8abb856768..6b1a177133 100644
--- a/support/texlab/src/db/diagnostics.rs
+++ b/support/texlab/src/db/diagnostics.rs
@@ -131,7 +131,7 @@ pub fn collect_filtered(
let all_diagnostics = collect(db, workspace);
let mut all_filtered: FxHashMap<Document, Vec<lsp_types::Diagnostic>> = FxHashMap::default();
- let options = &workspace.options(db).diagnostics;
+ let config = &db.config().diagnostics;
for document in workspace.documents(db) {
let mut filtered = Vec::new();
if !matches!(document.language(db), Language::Tex | Language::Bib) {
@@ -142,8 +142,8 @@ pub fn collect_filtered(
for diagnostic in diagnostics.iter().filter(|diag| {
util::regex_filter::filter(
&diag.message,
- &options.allowed_patterns,
- &options.ignored_patterns,
+ &config.allowed_patterns,
+ &config.ignored_patterns,
)
}) {
let source = match diagnostic.code {
diff --git a/support/texlab/src/db/diagnostics/bib.rs b/support/texlab/src/db/diagnostics/bib.rs
index 6d0f66e960..4f5dfc55a1 100644
--- a/support/texlab/src/db/diagnostics/bib.rs
+++ b/support/texlab/src/db/diagnostics/bib.rs
@@ -32,7 +32,7 @@ fn analyze_entry(
node: bibtex::SyntaxNode,
results: &mut Vec<Diagnostic>,
) -> Option<()> {
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let entry = bibtex::Entry::cast(node)?;
if entry.left_delim_token().is_none() {
@@ -81,7 +81,7 @@ fn analyze_field(
node: bibtex::SyntaxNode,
results: &mut Vec<Diagnostic>,
) -> Option<()> {
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let field = bibtex::Field::cast(node)?;
if field.eq_token().is_none() {
diff --git a/support/texlab/src/db/diagnostics/log.rs b/support/texlab/src/db/diagnostics/log.rs
index 436999259b..368fd3fdcc 100644
--- a/support/texlab/src/db/diagnostics/log.rs
+++ b/support/texlab/src/db/diagnostics/log.rs
@@ -81,10 +81,10 @@ fn find_range_of_hint(
error: &BuildError,
) -> Option<Range> {
let document = workspace.lookup_uri(db, uri)?;
- let text = document.contents(db).text(db);
+ let text = document.text(db);
let line = error.line? as usize;
let hint = error.hint.as_deref()?;
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let line_start = line_index.newlines.get(line).copied()?;
let line_end = line_index
diff --git a/support/texlab/src/db/diagnostics/tex.rs b/support/texlab/src/db/diagnostics/tex.rs
index 50233f8bd6..a7b030a5bf 100644
--- a/support/texlab/src/db/diagnostics/tex.rs
+++ b/support/texlab/src/db/diagnostics/tex.rs
@@ -5,7 +5,7 @@ use crate::{db::document::Document, syntax::latex, util::line_index_ext::LineInd
use super::{Diagnostic, DiagnosticCode, TexCode};
-#[salsa::tracked(return_ref)]
+#[salsa::tracked]
pub fn collect(db: &dyn Db, document: Document) -> Vec<Diagnostic> {
let mut results = Vec::new();
@@ -18,10 +18,35 @@ pub fn collect(db: &dyn Db, document: Document) -> Vec<Diagnostic> {
None => return results,
};
- for node in data.root(db).descendants() {
- analyze_environment(db, document, node.clone(), &mut results)
- .or_else(|| analyze_curly_group(db, document, node.clone(), &mut results))
- .or_else(|| analyze_curly_braces(document, db, node, &mut results));
+ let mut traversal = data.root(db).preorder();
+ while let Some(event) = traversal.next() {
+ match event {
+ rowan::WalkEvent::Enter(node) => {
+ if let Some(environment) = latex::Environment::cast(node.clone()) {
+ if environment
+ .begin()
+ .and_then(|begin| begin.name())
+ .and_then(|name| name.key())
+ .map_or(false, |name| {
+ db.config()
+ .syntax
+ .verbatim_environments
+ .contains(&name.to_string())
+ })
+ {
+ traversal.skip_subtree();
+ continue;
+ }
+ }
+
+ analyze_environment(db, document, node.clone(), &mut results)
+ .or_else(|| analyze_curly_group(db, document, node.clone(), &mut results))
+ .or_else(|| analyze_curly_braces(document, db, node, &mut results));
+ }
+ rowan::WalkEvent::Leave(_) => {
+ continue;
+ }
+ };
}
results
@@ -41,7 +66,6 @@ fn analyze_environment(
results.push(Diagnostic {
severity: DiagnosticSeverity::ERROR,
range: document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&name1)),
code: DiagnosticCode::Tex(code),
@@ -89,7 +113,6 @@ fn analyze_curly_group(
results.push(Diagnostic {
severity: DiagnosticSeverity::ERROR,
range: document
- .contents(db)
.line_index(db)
.line_col_lsp_range(TextRange::empty(node.text_range().end())),
code: DiagnosticCode::Tex(code),
@@ -111,7 +134,6 @@ fn analyze_curly_braces(
results.push(Diagnostic {
severity: DiagnosticSeverity::ERROR,
range: document
- .contents(db)
.line_index(db)
.line_col_lsp_range(node.text_range()),
code: DiagnosticCode::Tex(code),
diff --git a/support/texlab/src/db/discovery.rs b/support/texlab/src/db/discovery.rs
index 12338f745e..9cc5a4e807 100644
--- a/support/texlab/src/db/discovery.rs
+++ b/support/texlab/src/db/discovery.rs
@@ -40,8 +40,11 @@ pub fn hidden_dependencies(
base_dir: Location,
dependencies: &mut Vec<Dependency>,
) {
- dependencies.extend(hidden_dependency(db, document, base_dir, "log"));
- dependencies.extend(hidden_dependency(db, document, base_dir, "aux"));
+ let uri = document.location(db).uri(db).as_str();
+ if document.language(db) == Language::Tex && !uri.ends_with(".aux") {
+ dependencies.extend(hidden_dependency(db, document, base_dir, "log"));
+ dependencies.extend(hidden_dependency(db, document, base_dir, "aux"));
+ }
}
#[salsa::tracked]
@@ -158,7 +161,7 @@ impl DependencyGraph {
}
}
-#[salsa::tracked]
+#[salsa::tracked(return_ref)]
pub fn dependency_graph(db: &dyn Db, start: Document) -> DependencyGraph {
let workspace = Workspace::get(db);
diff --git a/support/texlab/src/db/document.rs b/support/texlab/src/db/document.rs
index 81ed22e916..40d0ab025f 100644
--- a/support/texlab/src/db/document.rs
+++ b/support/texlab/src/db/document.rs
@@ -48,20 +48,6 @@ impl Location {
}
}
-#[salsa::input]
-pub struct Contents {
- #[return_ref]
- pub text: String,
-}
-
-#[salsa::tracked]
-impl Contents {
- #[salsa::tracked(return_ref)]
- pub fn line_index(self, db: &dyn Db) -> LineIndex {
- LineIndex::new(self.text(db))
- }
-}
-
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
pub enum Owner {
Client,
@@ -115,19 +101,31 @@ pub struct LinterData {
#[salsa::input]
pub struct Document {
+ /// An object containing the URI of the document.
pub location: Location,
- pub contents: Contents,
+
+ /// The source code.
+ #[return_ref]
+ pub text: String,
+
+ /// The programming language.
pub language: Language,
+
+ /// The program (either server or client) which opened the document.
pub owner: Owner,
+
+ /// An estimate of the current cursor position.
pub cursor: TextSize,
+
+ /// The diagnostics reported from external linters such as ChkTeX.
pub linter: LinterData,
}
impl Document {
pub fn edit(self, db: &mut dyn Db, range: TextRange, replace_with: &str) {
- let mut text = self.contents(db).set_text(db).to(String::new());
+ let mut text = self.set_text(db).to(String::new());
text.replace_range(std::ops::Range::<usize>::from(range), replace_with);
- self.contents(db).set_text(db).to(text);
+ self.set_text(db).to(text);
self.set_cursor(db).to(range.start());
}
@@ -149,7 +147,7 @@ impl Document {
impl Document {
#[salsa::tracked]
pub fn parse(self, db: &dyn Db) -> DocumentData {
- let text = self.contents(db).text(db);
+ let text = self.text(db);
match self.language(db) {
Language::Tex => {
let data = TexDocumentData::new(db, parse_latex(text));
@@ -179,7 +177,7 @@ impl Document {
self.parse(db).as_tex().map_or(false, |data| {
let analysis = data.analyze(db);
analysis.has_document_environment(db)
- || !analysis
+ && !analysis
.links(db)
.iter()
.filter(|link| link.kind(db) == TexLinkKind::Cls)
@@ -193,4 +191,9 @@ impl Document {
.as_tex()
.map_or(false, |data| data.analyze(db).has_document_environment(db))
}
+
+ #[salsa::tracked(return_ref)]
+ pub fn line_index(self, db: &dyn Db) -> LineIndex {
+ LineIndex::new(self.text(db))
+ }
}
diff --git a/support/texlab/src/db/workspace.rs b/support/texlab/src/db/workspace.rs
index 123d415fd9..67c99792a2 100644
--- a/support/texlab/src/db/workspace.rs
+++ b/support/texlab/src/db/workspace.rs
@@ -4,19 +4,19 @@ use std::{
};
use itertools::Itertools;
-use lsp_types::{ClientCapabilities, ClientInfo, Url};
+use lsp_types::{ClientCapabilities, Url};
use rowan::TextSize;
use rustc_hash::FxHashSet;
use crate::{
db::document::{Document, Location},
distro::FileNameDB,
- Db, Options,
+ Db,
};
use super::{
dependency_graph,
- document::{Contents, Language, LinterData, Owner},
+ document::{Language, LinterData, Owner},
Word,
};
@@ -26,15 +26,9 @@ pub struct Workspace {
pub documents: FxHashSet<Document>,
#[return_ref]
- pub options: Options,
-
- #[return_ref]
pub client_capabilities: ClientCapabilities,
#[return_ref]
- pub client_info: Option<ClientInfo>,
-
- #[return_ref]
pub root_dirs: Vec<Location>,
#[return_ref]
@@ -79,11 +73,10 @@ impl Workspace {
owner: Owner,
) -> Document {
let location = Location::new(db, uri);
- let contents = Contents::new(db, text);
let cursor = TextSize::from(0);
match self.lookup(db, location) {
Some(document) => {
- document.set_contents(db).to(contents);
+ document.set_text(db).to(text);
document.set_language(db).to(language);
document.set_owner(db).to(owner);
document.set_cursor(db).to(cursor);
@@ -93,7 +86,7 @@ impl Workspace {
let document = Document::new(
db,
location,
- contents,
+ text,
language,
owner,
cursor,
@@ -157,11 +150,10 @@ impl Workspace {
impl Workspace {
#[salsa::tracked]
pub fn working_dir(self, db: &dyn Db, base_dir: Location) -> Location {
- if let Some(dir) = self
- .options(db)
- .root_directory
- .as_deref()
- .and_then(|path| path.to_str())
+ if let Some(dir) = db
+ .config()
+ .root_dir
+ .as_ref()
.and_then(|path| base_dir.join(db, path))
{
return dir;
@@ -182,14 +174,7 @@ impl Workspace {
#[salsa::tracked]
pub fn output_dir(self, db: &dyn Db, base_dir: Location) -> Location {
- let mut path = self
- .options(db)
- .aux_directory
- .as_deref()
- .and_then(|path| path.to_str())
- .unwrap_or(".")
- .to_string();
-
+ let mut path = db.config().build.output_dir.clone();
if !path.ends_with('/') {
path.push('/');
}
diff --git a/support/texlab/src/features/build.rs b/support/texlab/src/features/build.rs
index 69c3a7825c..83a1d4cb32 100644
--- a/support/texlab/src/features/build.rs
+++ b/support/texlab/src/features/build.rs
@@ -39,7 +39,7 @@ pub enum BuildStatus {
pub struct Command {
uri: Url,
progress: bool,
- executable: String,
+ program: String,
args: Vec<String>,
working_dir: PathBuf,
client: LspClient,
@@ -63,12 +63,11 @@ impl Command {
return None;
}
- let options = &workspace.options(db).build;
- let executable = options.executable.0.clone();
+ let config = &db.config().build;
+ let program = config.program.clone();
let path = document.location(db).path(db).as_deref().unwrap();
- let args = options
+ let args = config
.args
- .0
.iter()
.map(|arg| replace_placeholder(arg, path))
.collect();
@@ -83,7 +82,7 @@ impl Command {
progress: workspace
.client_capabilities(db)
.has_work_done_progress_support(),
- executable,
+ program,
args,
working_dir,
client,
@@ -99,7 +98,7 @@ impl Command {
None
};
- let mut process = match std::process::Command::new(&self.executable)
+ let mut process = match std::process::Command::new(&self.program)
.args(self.args)
.stdin(Stdio::null())
.stdout(Stdio::piped())
@@ -111,7 +110,7 @@ impl Command {
Err(why) => {
log::error!(
"Failed to spawn process {:?} in directory {}: {}",
- self.executable,
+ self.program,
self.working_dir.display(),
why
);
diff --git a/support/texlab/src/features/completion/builder.rs b/support/texlab/src/features/completion/builder.rs
index 686d39b62b..0373587a06 100644
--- a/support/texlab/src/features/completion/builder.rs
+++ b/support/texlab/src/features/completion/builder.rs
@@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
use smol_str::SmolStr;
use crate::{
- db::{Document, Workspace},
+ db::{Document, ServerContext, Workspace},
syntax::{
bibtex::{self, HasName, HasType},
latex,
@@ -44,7 +44,7 @@ impl<'db> CompletionBuilder<'db> {
let items = Vec::new();
let matcher = SkimMatcherV2::default().ignore_case();
let text_pattern = match &context.cursor {
- Cursor::Tex(token) if token.kind().is_command_name() => {
+ Cursor::Tex(token) if token.kind() == latex::COMMAND_NAME => {
if token.text_range().start() + TextSize::from(1) == context.offset {
// Handle cases similar to this one correctly:
// $\|$ % (| is the cursor)
@@ -426,18 +426,9 @@ impl<'db> CompletionBuilder<'db> {
.map(|(i, item)| self.convert_item(item, i))
.collect();
- list.is_incomplete = if self
- .context
- .workspace
- .client_info(self.context.db)
- .as_ref()
- .map_or(false, |client| client.name.as_str() == "Visual Studio Code")
- {
- true
- } else {
- list.items.len() >= COMPLETION_LIMIT
- };
-
+ let db = self.context.db;
+ let always_incomplete = ServerContext::get(db).always_incomplete_completion_list(db);
+ list.is_incomplete = always_incomplete || list.items.len() >= COMPLETION_LIMIT;
list
}
diff --git a/support/texlab/src/features/completion/user_command.rs b/support/texlab/src/features/completion/user_command.rs
index 99d9883ee9..14c2222701 100644
--- a/support/texlab/src/features/completion/user_command.rs
+++ b/support/texlab/src/features/completion/user_command.rs
@@ -12,7 +12,7 @@ pub fn complete<'db>(
let db = context.db;
for document in context.related() {
if let Some(data) = document.parse(db).as_tex() {
- let text = document.contents(db).text(db);
+ let text = document.text(db);
for name in data
.analyze(db)
.command_name_ranges(db)
diff --git a/support/texlab/src/features/definition.rs b/support/texlab/src/features/definition.rs
index 7c9e6d4841..5843882bd0 100644
--- a/support/texlab/src/features/definition.rs
+++ b/support/texlab/src/features/definition.rs
@@ -31,12 +31,11 @@ pub fn goto_definition(
let origin_selection_range = Some(
context
.document
- .contents(db)
.line_index(db)
.line_col_lsp_range(result.origin_selection_range),
);
- let target_line_index = result.target.contents(db).line_index(db);
+ let target_line_index = result.target.line_index(db);
let target_uri = result.target.location(context.db).uri(context.db).clone();
let target_range = target_line_index.line_col_lsp_range(result.target_range);
diff --git a/support/texlab/src/features/definition/command.rs b/support/texlab/src/features/definition/command.rs
index cf9fe1b511..743a0f6d3c 100644
--- a/support/texlab/src/features/definition/command.rs
+++ b/support/texlab/src/features/definition/command.rs
@@ -8,7 +8,7 @@ pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionR
let name = context
.cursor
.as_tex()
- .filter(|token| token.kind().is_command_name())?;
+ .filter(|token| token.kind() == latex::COMMAND_NAME)?;
let origin_selection_range = name.text_range();
diff --git a/support/texlab/src/features/definition/document.rs b/support/texlab/src/features/definition/document.rs
index 58237f7521..40cfdf1d38 100644
--- a/support/texlab/src/features/definition/document.rs
+++ b/support/texlab/src/features/definition/document.rs
@@ -12,7 +12,7 @@ pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionR
.iter()
.copied()
.chain(std::iter::once(context.document))
- .flat_map(|parent| dependency_graph(db, parent).edges)
+ .flat_map(|parent| dependency_graph(db, parent).edges.iter())
.filter(|edge| edge.source == context.document)
.find_map(|edge| {
let range = edge.origin?.link.range(db);
diff --git a/support/texlab/src/features/folding.rs b/support/texlab/src/features/folding.rs
index 91c9571b61..44ddc0c4fd 100644
--- a/support/texlab/src/features/folding.rs
+++ b/support/texlab/src/features/folding.rs
@@ -10,7 +10,7 @@ use crate::{
pub fn find_all(db: &dyn Db, uri: &Url) -> Option<Vec<FoldingRange>> {
let document = Workspace::get(db).lookup_uri(db, uri)?;
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let foldings = match document.parse(db) {
DocumentData::Tex(data) => {
let mut results = Vec::new();
diff --git a/support/texlab/src/features/formatting.rs b/support/texlab/src/features/formatting.rs
index 5d7d1c0c1f..4a98df3f88 100644
--- a/support/texlab/src/features/formatting.rs
+++ b/support/texlab/src/features/formatting.rs
@@ -5,7 +5,7 @@ use lsp_types::{FormattingOptions, TextEdit, Url};
use crate::{
db::{Language, Workspace},
- BibtexFormatter, Db, LatexFormatter,
+ Db, Formatter,
};
use self::{bibtex_internal::format_bibtex_internal, latexindent::format_with_latexindent};
@@ -18,15 +18,15 @@ pub fn format_source_code(
let workspace = Workspace::get(db);
let document = workspace.lookup_uri(db, uri)?;
match document.language(db) {
- Language::Tex => match workspace.options(db).latex_formatter {
- LatexFormatter::None => None,
- LatexFormatter::Texlab => None,
- LatexFormatter::Latexindent => format_with_latexindent(db, document),
+ Language::Tex => match db.config().formatting.tex_formatter {
+ Formatter::Null => None,
+ Formatter::Server => None,
+ Formatter::LatexIndent => format_with_latexindent(db, document),
},
- Language::Bib => match workspace.options(db).bibtex_formatter {
- BibtexFormatter::None => None,
- BibtexFormatter::Texlab => format_bibtex_internal(db, document, options),
- BibtexFormatter::Latexindent => format_with_latexindent(db, document),
+ Language::Bib => match db.config().formatting.bib_formatter {
+ Formatter::Null => None,
+ Formatter::Server => format_bibtex_internal(db, document, options),
+ Formatter::LatexIndent => format_with_latexindent(db, document),
},
Language::Log | Language::TexlabRoot | Language::Tectonic => None,
}
diff --git a/support/texlab/src/features/formatting/bibtex_internal.rs b/support/texlab/src/features/formatting/bibtex_internal.rs
index 8447778d90..5026c512f2 100644
--- a/support/texlab/src/features/formatting/bibtex_internal.rs
+++ b/support/texlab/src/features/formatting/bibtex_internal.rs
@@ -2,7 +2,7 @@ use lsp_types::{FormattingOptions, TextEdit};
use rowan::{ast::AstNode, NodeOrToken};
use crate::{
- db::{Document, Workspace},
+ db::Document,
syntax::bibtex::{self, HasName, HasType, HasValue},
util::{line_index::LineIndex, line_index_ext::LineIndexExt},
Db,
@@ -23,18 +23,9 @@ pub fn format_bibtex_internal(
indent.push('\t');
}
- let line_length = Workspace::get(db)
- .options(db)
- .formatter_line_length
- .map_or(80, |value| {
- if value <= 0 {
- usize::MAX
- } else {
- value as usize
- }
- });
+ let line_length = db.config().formatting.line_length;
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let data = document.parse(db).as_bib()?;
let mut edits = Vec::new();
diff --git a/support/texlab/src/features/formatting/latexindent.rs b/support/texlab/src/features/formatting/latexindent.rs
index 3dab10c923..087b8f0941 100644
--- a/support/texlab/src/features/formatting/latexindent.rs
+++ b/support/texlab/src/features/formatting/latexindent.rs
@@ -10,12 +10,12 @@ use tempfile::tempdir;
use crate::{
db::{Document, Language, Workspace},
util::line_index_ext::LineIndexExt,
- Db, LatexindentOptions,
+ Db, LatexIndentConfig,
};
pub fn format_with_latexindent(db: &dyn Db, document: Document) -> Option<Vec<TextEdit>> {
let workspace = Workspace::get(db);
- let options = workspace.options(db);
+ let config = db.config();
let target_dir = tempdir().ok()?;
let source_dir = workspace
.working_dir(db, document.directory(db))
@@ -29,9 +29,9 @@ pub fn format_with_latexindent(db: &dyn Db, document: Document) -> Option<Vec<Te
} else {
"file.tex"
});
- std::fs::write(&target_file, document.contents(db).text(db)).ok()?;
+ std::fs::write(&target_file, document.text(db)).ok()?;
- let args = build_arguments(&options.latexindent, &target_file);
+ let args = build_arguments(&config.formatting.latex_indent, &target_file);
log::debug!(
"Running latexindent in folder \"{}\" with args: {:?}",
@@ -48,12 +48,12 @@ pub fn format_with_latexindent(db: &dyn Db, document: Document) -> Option<Vec<Te
.output()
.ok()?;
- let old_text = document.contents(db).text(db);
+ let old_text = document.text(db);
let new_text = String::from_utf8_lossy(&output.stdout).into_owned();
if new_text.is_empty() {
None
} else {
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
Some(vec![TextEdit {
range: line_index.line_col_lsp_range(TextRange::new(0.into(), old_text.text_len())),
new_text,
@@ -61,15 +61,15 @@ pub fn format_with_latexindent(db: &dyn Db, document: Document) -> Option<Vec<Te
}
}
-fn build_arguments(options: &LatexindentOptions, target_file: &Path) -> Vec<String> {
+fn build_arguments(config: &LatexIndentConfig, target_file: &Path) -> Vec<String> {
let mut args = Vec::new();
- args.push(match &options.local {
+ args.push(match &config.local {
Some(yaml_file) => format!("--local={yaml_file}"),
None => "--local".to_string(),
});
- if options.modify_line_breaks {
+ if config.modify_line_breaks {
args.push("--modifylinebreaks".to_string());
}
diff --git a/support/texlab/src/features/forward_search.rs b/support/texlab/src/features/forward_search.rs
index 8e5a2cc59c..350fdd02b9 100644
--- a/support/texlab/src/features/forward_search.rs
+++ b/support/texlab/src/features/forward_search.rs
@@ -32,7 +32,7 @@ pub enum Error {
}
pub struct Command {
- executable: String,
+ program: String,
args: Vec<String>,
}
@@ -76,42 +76,30 @@ impl Command {
return Err(Error::PdfNotFound(pdf_path));
}
- let position = position.unwrap_or_else(|| {
- child
- .contents(db)
- .line_index(db)
- .line_col_lsp(child.cursor(db))
- });
+ let position =
+ position.unwrap_or_else(|| child.line_index(db).line_col_lsp(child.cursor(db)));
- let options = &workspace.options(db).forward_search;
+ let Some(config) = &db.config().synctex else {
+ return Err(Error::Unconfigured);
+ };
- let executable = options
- .executable
- .as_deref()
- .ok_or(Error::Unconfigured)?
- .to_string();
+ let program = config.program.clone();
- let args: Vec<_> = options
+ let args: Vec<_> = config
.args
- .as_deref()
- .ok_or(Error::Unconfigured)?
.iter()
.flat_map(|arg| replace_placeholder(tex_path, &pdf_path, position.line, arg))
.collect();
- Ok(Self { executable, args })
+ Ok(Self { program, args })
}
}
impl Command {
pub fn run(self) -> Result<(), Error> {
- log::debug!(
- "Executing forward search: {} {:?}",
- self.executable,
- self.args
- );
+ log::debug!("Executing forward search: {} {:?}", self.program, self.args);
- std::process::Command::new(self.executable)
+ std::process::Command::new(self.program)
.args(self.args)
.stdin(Stdio::null())
.stdout(Stdio::null())
diff --git a/support/texlab/src/features/highlight/label.rs b/support/texlab/src/features/highlight/label.rs
index 2ae66d5c47..e362295b04 100644
--- a/support/texlab/src/features/highlight/label.rs
+++ b/support/texlab/src/features/highlight/label.rs
@@ -11,7 +11,7 @@ pub fn find_highlights(context: &CursorContext) -> Option<Vec<DocumentHighlight>
let data = context.document.parse(db).as_tex()?;
let mut highlights = Vec::new();
- let line_index = context.document.contents(db).line_index(db);
+ let line_index = context.document.line_index(db);
for label in data
.analyze(db)
.labels(db)
diff --git a/support/texlab/src/features/hover.rs b/support/texlab/src/features/hover.rs
index 27d07f74cd..6baeab8ad6 100644
--- a/support/texlab/src/features/hover.rs
+++ b/support/texlab/src/features/hover.rs
@@ -24,7 +24,7 @@ pub fn find(db: &dyn Db, uri: &Url, position: Position) -> Option<Hover> {
.or_else(|| field::find_hover(&context))
.or_else(|| entry_type::find_hover(&context))?;
- let line_index = context.document.contents(db).line_index(db);
+ let line_index = context.document.line_index(db);
Some(Hover {
contents: HoverContents::Markup(MarkupContent {
kind: result.value_kind,
diff --git a/support/texlab/src/features/inlay_hint.rs b/support/texlab/src/features/inlay_hint.rs
index 6d53259900..5d2f5d4e11 100644
--- a/support/texlab/src/features/inlay_hint.rs
+++ b/support/texlab/src/features/inlay_hint.rs
@@ -11,7 +11,7 @@ use crate::{
pub fn find_all(db: &dyn Db, uri: &Url, range: Range) -> Option<Vec<InlayHint>> {
let document = Workspace::get(db).lookup_uri(db, uri)?;
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let mut builder = InlayHintBuilder {
line_index,
diff --git a/support/texlab/src/features/inlay_hint/label.rs b/support/texlab/src/features/inlay_hint/label.rs
index 5654f79bf4..ca52433e7b 100644
--- a/support/texlab/src/features/inlay_hint/label.rs
+++ b/support/texlab/src/features/inlay_hint/label.rs
@@ -2,7 +2,8 @@ use rowan::TextRange;
use crate::{
db::{analysis::label, Document},
- util, Db,
+ util::{self, label::LabeledObject},
+ Db,
};
use super::InlayHintBuilder;
@@ -23,7 +24,23 @@ pub(super) fn find_hints(
.filter(|label| label.range(db).intersect(range).is_some())
{
if let Some(rendered) = util::label::render(db, document, label) {
- builder.push(label.range(db).end(), rendered.reference(db));
+ if let Some(number) = &rendered.number {
+ let text = match &rendered.object {
+ LabeledObject::Section { prefix, .. } => {
+ format!("{} {}", prefix, number.text(db))
+ }
+ LabeledObject::Float { kind, .. } => {
+ format!("{} {}", kind.as_str(), number.text(db))
+ }
+ LabeledObject::Theorem { kind, .. } => {
+ format!("{} {}", kind.text(db), number.text(db))
+ }
+ LabeledObject::Equation => format!("Equation ({})", number.text(db)),
+ LabeledObject::EnumItem => format!("Item {}", number.text(db)),
+ };
+
+ builder.push(label.range(db).end(), text);
+ }
}
}
diff --git a/support/texlab/src/features/link.rs b/support/texlab/src/features/link.rs
index 71bba58ba7..c252fc4a91 100644
--- a/support/texlab/src/features/link.rs
+++ b/support/texlab/src/features/link.rs
@@ -13,7 +13,7 @@ pub fn find_all(db: &dyn Db, uri: &Url) -> Option<Vec<DocumentLink>> {
let document = Workspace::get(db).lookup_uri(db, uri)?;
let mut builder = LinkBuilder {
db,
- line_index: document.contents(db).line_index(db),
+ line_index: document.line_index(db),
links: Vec::new(),
};
diff --git a/support/texlab/src/features/reference.rs b/support/texlab/src/features/reference.rs
index 54a5fefb27..3815accc2f 100644
--- a/support/texlab/src/features/reference.rs
+++ b/support/texlab/src/features/reference.rs
@@ -30,7 +30,6 @@ pub fn find_all(
uri: result.document.location(db).uri(db).clone(),
range: result
.document
- .contents(db)
.line_index(db)
.line_col_lsp_range(result.range),
})
diff --git a/support/texlab/src/features/rename.rs b/support/texlab/src/features/rename.rs
index 57e1ef5763..51781517b6 100644
--- a/support/texlab/src/features/rename.rs
+++ b/support/texlab/src/features/rename.rs
@@ -18,7 +18,7 @@ pub fn prepare_rename_all(db: &dyn Db, uri: &Url, position: Position) -> Option<
.or_else(|| label::prepare_rename(&context))
.or_else(|| command::prepare_rename(&context))?;
- let line_index = context.document.contents(db).line_index(db);
+ let line_index = context.document.line_index(db);
Some(line_index.line_col_lsp_range(range))
}
@@ -37,7 +37,7 @@ pub fn rename_all(
.changes
.into_iter()
.map(|(document, old_edits)| {
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let new_edits = old_edits
.into_iter()
.map(|Indel { delete, insert }| {
diff --git a/support/texlab/src/features/rename/command.rs b/support/texlab/src/features/rename/command.rs
index 5610b2f7ee..1e5f2ff0ca 100644
--- a/support/texlab/src/features/rename/command.rs
+++ b/support/texlab/src/features/rename/command.rs
@@ -1,7 +1,7 @@
use rowan::{TextRange, TextSize};
use rustc_hash::FxHashMap;
-use crate::util::cursor::CursorContext;
+use crate::{syntax::latex, util::cursor::CursorContext};
use super::{Indel, Params, RenameResult};
@@ -19,7 +19,7 @@ pub(super) fn rename(context: &CursorContext<Params>) -> Option<RenameResult> {
let edits = root
.descendants_with_tokens()
.filter_map(|element| element.into_token())
- .filter(|token| token.kind().is_command_name() && token.text() == name)
+ .filter(|token| token.kind() == latex::COMMAND_NAME && token.text() == name)
.map(|token| {
let range = token.text_range();
Indel {
diff --git a/support/texlab/src/features/symbol.rs b/support/texlab/src/features/symbol.rs
index 58004b50ef..26a0ec87ef 100644
--- a/support/texlab/src/features/symbol.rs
+++ b/support/texlab/src/features/symbol.rs
@@ -19,9 +19,9 @@ pub fn find_document_symbols(db: &dyn Db, uri: &Url) -> Option<DocumentSymbolRes
latex::find_symbols(db, document, &mut buf);
bibtex::find_symbols(db, document, &mut buf);
- let options = &Workspace::get(db).options(db).symbols;
+ let config = &db.config().symbols;
- InternalSymbol::filter(&mut buf, &options);
+ InternalSymbol::filter(&mut buf, &config);
if workspace
.client_capabilities(db)
diff --git a/support/texlab/src/features/symbol/bibtex.rs b/support/texlab/src/features/symbol/bibtex.rs
index 6a92405f17..80c10ee1ba 100644
--- a/support/texlab/src/features/symbol/bibtex.rs
+++ b/support/texlab/src/features/symbol/bibtex.rs
@@ -15,7 +15,7 @@ use super::types::{InternalSymbol, InternalSymbolKind};
pub fn find_symbols(db: &dyn Db, document: Document, buf: &mut Vec<InternalSymbol>) -> Option<()> {
let data = document.parse(db).as_bib()?;
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
for node in data.root(db).children() {
process_string(node.clone(), line_index, buf)
.or_else(|| process_entry(node, line_index, buf));
diff --git a/support/texlab/src/features/symbol/latex.rs b/support/texlab/src/features/symbol/latex.rs
index 81927ab515..8bb5680483 100644
--- a/support/texlab/src/features/symbol/latex.rs
+++ b/support/texlab/src/features/symbol/latex.rs
@@ -9,7 +9,6 @@ use crate::{
syntax::latex::{self, HasBrack, HasCurly},
util::{
label::{find_caption_by_parent, LabeledFloatKind},
- lang_data::LANGUAGE_DATA,
line_index_ext::LineIndexExt,
},
Db,
@@ -41,17 +40,9 @@ fn visit(db: &dyn Db, document: Document, node: latex::SyntaxNode) -> Vec<Intern
.and_then(|name| name.key())
.map(|name| name.to_string())
.and_then(|name| {
- if LANGUAGE_DATA
- .math_environments
- .iter()
- .any(|env| env == &name)
- {
+ if db.config().syntax.math_environments.contains(&name) {
visit_equation_environment(db, document, node.clone())
- } else if LANGUAGE_DATA
- .enum_environments
- .iter()
- .any(|env| env == &name)
- {
+ } else if db.config().syntax.enum_environments.contains(&name) {
visit_enumeration(db, document, node.clone(), &name)
} else if let Ok(float_kind) = LabeledFloatKind::from_str(&name) {
visit_float(db, document, node.clone(), float_kind)
@@ -86,7 +77,6 @@ fn visit_section(
) -> Option<InternalSymbol> {
let section = latex::Section::cast(node)?;
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&section));
@@ -133,6 +123,7 @@ fn visit_enum_item(
document: Document,
node: latex::SyntaxNode,
) -> Option<InternalSymbol> {
+ let enum_envs = &db.config().syntax.enum_environments;
let enum_item = latex::EnumItem::cast(node.clone())?;
if !enum_item
.syntax()
@@ -141,18 +132,12 @@ fn visit_enum_item(
.filter_map(|environment| environment.begin())
.filter_map(|begin| begin.name())
.filter_map(|name| name.key())
- .any(|name| {
- LANGUAGE_DATA
- .enum_environments
- .iter()
- .any(|e| e == &name.to_string())
- })
+ .any(|name| enum_envs.contains(&name.to_string()))
{
return None;
}
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&enum_item));
@@ -198,7 +183,6 @@ fn visit_equation(
let equation = latex::Equation::cast(node)?;
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&equation));
@@ -213,7 +197,6 @@ fn visit_equation_environment(
let environment = latex::Environment::cast(node)?;
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&environment));
@@ -268,7 +251,6 @@ fn visit_enumeration(
) -> Option<InternalSymbol> {
let environment = latex::Environment::cast(node)?;
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&environment));
@@ -315,7 +297,6 @@ fn visit_float(
) -> Option<InternalSymbol> {
let environment = latex::Environment::cast(node)?;
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&environment));
@@ -382,7 +363,6 @@ fn visit_theorem(
.and_then(|option| option.content_text());
let full_range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&node));
@@ -454,7 +434,6 @@ fn find_label_by_parent(
let node = parent.children().find_map(latex::LabelDefinition::cast)?;
let name = Word::new(db, node.name()?.key()?.to_string());
let range = document
- .contents(db)
.line_index(db)
.line_col_lsp_range(latex::small_range(&node));
diff --git a/support/texlab/src/features/symbol/types.rs b/support/texlab/src/features/symbol/types.rs
index fb3bca217b..96b26be153 100644
--- a/support/texlab/src/features/symbol/types.rs
+++ b/support/texlab/src/features/symbol/types.rs
@@ -3,7 +3,7 @@ use lsp_types::{DocumentSymbol, Location, Range, SymbolInformation, SymbolKind,
use crate::{
db::Word,
util::{self, lang_data::BibtexEntryTypeCategory, lsp_enums::Structure},
- Db, SymbolOptions,
+ Db, SymbolConfig,
};
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
@@ -80,17 +80,17 @@ impl InternalSymbol {
buffer.push(self);
}
- pub fn filter(container: &mut Vec<InternalSymbol>, options: &SymbolOptions) {
+ pub fn filter(container: &mut Vec<InternalSymbol>, config: &SymbolConfig) {
let mut i = 0;
while i < container.len() {
let symbol = &mut container[i];
if util::regex_filter::filter(
&symbol.name,
- &options.allowed_patterns,
- &options.ignored_patterns,
+ &config.allowed_patterns,
+ &config.ignored_patterns,
) {
- Self::filter(&mut symbol.children, options);
+ Self::filter(&mut symbol.children, config);
i += 1;
} else {
drop(symbol);
diff --git a/support/texlab/src/features/workspace_command.rs b/support/texlab/src/features/workspace_command.rs
index 8d6732cd1c..cac998125e 100644
--- a/support/texlab/src/features/workspace_command.rs
+++ b/support/texlab/src/features/workspace_command.rs
@@ -1,103 +1,3 @@
-use std::process::Stdio;
-
-use anyhow::{bail, Result};
-use lsp_types::{TextDocumentIdentifier, Url};
-use thiserror::Error;
-
-use crate::{db::Workspace, normalize_uri, Db};
-
-pub fn select(db: &dyn Db, name: &str, args: Vec<serde_json::Value>) -> Result<CleanCommand> {
- Ok(match name {
- "texlab.cleanAuxiliary" => CleanCommand::new(db, CleanOptions::Auxiliary, args)?,
- "texlab.cleanArtifacts" => CleanCommand::new(db, CleanOptions::Artifacts, args)?,
- _ => bail!("Unknown command: {}", name),
- })
-}
-
-#[derive(Debug, Error)]
-pub enum CleanError {
- #[error("document '{0}' not found")]
- DocumentNotFound(Url),
-
- #[error("document '{0}' is not a local file")]
- NoLocalFile(Url),
-
- #[error("document was not provided as an argument")]
- MissingArg,
-
- #[error("invalid argument: {0}")]
- InvalidArg(serde_json::Error),
-
- #[error("failed to spawn process: {0}")]
- Spawn(std::io::Error),
-}
-
-#[derive(Debug)]
-pub struct CleanCommand {
- executable: String,
- args: Vec<String>,
-}
-
-impl CleanCommand {
- fn new(db: &dyn Db, options: CleanOptions, args: Vec<serde_json::Value>) -> Result<Self> {
- let params: TextDocumentIdentifier =
- serde_json::from_value(args.into_iter().next().ok_or(CleanError::MissingArg)?)
- .map_err(CleanError::InvalidArg)?;
-
- let mut uri = params.uri;
- normalize_uri(&mut uri);
-
- let workspace = Workspace::get(db);
-
- let document = workspace
- .lookup_uri(db, &uri)
- .ok_or_else(|| CleanError::DocumentNotFound(uri.clone()))?;
-
- let working_dir = workspace.working_dir(db, document.directory(db));
-
- let output_dir = workspace
- .output_dir(db, working_dir)
- .path(db)
- .as_deref()
- .ok_or_else(|| CleanError::NoLocalFile(uri.clone()))?;
-
- let path = document
- .location(db)
- .path(db)
- .as_deref()
- .ok_or_else(|| CleanError::NoLocalFile(uri.clone()))?;
-
- let flag = match options {
- CleanOptions::Auxiliary => "-c",
- CleanOptions::Artifacts => "-C",
- };
-
- let executable = "latexmk".to_string();
- let args = vec![
- format!("-outdir={}", output_dir.display()),
- flag.to_string(),
- path.display().to_string(),
- ];
-
- Ok(Self { executable, args })
- }
-
- pub fn run(self) -> Result<(), CleanError> {
- log::debug!("Cleaning output files: {} {:?}", self.executable, self.args);
- std::process::Command::new(self.executable)
- .args(self.args)
- .stdin(Stdio::null())
- .stdout(Stdio::null())
- .stderr(Stdio::null())
- .status()
- .map_err(CleanError::Spawn)?;
-
- Ok(())
- }
-}
-
-#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
-enum CleanOptions {
- Auxiliary,
- Artifacts,
-}
+pub mod change_environment;
+pub mod clean;
+pub mod dep_graph;
diff --git a/support/texlab/src/features/workspace_command/change_environment.rs b/support/texlab/src/features/workspace_command/change_environment.rs
new file mode 100644
index 0000000000..ef2c96eae1
--- /dev/null
+++ b/support/texlab/src/features/workspace_command/change_environment.rs
@@ -0,0 +1,108 @@
+use std::collections::hash_map::HashMap;
+
+use anyhow::Result;
+use lsp_types::{ApplyWorkspaceEditParams, TextDocumentPositionParams, TextEdit, WorkspaceEdit};
+use rowan::ast::AstNode;
+use serde::{Deserialize, Serialize};
+use thiserror::Error;
+
+use crate::{
+ normalize_uri,
+ util::{cursor::CursorContext, line_index_ext::LineIndexExt},
+ Db,
+};
+
+fn change_environment_context(
+ db: &dyn Db,
+ args: Vec<serde_json::Value>,
+) -> Result<CursorContext<Params>> {
+ let params: ChangeEnvironmentParams = serde_json::from_value(
+ args.into_iter()
+ .next()
+ .ok_or(ChangeEnvironmentError::MissingArg)?,
+ )
+ .map_err(ChangeEnvironmentError::InvalidArg)?;
+
+ let mut uri = params.text_document_position.text_document.uri;
+ normalize_uri(&mut uri);
+ let position = params.text_document_position.position;
+
+ CursorContext::new(
+ db,
+ &uri,
+ position,
+ Params {
+ new_name: params.new_name,
+ },
+ )
+ .ok_or(ChangeEnvironmentError::FailedCreatingContext.into())
+}
+
+pub fn change_environment(
+ db: &dyn Db,
+ args: Vec<serde_json::Value>,
+) -> Option<((), ApplyWorkspaceEditParams)> {
+ let context = change_environment_context(db, args).ok()?;
+ let (beg, end) = context.find_environment()?;
+
+ let beg_name = beg.to_string();
+ let end_name = end.to_string();
+
+ if beg_name != end_name {
+ return None;
+ }
+ let new_name = &context.params.new_name;
+
+ let line_index = context.document.line_index(db);
+ let mut changes = HashMap::default();
+ changes.insert(
+ context.document.location(db).uri(db).clone(),
+ vec![
+ TextEdit::new(
+ line_index.line_col_lsp_range(beg.syntax().text_range()),
+ new_name.clone(),
+ ),
+ TextEdit::new(
+ line_index.line_col_lsp_range(end.syntax().text_range()),
+ new_name.clone(),
+ ),
+ ],
+ );
+
+ Some((
+ (),
+ ApplyWorkspaceEditParams {
+ label: Some(format!("change environment: {} -> {}", beg_name, new_name)),
+ edit: WorkspaceEdit::new(changes),
+ },
+ ))
+}
+
+#[derive(Debug, Error)]
+pub enum ChangeEnvironmentError {
+ #[error("rename parameters was not provided as an argument")]
+ MissingArg,
+
+ #[error("invalid argument: {0}")]
+ InvalidArg(serde_json::Error),
+
+ #[error("failed creating context")]
+ FailedCreatingContext,
+
+ #[error("could not create workspaces edit")]
+ CouldNotCreateWorkspaceEdit,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ChangeEnvironmentParams {
+ #[serde(flatten)]
+ pub text_document_position: TextDocumentPositionParams,
+
+ pub new_name: String,
+}
+
+#[derive(Debug)]
+pub struct Params {
+ new_name: String,
+}
diff --git a/support/texlab/src/features/workspace_command/clean.rs b/support/texlab/src/features/workspace_command/clean.rs
new file mode 100644
index 0000000000..cea22fc687
--- /dev/null
+++ b/support/texlab/src/features/workspace_command/clean.rs
@@ -0,0 +1,95 @@
+use std::process::Stdio;
+
+use anyhow::Result;
+use lsp_types::{TextDocumentIdentifier, Url};
+use thiserror::Error;
+
+use crate::{db::Workspace, normalize_uri, Db};
+
+#[derive(Debug, Error)]
+pub enum CleanError {
+ #[error("document '{0}' not found")]
+ DocumentNotFound(Url),
+
+ #[error("document '{0}' is not a local file")]
+ NoLocalFile(Url),
+
+ #[error("document was not provided as an argument")]
+ MissingArg,
+
+ #[error("invalid argument: {0}")]
+ InvalidArg(serde_json::Error),
+
+ #[error("failed to spawn process: {0}")]
+ Spawn(std::io::Error),
+}
+
+#[derive(Debug)]
+pub struct CleanCommand {
+ executable: String,
+ args: Vec<String>,
+}
+
+impl CleanCommand {
+ pub fn new(db: &dyn Db, options: CleanOptions, args: Vec<serde_json::Value>) -> Result<Self> {
+ let params: TextDocumentIdentifier =
+ serde_json::from_value(args.into_iter().next().ok_or(CleanError::MissingArg)?)
+ .map_err(CleanError::InvalidArg)?;
+
+ let mut uri = params.uri;
+ normalize_uri(&mut uri);
+
+ let workspace = Workspace::get(db);
+
+ let document = workspace
+ .lookup_uri(db, &uri)
+ .ok_or_else(|| CleanError::DocumentNotFound(uri.clone()))?;
+
+ let working_dir = workspace.working_dir(db, document.directory(db));
+
+ let output_dir = workspace
+ .output_dir(db, working_dir)
+ .path(db)
+ .as_deref()
+ .ok_or_else(|| CleanError::NoLocalFile(uri.clone()))?;
+
+ let path = document
+ .location(db)
+ .path(db)
+ .as_deref()
+ .ok_or_else(|| CleanError::NoLocalFile(uri.clone()))?;
+
+ let flag = match options {
+ CleanOptions::Auxiliary => "-c",
+ CleanOptions::Artifacts => "-C",
+ };
+
+ let executable = "latexmk".to_string();
+ let args = vec![
+ format!("-outdir={}", output_dir.display()),
+ flag.to_string(),
+ path.display().to_string(),
+ ];
+
+ Ok(Self { executable, args })
+ }
+
+ pub fn run(self) -> Result<()> {
+ log::debug!("Cleaning output files: {} {:?}", self.executable, self.args);
+ std::process::Command::new(self.executable)
+ .args(self.args)
+ .stdin(Stdio::null())
+ .stdout(Stdio::null())
+ .stderr(Stdio::null())
+ .status()
+ .map_err(move |msg| anyhow::Error::new(CleanError::Spawn(msg)))?;
+
+ Ok(())
+ }
+}
+
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
+pub enum CleanOptions {
+ Auxiliary,
+ Artifacts,
+}
diff --git a/support/texlab/src/features/workspace_command/dep_graph.rs b/support/texlab/src/features/workspace_command/dep_graph.rs
new file mode 100644
index 0000000000..84e87c4026
--- /dev/null
+++ b/support/texlab/src/features/workspace_command/dep_graph.rs
@@ -0,0 +1,57 @@
+use anyhow::Result;
+use itertools::Itertools;
+use std::io::Write;
+
+use rustc_hash::FxHashMap;
+
+use crate::{
+ db::{dependency_graph, Document, Workspace},
+ Db,
+};
+
+pub fn show_dependency_graph(db: &dyn Db) -> Result<String> {
+ let workspace = Workspace::get(db);
+
+ let documents = workspace
+ .documents(db)
+ .iter()
+ .enumerate()
+ .map(|(i, doc)| (*doc, format!("v{i:0>5}")))
+ .collect::<FxHashMap<Document, String>>();
+
+ let mut writer = Vec::new();
+ writeln!(&mut writer, "digraph G {{")?;
+ writeln!(&mut writer, "rankdir = LR;")?;
+
+ for (document, node) in &documents {
+ let label = document.location(db).uri(db).as_str();
+ let shape = if document.can_be_root(db) {
+ "tripleoctagon"
+ } else if document.can_be_built(db) {
+ "doubleoctagon"
+ } else {
+ "octagon"
+ };
+
+ writeln!(&mut writer, "\t{node} [label=\"{label}\", shape={shape}];")?;
+ }
+
+ for edge in workspace
+ .documents(db)
+ .iter()
+ .flat_map(|start| dependency_graph(db, *start).edges.iter())
+ .unique()
+ {
+ let source = &documents[&edge.source];
+ let target = &documents[&edge.target];
+ let label = edge
+ .origin
+ .as_ref()
+ .map_or("<artifact>", |origin| &origin.link.path(db).text(db));
+
+ writeln!(&mut writer, "\t{source} -> {target} [label=\"{label}\"];")?;
+ }
+
+ writeln!(&mut writer, "}}")?;
+ Ok(String::from_utf8(writer)?)
+}
diff --git a/support/texlab/src/lib.rs b/support/texlab/src/lib.rs
index 46ee3ddd1c..d80375fa03 100644
--- a/support/texlab/src/lib.rs
+++ b/support/texlab/src/lib.rs
@@ -2,29 +2,29 @@
pub(crate) mod citation;
mod client;
+mod config;
pub mod db;
pub(crate) mod distro;
pub mod features;
-mod options;
pub mod parser;
mod server;
pub mod syntax;
pub mod util;
-pub use self::{client::LspClient, options::*, server::Server};
+pub use self::{client::LspClient, config::*, server::Server};
#[salsa::jar(db = Db)]
pub struct Jar(
db::Word,
+ db::ServerContext,
db::Location,
db::Location_path,
- db::Contents,
- db::Contents_line_index,
db::LinterData,
db::Document,
db::Document_parse,
db::Document_can_be_root,
db::Document_can_be_built,
+ db::Document_line_index,
db::parse::TexDocumentData,
db::parse::TexDocumentData_analyze,
db::parse::BibDocumentData,
@@ -53,27 +53,34 @@ pub struct Jar(
db::diagnostics::collect_filtered,
);
-pub trait Db: salsa::DbWithJar<Jar> {}
-
-impl<DB> Db for DB where DB: ?Sized + salsa::DbWithJar<Jar> {}
+pub trait Db: salsa::DbWithJar<Jar> {
+ fn config(&self) -> &Config;
+}
#[salsa::db(crate::Jar)]
pub struct Database {
storage: salsa::Storage<Self>,
}
+impl Db for Database {
+ fn config(&self) -> &Config {
+ db::ServerContext::get(self).config(self)
+ }
+}
+
impl Default for Database {
fn default() -> Self {
let storage = salsa::Storage::default();
let db = Self { storage };
+
+ db::ServerContext::new(&db, Default::default(), Default::default());
+
db::Workspace::new(
&db,
Default::default(),
Default::default(),
Default::default(),
Default::default(),
- Default::default(),
- Default::default(),
);
db
diff --git a/support/texlab/src/options.rs b/support/texlab/src/options.rs
deleted file mode 100644
index 0e87d11fab..0000000000
--- a/support/texlab/src/options.rs
+++ /dev/null
@@ -1,144 +0,0 @@
-use std::{path::PathBuf, time::Duration};
-
-use regex::Regex;
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct Options {
- pub root_directory: Option<PathBuf>,
- pub aux_directory: Option<PathBuf>,
- pub bibtex_formatter: BibtexFormatter,
- pub latex_formatter: LatexFormatter,
- pub formatter_line_length: Option<i32>,
- pub diagnostics: DiagnosticsOptions,
- pub diagnostics_delay: DiagnosticsDelay,
- pub build: BuildOptions,
- pub chktex: ChktexOptions,
- pub symbols: SymbolOptions,
- pub latexindent: LatexindentOptions,
- pub forward_search: ForwardSearchOptions,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
-pub struct DiagnosticsDelay(#[serde(with = "serde_millis")] pub Duration);
-
-impl Default for DiagnosticsDelay {
- fn default() -> Self {
- Self(Duration::from_millis(300))
- }
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
-#[serde(rename_all = "kebab-case")]
-pub enum BibtexFormatter {
- None,
- Texlab,
- Latexindent,
-}
-
-impl Default for BibtexFormatter {
- fn default() -> Self {
- Self::Texlab
- }
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
-#[serde(rename_all = "kebab-case")]
-pub enum LatexFormatter {
- None,
- Texlab,
- Latexindent,
-}
-
-impl Default for LatexFormatter {
- fn default() -> Self {
- Self::Latexindent
- }
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct LatexindentOptions {
- pub local: Option<String>,
- pub modify_line_breaks: bool,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct BuildOptions {
- pub executable: BuildExecutable,
- pub args: BuildArgs,
- pub on_save: bool,
- pub forward_search_after: bool,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct BuildExecutable(pub String);
-
-impl Default for BuildExecutable {
- fn default() -> Self {
- Self("latexmk".to_string())
- }
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
-#[serde(transparent)]
-pub struct BuildArgs(pub Vec<String>);
-
-impl Default for BuildArgs {
- fn default() -> Self {
- Self(vec![
- "-pdf".to_string(),
- "-interaction=nonstopmode".to_string(),
- "-synctex=1".to_string(),
- "%f".to_string(),
- ])
- }
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct ChktexOptions {
- pub on_open_and_save: bool,
- pub on_edit: bool,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct ForwardSearchOptions {
- pub executable: Option<String>,
- pub args: Option<Vec<String>>,
-}
-
-#[derive(Debug, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct DiagnosticsOptions {
- pub allowed_patterns: Vec<RegexPattern>,
- pub ignored_patterns: Vec<RegexPattern>,
-}
-
-#[derive(Debug, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct SymbolOptions {
- pub allowed_patterns: Vec<RegexPattern>,
- pub ignored_patterns: Vec<RegexPattern>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct RegexPattern(#[serde(with = "serde_regex")] pub Regex);
-
-#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[serde(default)]
-pub struct StartupOptions {
- pub skip_distro: bool,
-}
diff --git a/support/texlab/src/parser/latex.rs b/support/texlab/src/parser/latex.rs
index a103561685..591d2a1583 100644
--- a/support/texlab/src/parser/latex.rs
+++ b/support/texlab/src/parser/latex.rs
@@ -4,7 +4,10 @@ use rowan::{GreenNode, GreenNodeBuilder};
use crate::syntax::latex::SyntaxKind::{self, *};
-use self::lexer::Lexer;
+use self::lexer::{
+ types::{CommandName, SectionLevel, Token},
+ Lexer,
+};
#[derive(Debug, Clone, Copy)]
struct ParserContext {
@@ -40,20 +43,18 @@ impl<'a> Parser<'a> {
self.builder.token(kind.into(), text);
}
- fn peek(&self) -> Option<SyntaxKind> {
+ fn peek(&self) -> Option<Token> {
self.lexer.peek()
}
- fn expect(&mut self, kind: SyntaxKind) {
+ fn expect(&mut self, kind: Token) {
if self.peek() == Some(kind) {
self.eat();
self.trivia();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
- fn expect2(&mut self, kind1: SyntaxKind, kind2: SyntaxKind) {
+ fn expect2(&mut self, kind1: Token, kind2: Token) {
if self
.peek()
.filter(|&kind| kind == kind1 || kind == kind2)
@@ -61,17 +62,16 @@ impl<'a> Parser<'a> {
{
self.eat();
self.trivia();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
fn trivia(&mut self) {
- while self
- .peek()
- .filter(|&kind| matches!(kind, LINE_BREAK | WHITESPACE | COMMENT))
- .is_some()
- {
+ while self.peek().map_or(false, |kind| {
+ matches!(
+ kind,
+ Token::LineBreak | Token::Whitespace | Token::LineComment
+ )
+ }) {
self.eat();
}
}
@@ -88,66 +88,60 @@ impl<'a> Parser<'a> {
fn content(&mut self, context: ParserContext) {
match self.peek().unwrap() {
- LINE_BREAK | WHITESPACE | COMMENT | VERBATIM => self.eat(),
- L_CURLY if context.allow_environment => self.curly_group(),
- L_CURLY => self.curly_group_without_environments(),
- L_BRACK | L_PAREN => self.mixed_group(),
- R_CURLY | R_BRACK | R_PAREN => {
+ Token::LineBreak | Token::Whitespace | Token::LineComment => self.eat(),
+ Token::LCurly if context.allow_environment => self.curly_group(),
+ Token::LCurly => self.curly_group_without_environments(),
+ Token::LBrack | Token::LParen => self.mixed_group(),
+ Token::RCurly | Token::RBrack | Token::RParen => {
self.builder.start_node(ERROR.into());
self.eat();
self.builder.finish_node();
}
- WORD | COMMA => self.text(context),
- EQUALITY_SIGN => self.eat(),
- DOLLAR => self.formula(),
- GENERIC_COMMAND_NAME => self.generic_command(),
- BEGIN_ENVIRONMENT_NAME if context.allow_environment => self.environment(),
- BEGIN_ENVIRONMENT_NAME => self.generic_command(),
- END_ENVIRONMENT_NAME => self.generic_command(),
- BEGIN_EQUATION_NAME => self.equation(),
- END_EQUATION_NAME => self.generic_command(),
- MISSING | ERROR => self.eat(),
- PART_NAME => self.part(),
- CHAPTER_NAME => self.chapter(),
- SECTION_NAME => self.section(),
- SUBSECTION_NAME => self.subsection(),
- SUBSUBSECTION_NAME => self.subsubsection(),
- PARAGRAPH_NAME => self.paragraph(),
- SUBPARAGRAPH_NAME => self.subparagraph(),
- ENUM_ITEM_NAME => self.enum_item(),
- CAPTION_NAME => self.caption(),
- CITATION_NAME => self.citation(),
- PACKAGE_INCLUDE_NAME => self.package_include(),
- CLASS_INCLUDE_NAME => self.class_include(),
- LATEX_INCLUDE_NAME => self.latex_include(),
- BIBLATEX_INCLUDE_NAME => self.biblatex_include(),
- BIBTEX_INCLUDE_NAME => self.bibtex_include(),
- GRAPHICS_INCLUDE_NAME => self.graphics_include(),
- SVG_INCLUDE_NAME => self.svg_include(),
- INKSCAPE_INCLUDE_NAME => self.inkscape_include(),
- VERBATIM_INCLUDE_NAME => self.verbatim_include(),
- IMPORT_NAME => self.import(),
- LABEL_DEFINITION_NAME => self.label_definition(),
- LABEL_REFERENCE_NAME => self.label_reference(),
- LABEL_REFERENCE_RANGE_NAME => self.label_reference_range(),
- LABEL_NUMBER_NAME => self.label_number(),
- COMMAND_DEFINITION_NAME => self.command_definition(),
- MATH_OPERATOR_NAME => self.math_operator(),
- GLOSSARY_ENTRY_DEFINITION_NAME => self.glossary_entry_definition(),
- GLOSSARY_ENTRY_REFERENCE_NAME => self.glossary_entry_reference(),
- ACRONYM_DEFINITION_NAME => self.acronym_definition(),
- ACRONYM_DECLARATION_NAME => self.acronym_declaration(),
- ACRONYM_REFERENCE_NAME => self.acronym_reference(),
- THEOREM_DEFINITION_NAME => self.theorem_definition(),
- COLOR_REFERENCE_NAME => self.color_reference(),
- COLOR_DEFINITION_NAME => self.color_definition(),
- COLOR_SET_DEFINITION_NAME => self.color_set_definition(),
- TIKZ_LIBRARY_IMPORT_NAME => self.tikz_library_import(),
- ENVIRONMENT_DEFINITION_NAME => self.environment_definition(),
- BEGIN_BLOCK_COMMENT_NAME => self.block_comment(),
- END_BLOCK_COMMENT_NAME => self.generic_command(),
- GRAPHICS_PATH_NAME => self.graphics_path(),
- _ => unreachable!(),
+ Token::Word | Token::Comma => self.text(context),
+ Token::Eq => self.eat(),
+ Token::Dollar => self.formula(),
+ Token::CommandName(name) => match name {
+ CommandName::Generic => self.generic_command(),
+ CommandName::BeginEnvironment if context.allow_environment => self.environment(),
+ CommandName::BeginEnvironment => self.generic_command(),
+ CommandName::EndEnvironment => self.generic_command(),
+ CommandName::BeginEquation => self.equation(),
+ CommandName::EndEquation => self.generic_command(),
+ CommandName::Section(level) => self.section(level),
+ CommandName::EnumItem => self.enum_item(),
+ CommandName::Caption => self.caption(),
+ CommandName::Citation => self.citation(),
+ CommandName::PackageInclude => self.package_include(),
+ CommandName::ClassInclude => self.class_include(),
+ CommandName::LatexInclude => self.latex_include(),
+ CommandName::BiblatexInclude => self.biblatex_include(),
+ CommandName::BibtexInclude => self.bibtex_include(),
+ CommandName::GraphicsInclude => self.graphics_include(),
+ CommandName::SvgInclude => self.svg_include(),
+ CommandName::InkscapeInclude => self.inkscape_include(),
+ CommandName::VerbatimInclude => self.verbatim_include(),
+ CommandName::Import => self.import(),
+ CommandName::LabelDefinition => self.label_definition(),
+ CommandName::LabelReference => self.label_reference(),
+ CommandName::LabelReferenceRange => self.label_reference_range(),
+ CommandName::LabelNumber => self.label_number(),
+ CommandName::CommandDefinition => self.command_definition(),
+ CommandName::MathOperator => self.math_operator(),
+ CommandName::GlossaryEntryDefinition => self.glossary_entry_definition(),
+ CommandName::GlossaryEntryReference => self.glossary_entry_reference(),
+ CommandName::AcronymDefinition => self.acronym_definition(),
+ CommandName::AcronymDeclaration => self.acronym_declaration(),
+ CommandName::AcronymReference => self.acronym_reference(),
+ CommandName::TheoremDefinition => self.theorem_definition(),
+ CommandName::ColorReference => self.color_reference(),
+ CommandName::ColorDefinition => self.color_definition(),
+ CommandName::ColorSetDefinition => self.color_set_definition(),
+ CommandName::TikzLibraryImport => self.tikz_library_import(),
+ CommandName::EnvironmentDefinition => self.environment_definition(),
+ CommandName::BeginBlockComment => self.block_comment(),
+ CommandName::EndBlockComment => self.generic_command(),
+ CommandName::GraphicsPath => self.graphics_path(),
+ },
}
}
@@ -157,8 +151,14 @@ impl<'a> Parser<'a> {
while self
.peek()
.filter(|&kind| {
- matches!(kind, LINE_BREAK | WHITESPACE | COMMENT | WORD | COMMA)
- && (context.allow_comma || kind != COMMA)
+ matches!(
+ kind,
+ Token::LineBreak
+ | Token::Whitespace
+ | Token::LineComment
+ | Token::Word
+ | Token::Comma
+ ) && (context.allow_comma || kind != Token::Comma)
})
.is_some()
{
@@ -172,12 +172,12 @@ impl<'a> Parser<'a> {
self.eat();
while self
.peek()
- .filter(|&kind| !matches!(kind, R_CURLY))
+ .filter(|&kind| !matches!(kind, Token::RCurly))
.is_some()
{
self.content(ParserContext::default());
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -186,13 +186,13 @@ impl<'a> Parser<'a> {
self.eat();
while let Some(kind) = self.peek() {
match kind {
- R_CURLY => break,
- BEGIN_ENVIRONMENT_NAME => self.begin(),
- END_ENVIRONMENT_NAME => self.end(),
+ Token::RCurly => break,
+ Token::CommandName(CommandName::BeginEnvironment) => self.begin(),
+ Token::CommandName(CommandName::EndEnvironment) => self.end(),
_ => self.content(ParserContext::default()),
};
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -201,7 +201,7 @@ impl<'a> Parser<'a> {
self.eat();
while self
.peek()
- .filter(|&kind| !matches!(kind, R_CURLY))
+ .filter(|&kind| !matches!(kind, Token::RCurly))
.is_some()
{
self.content(ParserContext {
@@ -209,7 +209,7 @@ impl<'a> Parser<'a> {
allow_comma: true,
});
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -218,17 +218,15 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
match self.peek() {
- Some(WORD) => {
+ Some(Token::Word) => {
self.key();
}
- Some(kind) if kind.is_command_name() => {
+ Some(Token::CommandName(_)) => {
self.content(ParserContext::default());
}
- Some(_) | None => {
- self.builder.token(MISSING.into(), "");
- }
+ Some(_) | None => {}
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -238,17 +236,26 @@ impl<'a> Parser<'a> {
while self
.peek()
- .filter(|&kind| matches!(kind, LINE_BREAK | WHITESPACE | COMMENT | WORD | COMMA))
+ .filter(|&kind| {
+ matches!(
+ kind,
+ Token::LineBreak
+ | Token::Whitespace
+ | Token::LineComment
+ | Token::Word
+ | Token::Comma
+ )
+ })
.is_some()
{
- if self.peek() == Some(WORD) {
+ if self.peek() == Some(Token::Word) {
self.key();
} else {
self.eat();
}
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -256,44 +263,32 @@ impl<'a> Parser<'a> {
self.builder.start_node(CURLY_GROUP_COMMAND.into());
self.eat();
self.trivia();
- match self.peek() {
- Some(kind) if kind.is_command_name() => {
- self.eat();
- self.trivia();
- }
- Some(_) | None => {
- self.builder.token(MISSING.into(), "");
- }
+ if matches!(self.peek(), Some(Token::CommandName(_))) {
+ self.eat();
+ self.trivia();
}
- self.expect(R_CURLY);
+
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
fn brack_group(&mut self) {
self.builder.start_node(BRACK_GROUP.into());
self.eat();
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- R_CURLY
- | R_BRACK
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | PARAGRAPH_NAME
- | SUBPARAGRAPH_NAME
- | ENUM_ITEM_NAME
- | END_ENVIRONMENT_NAME
- )
- })
- .is_some()
- {
+ while self.peek().map_or(false, |kind| {
+ !matches!(
+ kind,
+ Token::RCurly
+ | Token::RBrack
+ | Token::CommandName(CommandName::Section(_))
+ | Token::CommandName(CommandName::EnumItem)
+ | Token::CommandName(CommandName::EndEnvironment)
+ )
+ }) {
self.content(ParserContext::default());
}
- self.expect(R_BRACK);
+
+ self.expect(Token::RBrack);
self.builder.finish_node();
}
@@ -302,14 +297,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
match self.peek() {
- Some(WORD) => {
+ Some(Token::Word) => {
self.key();
}
- Some(_) | None => {
- self.builder.token(MISSING.into(), "");
- }
+ Some(_) | None => {}
}
- self.expect(R_BRACK);
+ self.expect(Token::RBrack);
self.builder.finish_node();
}
@@ -317,29 +310,21 @@ impl<'a> Parser<'a> {
self.builder.start_node(MIXED_GROUP.into());
self.eat();
self.trivia();
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- R_CURLY
- | R_BRACK
- | R_PAREN
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | PARAGRAPH_NAME
- | SUBPARAGRAPH_NAME
- | ENUM_ITEM_NAME
- | END_ENVIRONMENT_NAME
- )
- })
- .is_some()
- {
+ while self.peek().map_or(false, |kind| {
+ !matches!(
+ kind,
+ Token::RCurly
+ | Token::RBrack
+ | Token::RParen
+ | Token::CommandName(CommandName::Section(_))
+ | Token::CommandName(CommandName::EnumItem)
+ | Token::CommandName(CommandName::EndEnvironment)
+ )
+ }) {
self.content(ParserContext::default());
}
- self.expect2(R_BRACK, R_PAREN);
+
+ self.expect2(Token::RBrack, Token::RParen);
self.builder.finish_node();
}
@@ -348,7 +333,7 @@ impl<'a> Parser<'a> {
self.eat();
while self
.peek()
- .filter(|&kind| matches!(kind, WHITESPACE | COMMENT | WORD))
+ .filter(|&kind| matches!(kind, Token::Whitespace | Token::LineComment | Token::Word))
.is_some()
{
self.eat();
@@ -362,7 +347,7 @@ impl<'a> Parser<'a> {
self.builder.start_node(VALUE.into());
while let Some(kind) = self.lexer.peek() {
match kind {
- COMMA | R_BRACK | R_CURLY => break,
+ Token::Comma | Token::RBrack | Token::RCurly => break,
_ => self.content(ParserContext {
allow_environment: true,
allow_comma: false,
@@ -375,7 +360,7 @@ impl<'a> Parser<'a> {
fn key_value_pair(&mut self) {
self.builder.start_node(KEY_VALUE_PAIR.into());
self.key();
- if self.peek() == Some(EQUALITY_SIGN) {
+ if self.peek() == Some(Token::Eq) {
self.eat();
self.trivia();
if self
@@ -383,14 +368,16 @@ impl<'a> Parser<'a> {
.filter(|&kind| {
!matches!(
kind,
- END_ENVIRONMENT_NAME | R_CURLY | R_BRACK | R_PAREN | COMMA
+ Token::CommandName(CommandName::EndEnvironment)
+ | Token::RCurly
+ | Token::RBrack
+ | Token::RParen
+ | Token::Comma
)
})
.is_some()
{
self.value();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
@@ -401,10 +388,10 @@ impl<'a> Parser<'a> {
self.builder.start_node(KEY_VALUE_BODY.into());
while let Some(kind) = self.peek() {
match kind {
- LINE_BREAK | WHITESPACE | COMMENT => self.eat(),
- WORD => {
+ Token::LineBreak | Token::Whitespace | Token::LineComment => self.eat(),
+ Token::Word => {
self.key_value_pair();
- if self.peek() == Some(COMMA) {
+ if self.peek() == Some(Token::Comma) {
self.eat();
} else {
break;
@@ -416,7 +403,7 @@ impl<'a> Parser<'a> {
self.builder.finish_node();
}
- fn group_key_value(&mut self, node_kind: SyntaxKind, right_kind: SyntaxKind) {
+ fn group_key_value(&mut self, node_kind: SyntaxKind, right_kind: Token) {
self.builder.start_node(node_kind.into());
self.eat();
self.trivia();
@@ -426,11 +413,11 @@ impl<'a> Parser<'a> {
}
fn curly_group_key_value(&mut self) {
- self.group_key_value(CURLY_GROUP_KEY_VALUE, R_CURLY);
+ self.group_key_value(CURLY_GROUP_KEY_VALUE, Token::RCurly);
}
fn brack_group_key_value(&mut self) {
- self.group_key_value(BRACK_GROUP_KEY_VALUE, R_BRACK);
+ self.group_key_value(BRACK_GROUP_KEY_VALUE, Token::RBrack);
}
fn formula(&mut self) {
@@ -439,12 +426,17 @@ impl<'a> Parser<'a> {
self.trivia();
while self
.peek()
- .filter(|&kind| !matches!(kind, R_CURLY | END_ENVIRONMENT_NAME | DOLLAR))
+ .filter(|&kind| {
+ !matches!(
+ kind,
+ Token::RCurly | Token::CommandName(CommandName::EndEnvironment) | Token::Dollar
+ )
+ })
.is_some()
{
self.content(ParserContext::default());
}
- self.expect(DOLLAR);
+ self.expect(Token::Dollar);
self.builder.finish_node();
}
@@ -453,9 +445,9 @@ impl<'a> Parser<'a> {
self.eat();
while let Some(kind) = self.peek() {
match kind {
- LINE_BREAK | WHITESPACE | COMMENT => self.eat(),
- L_CURLY => self.curly_group(),
- L_BRACK | L_PAREN => self.mixed_group(),
+ Token::LineBreak | Token::Whitespace | Token::LineComment => self.eat(),
+ Token::LCurly => self.curly_group(),
+ Token::LBrack | Token::LParen => self.mixed_group(),
_ => break,
}
}
@@ -467,12 +459,19 @@ impl<'a> Parser<'a> {
self.eat();
while self
.peek()
- .filter(|&kind| !matches!(kind, END_ENVIRONMENT_NAME | R_CURLY | END_EQUATION_NAME))
+ .filter(|&kind| {
+ !matches!(
+ kind,
+ Token::CommandName(CommandName::EndEnvironment)
+ | Token::RCurly
+ | Token::CommandName(CommandName::EndEquation)
+ )
+ })
.is_some()
{
self.content(ParserContext::default());
}
- self.expect(END_EQUATION_NAME);
+ self.expect(Token::CommandName(CommandName::EndEquation));
self.builder.finish_node();
}
@@ -481,13 +480,11 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.peek() == Some(L_CURLY) {
+ if self.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.peek() == Some(L_BRACK) {
+ if self.peek() == Some(Token::LBrack) {
self.brack_group();
}
self.builder.finish_node();
@@ -498,10 +495,8 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.peek() == Some(L_CURLY) {
+ if self.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -513,129 +508,29 @@ impl<'a> Parser<'a> {
while self
.peek()
- .filter(|&kind| !matches!(kind, R_CURLY | END_ENVIRONMENT_NAME))
- .is_some()
- {
- self.content(ParserContext::default());
- }
-
- if self.peek() == Some(END_ENVIRONMENT_NAME) {
- self.end();
- } else {
- self.builder.token(MISSING.into(), "");
- }
- self.builder.finish_node();
- }
-
- fn preamble(&mut self) {
- self.builder.start_node(PREAMBLE.into());
- while self
- .peek()
- .filter(|&kind| kind != END_ENVIRONMENT_NAME)
- .is_some()
- {
- self.content(ParserContext::default());
- }
- self.builder.finish_node();
- }
-
- fn part(&mut self) {
- self.builder.start_node(PART.into());
- self.eat();
- self.trivia();
-
- if self.peek() == Some(L_CURLY) {
- self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
- }
-
- while self
- .peek()
- .filter(|&kind| !matches!(kind, END_ENVIRONMENT_NAME | R_CURLY | PART_NAME))
- .is_some()
- {
- self.content(ParserContext::default());
- }
- self.builder.finish_node();
- }
-
- fn chapter(&mut self) {
- self.builder.start_node(CHAPTER.into());
- self.eat();
- self.trivia();
-
- if self.peek() == Some(L_CURLY) {
- self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
- }
-
- while self
- .peek()
.filter(|&kind| {
!matches!(
kind,
- END_ENVIRONMENT_NAME | R_CURLY | PART_NAME | CHAPTER_NAME
+ Token::RCurly | Token::CommandName(CommandName::EndEnvironment)
)
})
.is_some()
{
self.content(ParserContext::default());
}
- self.builder.finish_node();
- }
- fn section(&mut self) {
- self.builder.start_node(SECTION.into());
- self.eat();
- self.trivia();
-
- if self.peek() == Some(L_CURLY) {
- self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
+ if self.peek() == Some(Token::CommandName(CommandName::EndEnvironment)) {
+ self.end();
}
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- END_ENVIRONMENT_NAME | R_CURLY | PART_NAME | CHAPTER_NAME | SECTION_NAME
- )
- })
- .is_some()
- {
- self.content(ParserContext::default());
- }
self.builder.finish_node();
}
- fn subsection(&mut self) {
- self.builder.start_node(SUBSECTION.into());
- self.eat();
- self.trivia();
-
- if self.peek() == Some(L_CURLY) {
- self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
- }
-
+ fn preamble(&mut self) {
+ self.builder.start_node(PREAMBLE.into());
while self
.peek()
- .filter(|&kind| {
- !matches!(
- kind,
- END_ENVIRONMENT_NAME
- | R_CURLY
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- )
- })
+ .filter(|&kind| kind != Token::CommandName(CommandName::EndEnvironment))
.is_some()
{
self.content(ParserContext::default());
@@ -643,102 +538,34 @@ impl<'a> Parser<'a> {
self.builder.finish_node();
}
- fn subsubsection(&mut self) {
- self.builder.start_node(SUBSUBSECTION.into());
- self.eat();
- self.trivia();
+ fn section(&mut self, level: SectionLevel) {
+ let node_kind = match level {
+ SectionLevel::Part => PART,
+ SectionLevel::Chapter => CHAPTER,
+ SectionLevel::Section => SECTION,
+ SectionLevel::Subsection => SUBSECTION,
+ SectionLevel::Subsubsection => SUBSUBSECTION,
+ SectionLevel::Paragraph => PARAGRAPH,
+ SectionLevel::Subparagraph => SUBPARAGRAPH,
+ };
- if self.peek() == Some(L_CURLY) {
- self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
- }
-
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- END_ENVIRONMENT_NAME
- | R_CURLY
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | SUBSUBSECTION_NAME
- )
- })
- .is_some()
- {
- self.content(ParserContext::default());
- }
- self.builder.finish_node();
- }
-
- fn paragraph(&mut self) {
- self.builder.start_node(PARAGRAPH.into());
+ self.builder.start_node(node_kind.into());
self.eat();
self.trivia();
- if self.peek() == Some(L_CURLY) {
+ if self.peek() == Some(Token::LCurly) {
self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
- }
-
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- END_ENVIRONMENT_NAME
- | R_CURLY
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | SUBSUBSECTION_NAME
- | PARAGRAPH_NAME
- )
- })
- .is_some()
- {
- self.content(ParserContext::default());
}
- self.builder.finish_node();
- }
- fn subparagraph(&mut self) {
- self.builder.start_node(SUBPARAGRAPH.into());
- self.eat();
- self.trivia();
-
- if self.peek() == Some(L_CURLY) {
- self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
+ while let Some(kind) = self.peek() {
+ match kind {
+ Token::RCurly => break,
+ Token::CommandName(CommandName::EndEnvironment) => break,
+ Token::CommandName(CommandName::Section(nested)) if nested <= level => break,
+ _ => self.content(ParserContext::default()),
+ };
}
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- END_ENVIRONMENT_NAME
- | R_CURLY
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | SUBSUBSECTION_NAME
- | PARAGRAPH_NAME
- | SUBPARAGRAPH_NAME
- )
- })
- .is_some()
- {
- self.content(ParserContext::default());
- }
self.builder.finish_node();
}
@@ -747,31 +574,20 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.peek() == Some(L_BRACK) {
+ if self.peek() == Some(Token::LBrack) {
self.brack_group();
}
- while self
- .peek()
- .filter(|&kind| {
- !matches!(
- kind,
- END_ENVIRONMENT_NAME
- | R_CURLY
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | SUBSUBSECTION_NAME
- | PARAGRAPH_NAME
- | SUBPARAGRAPH_NAME
- | ENUM_ITEM_NAME
- )
- })
- .is_some()
- {
- self.content(ParserContext::default());
+ while let Some(kind) = self.peek() {
+ match kind {
+ Token::CommandName(CommandName::EndEnvironment)
+ | Token::RCurly
+ | Token::CommandName(CommandName::Section(_))
+ | Token::CommandName(CommandName::EnumItem) => break,
+ _ => self.content(ParserContext::default()),
+ }
}
+
self.builder.finish_node();
}
@@ -779,14 +595,19 @@ impl<'a> Parser<'a> {
self.builder.start_node(BLOCK_COMMENT.into());
self.eat();
- if self.peek() == Some(VERBATIM) {
- self.eat();
- }
-
- if self.peek() == Some(END_BLOCK_COMMENT_NAME) {
- self.eat();
- } else {
- self.builder.token(MISSING.into(), "");
+ while let Some(kind) = self.peek() {
+ match kind {
+ Token::CommandName(CommandName::BeginBlockComment) => {
+ self.block_comment();
+ }
+ Token::CommandName(CommandName::EndBlockComment) => {
+ self.eat();
+ break;
+ }
+ _ => {
+ self.eat();
+ }
+ }
}
self.builder.finish_node();
@@ -797,14 +618,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.peek() == Some(L_BRACK) {
+ if self.peek() == Some(Token::LBrack) {
self.brack_group();
}
- if self.peek() == Some(L_CURLY) {
+ if self.peek() == Some(Token::LCurly) {
self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -815,15 +634,13 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
for _ in 0..2 {
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group();
}
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word_list();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -833,14 +650,12 @@ impl<'a> Parser<'a> {
self.builder.start_node(kind.into());
self.eat();
self.trivia();
- if options && self.lexer.peek() == Some(L_BRACK) {
+ if options && self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_key_value();
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_path_list();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -853,15 +668,20 @@ impl<'a> Parser<'a> {
while let Some(kind) = self.lexer.peek() {
match kind {
- COMMENT | WORD | EQUALITY_SIGN | COMMA | L_BRACK | R_BRACK
- | GENERIC_COMMAND_NAME => self.path(),
- L_CURLY => self.curly_group_path(),
- WHITESPACE => self.eat(),
+ Token::LineComment
+ | Token::Word
+ | Token::Eq
+ | Token::Comma
+ | Token::LBrack
+ | Token::RBrack
+ | Token::CommandName(CommandName::Generic) => self.path(),
+ Token::LCurly => self.curly_group_path(),
+ Token::Whitespace => self.eat(),
_ => break,
};
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -872,16 +692,19 @@ impl<'a> Parser<'a> {
while let Some(kind) = self.peek() {
match kind {
- COMMENT | WORD | EQUALITY_SIGN | L_BRACK | R_BRACK | GENERIC_COMMAND_NAME => {
- self.path()
- }
- WHITESPACE | LINE_BREAK | COMMA => self.eat(),
- L_CURLY => self.curly_group_path(),
+ Token::LineComment
+ | Token::Word
+ | Token::Eq
+ | Token::LBrack
+ | Token::RBrack
+ | Token::CommandName(CommandName::Generic) => self.path(),
+ Token::Whitespace | Token::LineBreak | Token::Comma => self.eat(),
+ Token::LCurly => self.curly_group_path(),
_ => break,
};
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
@@ -891,9 +714,14 @@ impl<'a> Parser<'a> {
while let Some(kind) = self.peek() {
match kind {
- WHITESPACE | COMMENT | WORD | EQUALITY_SIGN | L_BRACK | R_BRACK
- | GENERIC_COMMAND_NAME => self.eat(),
- L_CURLY => self.curly_group_path(),
+ Token::Whitespace
+ | Token::LineComment
+ | Token::Word
+ | Token::Eq
+ | Token::LBrack
+ | Token::RBrack
+ | Token::CommandName(CommandName::Generic) => self.eat(),
+ Token::LCurly => self.curly_group_path(),
_ => break,
};
}
@@ -943,10 +771,8 @@ impl<'a> Parser<'a> {
self.trivia();
for _ in 0..2 {
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
@@ -957,11 +783,10 @@ impl<'a> Parser<'a> {
self.builder.start_node(LABEL_DEFINITION.into());
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
+
self.builder.finish_node();
}
@@ -969,11 +794,10 @@ impl<'a> Parser<'a> {
self.builder.start_node(LABEL_REFERENCE.into());
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word_list();
- } else {
- self.builder.token(MISSING.into(), "");
}
+
self.builder.finish_node();
}
@@ -983,10 +807,8 @@ impl<'a> Parser<'a> {
self.trivia();
for _ in 0..2 {
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
@@ -997,15 +819,12 @@ impl<'a> Parser<'a> {
self.builder.start_node(LABEL_NUMBER.into());
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group();
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1016,24 +835,20 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_command();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_word();
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group();
}
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_impl();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1044,16 +859,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_command();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_impl();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1064,16 +875,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_key_value();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1084,14 +891,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_key_value();
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1102,20 +907,20 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_key_value();
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
}
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group();
}
for _ in 0..2 {
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group();
}
}
@@ -1128,16 +933,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_key_value();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1148,14 +949,12 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_key_value();
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1166,23 +965,19 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_word();
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_word();
}
@@ -1194,10 +989,8 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1208,22 +1001,16 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1234,21 +1021,17 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_word();
}
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word_list();
- } else {
- self.builder.token(MISSING.into(), "");
}
for _ in 0..3 {
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
@@ -1260,10 +1043,8 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word_list();
- } else {
- self.builder.token(MISSING.into(), "");
}
self.builder.finish_node();
@@ -1274,24 +1055,20 @@ impl<'a> Parser<'a> {
self.eat();
self.trivia();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_word();
- } else {
- self.builder.token(MISSING.into(), "");
}
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group_word();
- if self.lexer.peek() == Some(L_BRACK) {
+ if self.lexer.peek() == Some(Token::LBrack) {
self.brack_group();
}
}
for _ in 0..2 {
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.curly_group_without_environments();
- } else {
- self.builder.token(MISSING.into(), "");
}
}
@@ -1304,25 +1081,31 @@ impl<'a> Parser<'a> {
self.trivia();
let checkpoint = self.builder.checkpoint();
- if self.lexer.peek() == Some(L_CURLY) {
+ if self.lexer.peek() == Some(Token::LCurly) {
self.eat();
self.trivia();
if matches!(
self.lexer.peek(),
- Some(WORD | EQUALITY_SIGN | L_BRACK | R_BRACK | GENERIC_COMMAND_NAME)
+ Some(
+ Token::Word
+ | Token::Eq
+ | Token::LBrack
+ | Token::RBrack
+ | Token::CommandName(CommandName::Generic)
+ )
) {
self.builder
.start_node_at(checkpoint, CURLY_GROUP_WORD.into());
self.path();
} else {
self.builder.start_node_at(checkpoint, CURLY_GROUP.into());
- while matches!(self.lexer.peek(), Some(L_CURLY)) {
+ while matches!(self.lexer.peek(), Some(Token::LCurly)) {
self.curly_group_path();
}
}
- self.expect(R_CURLY);
+ self.expect(Token::RCurly);
self.builder.finish_node();
}
diff --git a/support/texlab/src/parser/latex/lexer.rs b/support/texlab/src/parser/latex/lexer.rs
index 9b0a6726eb..ee5b8dd328 100644
--- a/support/texlab/src/parser/latex/lexer.rs
+++ b/support/texlab/src/parser/latex/lexer.rs
@@ -1,641 +1,65 @@
+mod commands;
+pub(super) mod types;
+
use logos::Logos;
use crate::syntax::latex::SyntaxKind;
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, PartialOrd, Ord, Logos)]
-#[repr(u16)]
-enum RootToken {
- #[regex(r"[\r\n]+", priority = 2)]
- LineBreak = 2,
-
- #[regex(r"\s+", priority = 1)]
- Whitespace,
-
- #[regex(r"%[^\r\n]*")]
- LineComment,
-
- #[token("{")]
- LCurly,
-
- #[token("}")]
- RCurly,
-
- #[token("[")]
- LBrack,
-
- #[token("]")]
- RBrack,
-
- #[token("(")]
- LParen,
-
- #[token(")")]
- RParen,
-
- #[token(",")]
- Comma,
-
- #[token("=")]
- Eq,
-
- #[regex(r"[^\s\\%\{\},\$\[\]\(\)=]+")]
- #[error]
- Word,
-
- #[regex(r"\$\$?")]
- Dollar,
-
- #[regex(r"\\([^\r\n]|[@a-zA-Z:_]+\*?)?")]
- CommandName,
-
- #[token("\\iffalse")]
- BeginBlockComment,
-
- #[token("\\begin{asy}")]
- #[token("\\begin{verbatim}")]
- #[token("\\begin{lstlisting}")]
- #[token("\\begin{minted}")]
- #[token("\\begin{pycode}")]
- BeginVerbatimEnvironment,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, PartialOrd, Ord, Logos)]
-enum CommandNameToken {
- #[token("\\begin")]
- BeginEnvironment,
-
- #[token("\\end")]
- EndEnvironment,
-
- #[token("\\[")]
- BeginEquation,
-
- #[token("\\]")]
- EndEquation,
-
- #[token("\\part")]
- #[token("\\part*")]
- Part,
-
- #[token("\\chapter")]
- #[token("\\chapter*")]
- Chapter,
-
- #[token("\\section")]
- #[token("\\section*")]
- Section,
-
- #[token("\\subsection")]
- #[token("\\subsection*")]
- Subsection,
-
- #[token("\\subsubsection")]
- #[token("\\subsubsection*")]
- Subsubsection,
-
- #[token("\\paragraph")]
- #[token("\\paragraph*")]
- Paragraph,
-
- #[token("\\subparagraph")]
- #[token("\\subparagraph*")]
- Subparagraph,
-
- #[token("\\item")]
- EnumItem,
-
- #[token("\\caption")]
- Caption,
-
- #[token("\\cite")]
- #[token("\\cite*")]
- #[token("\\Cite")]
- #[token("\\nocite")]
- #[token("\\citet")]
- #[token("\\citet*")]
- #[token("\\citep")]
- #[token("\\citep*")]
- #[token("\\citeauthor")]
- #[token("\\citeauthor*")]
- #[token("\\Citeauthor")]
- #[token("\\Citeauthor*")]
- #[token("\\citetitle")]
- #[token("\\citetitle*")]
- #[token("\\citeyear")]
- #[token("\\citeyear*")]
- #[token("\\citedate")]
- #[token("\\citedate*")]
- #[token("\\citeurl")]
- #[token("\\fullcite")]
- #[token("\\citeyearpar")]
- #[token("\\citealt")]
- #[token("\\citealp")]
- #[token("\\citetext")]
- #[token("\\parencite")]
- #[token("\\parencite*")]
- #[token("\\Parencite")]
- #[token("\\footcite")]
- #[token("\\footfullcite")]
- #[token("\\footcitetext")]
- #[token("\\textcite")]
- #[token("\\Textcite")]
- #[token("\\smartcite")]
- #[token("\\supercite")]
- #[token("\\autocite")]
- #[token("\\autocite*")]
- #[token("\\Autocite")]
- #[token("\\Autocite*")]
- #[token("\\volcite")]
- #[token("\\Volcite")]
- #[token("\\pvolcite")]
- #[token("\\Pvolcite")]
- #[token("\\fvolcite")]
- #[token("\\ftvolcite")]
- #[token("\\svolcite")]
- #[token("\\Svolcite")]
- #[token("\\tvolcite")]
- #[token("\\Tvolcite")]
- #[token("\\avolcite")]
- #[token("\\Avolcite")]
- #[token("\\notecite")]
- #[token("\\pnotecite")]
- #[token("\\Pnotecite")]
- #[token("\\fnotecite")]
- #[token("\\citeA")]
- #[token("\\citeA*")]
- Citation,
-
- #[token("\\usepackage")]
- #[token("\\RequirePackage")]
- PackageInclude,
-
- #[token("\\documentclass")]
- ClassInclude,
-
- #[token("\\include")]
- #[token("\\subfileinclude")]
- #[token("\\input")]
- #[token("\\subfile")]
- LatexInclude,
-
- #[token("\\addbibresource")]
- BiblatexInclude,
-
- #[token("\\bibliography")]
- BibtexInclude,
-
- #[token("\\includegraphics")]
- GraphicsInclude,
-
- #[token("\\includesvg")]
- SvgInclude,
-
- #[token("\\includeinkscape")]
- InkscapeInclude,
-
- #[token("\\verbatiminput")]
- #[token("\\VerbatimInput")]
- VerbatimInclude,
-
- #[token("\\import")]
- #[token("\\subimport")]
- #[token("\\inputfrom")]
- #[token("\\subinputfrom")]
- #[token("\\includefrom")]
- #[token("\\subincludefrom")]
- Import,
-
- #[token("\\label")]
- LabelDefinition,
-
- #[token("\\ref")]
- #[token("\\vref")]
- #[token("\\Vref")]
- #[token("\\autoref")]
- #[token("\\pageref")]
- #[token("\\cref")]
- #[token("\\cref*")]
- #[token("\\Cref")]
- #[token("\\Cref*")]
- #[token("\\namecref")]
- #[token("\\nameCref")]
- #[token("\\lcnamecref")]
- #[token("\\namecrefs")]
- #[token("\\nameCrefs")]
- #[token("\\lcnamecrefs")]
- #[token("\\labelcref")]
- #[token("\\labelcpageref")]
- #[token("\\eqref")]
- LabelReference,
-
- #[token("\\crefrange")]
- #[token("\\crefrange*")]
- #[token("\\Crefrange")]
- #[token("\\Crefrange*")]
- LabelReferenceRange,
-
- #[token("\\newlabel")]
- LabelNumber,
-
- #[token("\\newcommand")]
- #[token("\\newcommand*")]
- #[token("\\renewcommand")]
- #[token("\\renewcommand*")]
- #[token("\\DeclareRobustCommand")]
- #[token("\\DeclareRobustCommand*")]
- CommandDefinition,
-
- #[token("\\DeclareMathOperator")]
- #[token("\\DeclareMathOperator*")]
- MathOperator,
-
- #[token("\\newglossaryentry")]
- GlossaryEntryDefinition,
-
- #[token("\\gls")]
- #[token("\\Gls")]
- #[token("\\GLS")]
- #[token("\\glspl")]
- #[token("\\Glspl")]
- #[token("\\GLSpl")]
- #[token("\\glsdisp")]
- #[token("\\glslink")]
- #[token("\\glstext")]
- #[token("\\Glstext")]
- #[token("\\GLStext")]
- #[token("\\glsfirst")]
- #[token("\\Glsfirst")]
- #[token("\\GLSfirst")]
- #[token("\\glsplural")]
- #[token("\\Glsplural")]
- #[token("\\GLSplural")]
- #[token("\\glsfirstplural")]
- #[token("\\Glsfirstplural")]
- #[token("\\GLSfirstplural")]
- #[token("\\glsname")]
- #[token("\\Glsname")]
- #[token("\\GLSname")]
- #[token("\\glssymbol")]
- #[token("\\Glssymbol")]
- #[token("\\glsdesc")]
- #[token("\\Glsdesc")]
- #[token("\\GLSdesc")]
- #[token("\\glsuseri")]
- #[token("\\Glsuseri")]
- #[token("\\GLSuseri")]
- #[token("\\glsuserii")]
- #[token("\\Glsuserii")]
- #[token("\\glsuseriii")]
- #[token("\\glsuseriv")]
- #[token("\\Glsuseriv")]
- #[token("\\GLSuseriv")]
- #[token("\\glsuserv")]
- #[token("\\Glsuserv")]
- #[token("\\GLSuserv")]
- #[token("\\glsuservi")]
- #[token("\\Glsuservi")]
- #[token("\\GLSuservi")]
- GlossaryEntryReference,
-
- #[token("\\newacronym")]
- #[token("\\newacro")]
- #[token("\\acrodef")]
- #[token("\\acro")]
- #[token("\\newacroindefinite")]
- #[token("\\acrodefindefinite")]
- #[token("\\acroindefinite")]
- #[token("\\acroplural")]
- #[token("\\newacroplural")]
- #[token("\\acrodefplural")]
- AcronymDefinition,
-
- #[token("\\DeclareAcronym")]
- AcronymDeclaration,
-
- #[token("\\acrshort")]
- #[token("\\Acrshort")]
- #[token("\\ACRshort")]
- #[token("\\acrshortpl")]
- #[token("\\Acrshortpl")]
- #[token("\\ACRshortpl")]
- #[token("\\acrlong")]
- #[token("\\Acrlong")]
- #[token("\\ACRlong")]
- #[token("\\acrlongpl")]
- #[token("\\Acrlongpl")]
- #[token("\\ACRlongpl")]
- #[token("\\acrfull")]
- #[token("\\Acrfull")]
- #[token("\\ACRfull")]
- #[token("\\acrfullpl")]
- #[token("\\Acrfullpl")]
- #[token("\\ACRfullpl")]
- #[token("\\acs")]
- #[token("\\Acs")]
- #[token("\\acsp")]
- #[token("\\Acsp")]
- #[token("\\acl")]
- #[token("\\Acl")]
- #[token("\\aclp")]
- #[token("\\Aclp")]
- #[token("\\acf")]
- #[token("\\Acf")]
- #[token("\\acfi")]
- #[token("\\Acfi")]
- #[token("\\acfp")]
- #[token("\\Acfp")]
- #[token("\\ac")]
- #[token("\\Ac")]
- #[token("\\acp")]
- #[token("\\Acp")]
- #[token("\\acused")]
- #[token("\\acsu")]
- #[token("\\Aclu")]
- #[token("\\iac")]
- #[token("\\Iac")]
- #[token("\\acs*")]
- #[token("\\Acs*")]
- #[token("\\acsp*")]
- #[token("\\Acsp*")]
- #[token("\\acl*")]
- #[token("\\Acl*")]
- #[token("\\aclp*")]
- #[token("\\Aclp*")]
- #[token("\\acf*")]
- #[token("\\Acf*")]
- #[token("\\acfi*")]
- #[token("\\Acfi*")]
- #[token("\\acfp*")]
- #[token("\\Acfp*")]
- #[token("\\ac*")]
- #[token("\\Ac*")]
- #[token("\\acp*")]
- #[token("\\Acp*")]
- #[token("\\acused*")]
- #[token("\\acsu*")]
- #[token("\\Aclu*")]
- #[token("\\iac*")]
- #[token("\\Iac*")]
- #[token("\\glsentrylong")]
- #[token("\\Glsentrylong")]
- #[token("\\glsentrylongpl")]
- #[token("\\Glsentrylongpl")]
- #[token("\\glsentryshort")]
- #[token("\\Glsentryshort")]
- #[token("\\glsentryshortpl")]
- #[token("\\Glsentryshortpl")]
- #[token("\\glsentryfullpl")]
- #[token("\\Glsentryfullpl")]
- AcronymReference,
-
- #[token("\\newtheorem")]
- #[token("\\newtheorem*")]
- #[token("\\declaretheorem")]
- #[token("\\declaretheorem*")]
- TheoremDefinition,
-
- #[token("\\color")]
- #[token("\\colorbox")]
- #[token("\\textcolor")]
- #[token("\\pagecolor")]
- ColorReference,
-
- #[token("\\definecolor")]
- ColorDefinition,
-
- #[token("\\definecolorset")]
- ColorSetDefinition,
-
- #[token("\\usepgflibrary")]
- #[token("\\usetikzlibrary")]
- TikzLibraryImport,
-
- #[token("\\newenvironment")]
- #[token("\\newenvironment*")]
- #[token("\\renewenvironment")]
- #[token("\\renewenvironment*")]
- EnvironmentDefinition,
-
- #[token("\\graphicspath")]
- GraphicsPath,
-
- #[token("\\fi")]
- EndBlockComment,
-
- #[regex(r"\\([^\r\n]|[@a-zA-Z:_]+\*?)?")]
- #[error]
- Generic,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, PartialOrd, Ord, Logos)]
-enum BlockCommentToken {
- #[token("\\fi")]
- End,
-
- #[regex(r"\\([^\r\n]|[@a-zA-Z:_]+\*?)?")]
- #[regex(r"[^\\]+")]
- #[error]
- Verbatim,
-}
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash, PartialOrd, Ord, Logos)]
-enum VerbatimEnvironmentToken {
- #[token("\\end{asy}")]
- #[token("\\end{verbatim}")]
- #[token("\\end{lstlisting}")]
- #[token("\\end{minted}")]
- #[token("\\end{pycode}")]
- End,
-
- #[regex(r"\\([^\r\n]|[@a-zA-Z:_]+\*?)?")]
- #[regex(r"[^\\]+")]
- #[error]
- Verbatim,
-}
+use self::types::{CommandName, Token};
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Lexer<'a> {
- tokens: Vec<(SyntaxKind, &'a str)>,
+ tokens: Vec<(Token, &'a str)>,
}
impl<'a> Lexer<'a> {
pub fn new(input: &'a str) -> Self {
- let mut tokens = Vec::new();
- tokenize(input, &mut tokens);
+ let mut tokens = tokenize(input);
tokens.reverse();
Self { tokens }
}
- pub fn peek(&self) -> Option<SyntaxKind> {
+ pub fn peek(&self) -> Option<Token> {
self.tokens.last().map(|(kind, _)| *kind)
}
pub fn eat(&mut self) -> Option<(SyntaxKind, &'a str)> {
- self.tokens.pop()
- }
-}
-
-fn tokenize<'a>(input: &'a str, tokens: &mut Vec<(SyntaxKind, &'a str)>) {
- let mut lexer = RootToken::lexer(input);
- while let Some(kind) = lexer.next() {
- let text = lexer.slice();
- match kind {
- RootToken::LineBreak => {
- tokens.push((SyntaxKind::LINE_BREAK, text));
- }
- RootToken::Whitespace => {
- tokens.push((SyntaxKind::WHITESPACE, text));
- }
- RootToken::LineComment => {
- tokens.push((SyntaxKind::COMMENT, text));
- }
- RootToken::LCurly => {
- tokens.push((SyntaxKind::L_CURLY, text));
- }
- RootToken::RCurly => {
- tokens.push((SyntaxKind::R_CURLY, text));
- }
- RootToken::LBrack => {
- tokens.push((SyntaxKind::L_BRACK, text));
- }
- RootToken::RBrack => {
- tokens.push((SyntaxKind::R_BRACK, text));
- }
- RootToken::LParen => {
- tokens.push((SyntaxKind::L_PAREN, text));
- }
- RootToken::RParen => {
- tokens.push((SyntaxKind::R_PAREN, text));
- }
- RootToken::Comma => {
- tokens.push((SyntaxKind::COMMA, text));
- }
- RootToken::Eq => {
- tokens.push((SyntaxKind::EQUALITY_SIGN, text));
- }
- RootToken::Word => {
- tokens.push((SyntaxKind::WORD, text));
- }
- RootToken::Dollar => {
- tokens.push((SyntaxKind::DOLLAR, text));
- }
- RootToken::CommandName => {
- let kind = tokenize_command_name(text);
- tokens.push((kind, text));
- }
- RootToken::BeginBlockComment => {
- tokens.push((SyntaxKind::BEGIN_BLOCK_COMMENT_NAME, text));
- let end = lexer.span().end;
- lexer = RootToken::lexer(tokenize_block_comment(&lexer.source()[end..], tokens));
- }
- RootToken::BeginVerbatimEnvironment => {
- tokens.push((SyntaxKind::BEGIN_ENVIRONMENT_NAME, "\\begin"));
- tokens.push((SyntaxKind::L_CURLY, "{"));
- tokens.push((SyntaxKind::WORD, &text["\\begin{".len()..text.len() - 1]));
- tokens.push((SyntaxKind::R_CURLY, "}"));
- let end = lexer.span().end;
- lexer = RootToken::lexer(tokenize_verbatim_environment(
- &lexer.source()[end..],
- tokens,
- ));
- }
- }
- }
-}
-
-fn tokenize_command_name(text: &str) -> SyntaxKind {
- let mut lexer = CommandNameToken::lexer(text);
- match lexer.next().unwrap() {
- CommandNameToken::BeginEnvironment => SyntaxKind::BEGIN_ENVIRONMENT_NAME,
- CommandNameToken::EndEnvironment => SyntaxKind::END_ENVIRONMENT_NAME,
- CommandNameToken::BeginEquation => SyntaxKind::BEGIN_EQUATION_NAME,
- CommandNameToken::EndEquation => SyntaxKind::END_EQUATION_NAME,
- CommandNameToken::Part => SyntaxKind::PART_NAME,
- CommandNameToken::Chapter => SyntaxKind::CHAPTER_NAME,
- CommandNameToken::Section => SyntaxKind::SECTION_NAME,
- CommandNameToken::Subsection => SyntaxKind::SUBSECTION_NAME,
- CommandNameToken::Subsubsection => SyntaxKind::SUBSUBSECTION_NAME,
- CommandNameToken::Paragraph => SyntaxKind::PARAGRAPH_NAME,
- CommandNameToken::Subparagraph => SyntaxKind::SUBPARAGRAPH_NAME,
- CommandNameToken::EnumItem => SyntaxKind::ENUM_ITEM_NAME,
- CommandNameToken::Caption => SyntaxKind::CAPTION_NAME,
- CommandNameToken::Citation => SyntaxKind::CITATION_NAME,
- CommandNameToken::PackageInclude => SyntaxKind::PACKAGE_INCLUDE_NAME,
- CommandNameToken::ClassInclude => SyntaxKind::CLASS_INCLUDE_NAME,
- CommandNameToken::LatexInclude => SyntaxKind::LATEX_INCLUDE_NAME,
- CommandNameToken::BiblatexInclude => SyntaxKind::BIBLATEX_INCLUDE_NAME,
- CommandNameToken::BibtexInclude => SyntaxKind::BIBTEX_INCLUDE_NAME,
- CommandNameToken::GraphicsInclude => SyntaxKind::GRAPHICS_INCLUDE_NAME,
- CommandNameToken::SvgInclude => SyntaxKind::SVG_INCLUDE_NAME,
- CommandNameToken::InkscapeInclude => SyntaxKind::INKSCAPE_INCLUDE_NAME,
- CommandNameToken::VerbatimInclude => SyntaxKind::VERBATIM_INCLUDE_NAME,
- CommandNameToken::Import => SyntaxKind::IMPORT_NAME,
- CommandNameToken::LabelDefinition => SyntaxKind::LABEL_DEFINITION_NAME,
- CommandNameToken::LabelReference => SyntaxKind::LABEL_REFERENCE_NAME,
- CommandNameToken::LabelReferenceRange => SyntaxKind::LABEL_REFERENCE_RANGE_NAME,
- CommandNameToken::LabelNumber => SyntaxKind::LABEL_NUMBER_NAME,
- CommandNameToken::CommandDefinition => SyntaxKind::COMMAND_DEFINITION_NAME,
- CommandNameToken::MathOperator => SyntaxKind::MATH_OPERATOR_NAME,
- CommandNameToken::GlossaryEntryDefinition => SyntaxKind::GLOSSARY_ENTRY_DEFINITION_NAME,
- CommandNameToken::GlossaryEntryReference => SyntaxKind::GLOSSARY_ENTRY_REFERENCE_NAME,
- CommandNameToken::AcronymDefinition => SyntaxKind::ACRONYM_DEFINITION_NAME,
- CommandNameToken::AcronymDeclaration => SyntaxKind::ACRONYM_DECLARATION_NAME,
- CommandNameToken::AcronymReference => SyntaxKind::ACRONYM_REFERENCE_NAME,
- CommandNameToken::TheoremDefinition => SyntaxKind::THEOREM_DEFINITION_NAME,
- CommandNameToken::ColorReference => SyntaxKind::COLOR_REFERENCE_NAME,
- CommandNameToken::ColorDefinition => SyntaxKind::COLOR_DEFINITION_NAME,
- CommandNameToken::ColorSetDefinition => SyntaxKind::COLOR_SET_DEFINITION_NAME,
- CommandNameToken::TikzLibraryImport => SyntaxKind::TIKZ_LIBRARY_IMPORT_NAME,
- CommandNameToken::EnvironmentDefinition => SyntaxKind::ENVIRONMENT_DEFINITION_NAME,
- CommandNameToken::EndBlockComment => SyntaxKind::END_BLOCK_COMMENT_NAME,
- CommandNameToken::GraphicsPath => SyntaxKind::GRAPHICS_PATH_NAME,
- CommandNameToken::Generic => SyntaxKind::GENERIC_COMMAND_NAME,
- }
-}
-
-fn tokenize_block_comment<'a>(input: &'a str, tokens: &mut Vec<(SyntaxKind, &'a str)>) -> &'a str {
- let mut lexer = BlockCommentToken::lexer(input);
- let mut end = 0;
- while let Some(kind) = lexer.next() {
- match kind {
- BlockCommentToken::Verbatim => {
- end = lexer.span().end;
- }
- BlockCommentToken::End => {
- end = lexer.span().start;
- break;
- }
+ let (kind, text) = self.tokens.pop()?;
+ let kind = match kind {
+ Token::LineBreak => SyntaxKind::LINE_BREAK,
+ Token::Whitespace => SyntaxKind::WHITESPACE,
+ Token::LineComment => SyntaxKind::COMMENT,
+ Token::LCurly => SyntaxKind::L_CURLY,
+ Token::RCurly => SyntaxKind::R_CURLY,
+ Token::LBrack => SyntaxKind::L_BRACK,
+ Token::RBrack => SyntaxKind::R_BRACK,
+ Token::LParen => SyntaxKind::L_PAREN,
+ Token::RParen => SyntaxKind::R_PAREN,
+ Token::Comma => SyntaxKind::COMMA,
+ Token::Eq => SyntaxKind::EQUALITY_SIGN,
+ Token::Word => SyntaxKind::WORD,
+ Token::Dollar => SyntaxKind::DOLLAR,
+ Token::CommandName(_) => SyntaxKind::COMMAND_NAME,
};
- }
- if end > 0 {
- tokens.push((SyntaxKind::VERBATIM, &input[..end]));
+ Some((kind, text))
}
-
- &input[end..]
}
-fn tokenize_verbatim_environment<'a>(
- input: &'a str,
- tokens: &mut Vec<(SyntaxKind, &'a str)>,
-) -> &'a str {
- let mut lexer = VerbatimEnvironmentToken::lexer(input);
- let mut end = 0;
- while let Some(kind) = lexer.next() {
- match kind {
- VerbatimEnvironmentToken::Verbatim => {
- end = lexer.span().end;
- }
- VerbatimEnvironmentToken::End => {
- end = lexer.span().start;
- break;
- }
- };
- }
-
- if end > 0 {
- tokens.push((SyntaxKind::VERBATIM, &input[..end]));
- }
-
- &input[end..]
+fn tokenize(input: &str) -> Vec<(Token, &str)> {
+ let mut lexer = Token::lexer(input);
+ std::iter::from_fn(move || {
+ let kind = lexer.next()?;
+ let text = lexer.slice();
+ Some((kind, text))
+ })
+ .map(|(kind, text)| {
+ if kind == Token::CommandName(CommandName::Generic) {
+ let name = commands::classify(&text[1..]);
+ (Token::CommandName(name), text)
+ } else {
+ (kind, text)
+ }
+ })
+ .collect()
}
diff --git a/support/texlab/src/parser/latex/lexer/commands.rs b/support/texlab/src/parser/latex/lexer/commands.rs
new file mode 100644
index 0000000000..ba609f5d7f
--- /dev/null
+++ b/support/texlab/src/parser/latex/lexer/commands.rs
@@ -0,0 +1,93 @@
+use super::types::{CommandName, SectionLevel};
+
+pub fn classify(name: &str) -> CommandName {
+ match name {
+ "begin" => CommandName::BeginEnvironment,
+ "end" => CommandName::EndEnvironment,
+ "[" => CommandName::BeginEquation,
+ "]" => CommandName::EndEquation,
+ "part" | "part*" => CommandName::Section(SectionLevel::Part),
+ "chapter" | "chapter*" => CommandName::Section(SectionLevel::Chapter),
+ "section" | "section*" => CommandName::Section(SectionLevel::Section),
+ "subsection" | "subsection*" => CommandName::Section(SectionLevel::Subsection),
+ "subsubsection" | "subsubsection*" => CommandName::Section(SectionLevel::Subsubsection),
+ "paragraph" | "paragraph*" => CommandName::Section(SectionLevel::Paragraph),
+ "subparagraph" | "subparagraph*" => CommandName::Section(SectionLevel::Subparagraph),
+ "item" => CommandName::EnumItem,
+ "caption" => CommandName::Caption,
+ "cite" | "cite*" | "Cite" | "nocite" | "citet" | "citet*" | "citep" | "citep*"
+ | "citeauthor" | "citeauthor*" | "Citeauthor" | "Citeauthor*" | "citetitle"
+ | "citetitle*" | "citeyear" | "citeyear*" | "citedate" | "citedate*" | "citeurl"
+ | "fullcite" | "citeyearpar" | "citealt" | "citealp" | "citetext" | "parencite"
+ | "parencite*" | "Parencite" | "footcite" | "footfullcite" | "footcitetext"
+ | "textcite" | "Textcite" | "smartcite" | "supercite" | "autocite" | "autocite*"
+ | "Autocite" | "Autocite*" | "volcite" | "Volcite" | "pvolcite" | "Pvolcite"
+ | "fvolcite" | "ftvolcite" | "svolcite" | "Svolcite" | "tvolcite" | "Tvolcite"
+ | "avolcite" | "Avolcite" | "notecite" | "pnotecite" | "Pnotecite" | "fnotecite"
+ | "citeA" | "citeA*" => CommandName::Citation,
+ "usepackage" | "RequirePackage" => CommandName::PackageInclude,
+ "documentclass" => CommandName::ClassInclude,
+ "include" | "subfileinclude" | "input" | "subfile" => CommandName::LatexInclude,
+ "addbibresource" => CommandName::BiblatexInclude,
+ "bibliography" => CommandName::BibtexInclude,
+ "includegraphics" => CommandName::GraphicsInclude,
+ "includesvg" => CommandName::SvgInclude,
+ "includeinkscape" => CommandName::InkscapeInclude,
+ "verbatiminput" | "VerbatimInput" => CommandName::VerbatimInclude,
+ "import" | "subimport" | "inputfrom" | "subinputfrom" | "subincludefrom" => {
+ CommandName::Import
+ }
+ "label" => CommandName::LabelDefinition,
+ "ref" | "vref" | "Vref" | "autoref" | "pageref" | "cref" | "cref*" | "Cref" | "Cref*"
+ | "namecref" | "nameCref" | "lcnamecref" | "namecrefs" | "nameCrefs" | "lcnamecrefs"
+ | "labelcref" | "labelcpageref" | "eqref" => CommandName::LabelReference,
+ "crefrange" | "crefrange*" | "Crefrange" | "Crefrange*" => CommandName::LabelReferenceRange,
+ "newlabel" => CommandName::LabelNumber,
+ "newcommand"
+ | "newcommand*"
+ | "renewcommand"
+ | "renewcommand*"
+ | "DeclareRobustCommand"
+ | "DeclareRobustCommand*" => CommandName::CommandDefinition,
+ "DeclareMathOperator" | "DeclareMathOperator*" => CommandName::MathOperator,
+ "newglossaryentry" => CommandName::GlossaryEntryDefinition,
+ "gls" | "Gls" | "GLS" | "glspl" | "Glspl" | "GLSpl" | "glsdisp" | "glslink" | "glstext"
+ | "Glstext" | "GLStext" | "glsfirst" | "Glsfirst" | "GLSfirst" | "glsplural"
+ | "Glsplural" | "GLSplural" | "glsfirstplural" | "Glsfirstplural" | "GLSfirstplural"
+ | "glsname" | "Glsname" | "GLSname" | "glssymbol" | "Glssymbol" | "glsdesc" | "Glsdesc"
+ | "GLSdesc" | "glsuseri" | "Glsuseri" | "GLSuseri" | "glsuserii" | "Glsuserii"
+ | "glsuseriii" | "glsuseriv" | "Glsuseriv" | "GLSuseriv" | "glsuserv" | "Glsuserv"
+ | "GLSuserv" | "glsuservi" | "Glsuservi" | "GLSuservi" => {
+ CommandName::GlossaryEntryReference
+ }
+ "newacronym" | "newacro" | "acrodef" | "acro" | "newacroindefinite"
+ | "acrodefindefinite" | "acroindefinite" | "acroplural" | "newacroplural"
+ | "acrodefplural" => CommandName::AcronymDefinition,
+ "DeclareAcronym" => CommandName::AcronymDeclaration,
+ "acrshort" | "Acrshort" | "ACRshort" | "acrshortpl" | "Acrshortpl" | "ACRshortpl"
+ | "acrlong" | "Acrlong" | "ACRlong" | "acrlongpl" | "Acrlongpl" | "ACRlongpl"
+ | "acrfull" | "Acrfull" | "ACRfull" | "acrfullpl" | "Acrfullpl" | "ACRfullpl" | "acs"
+ | "Acs" | "acsp" | "Acsp" | "acl" | "Acl" | "aclp" | "Aclp" | "acf" | "Acf" | "acfi"
+ | "Acfi" | "acfp" | "Acfp" | "ac" | "Ac" | "acp" | "Acp" | "acused" | "acsu" | "Aclu"
+ | "iac" | "Iac" | "acs*" | "Acs*" | "acsp*" | "Acsp*" | "acl*" | "Acl*" | "aclp*"
+ | "Aclp*" | "acf*" | "Acf*" | "acfi*" | "Acfi*" | "acfp*" | "Acfp*" | "ac*" | "Ac*"
+ | "acp*" | "Acp*" | "acused*" | "acsu*" | "Aclu*" | "iac*" | "Iac*" | "glsentrylong"
+ | "Glsentrylong" | "glsentrylongpl" | "Glsentrylongpl" | "glsentryshort"
+ | "Glsentryshort" | "glsentryshortpl" | "Glsentryshortpl" | "glsentryfullpl"
+ | "Glsentryfullpl" => CommandName::AcronymReference,
+ "newtheorem" | "newtheorem*" | "declaretheorem" | "declaretheorem*" => {
+ CommandName::TheoremDefinition
+ }
+ "color" | "colorbox" | "textcolor" | "pagecolor" => CommandName::ColorReference,
+ "definecolor" => CommandName::ColorDefinition,
+ "definecolorset" => CommandName::ColorSetDefinition,
+ "usepgflibrary" | "usetikzlibrary" => CommandName::TikzLibraryImport,
+ "newenvironment" | "newenvironment*" | "renewenvironment" | "renewenvironment*" => {
+ CommandName::EnvironmentDefinition
+ }
+ "graphicspath" => CommandName::GraphicsPath,
+ "iffalse" => CommandName::BeginBlockComment,
+ "fi" => CommandName::EndBlockComment,
+ _ => CommandName::Generic,
+ }
+}
diff --git a/support/texlab/src/parser/latex/lexer/types.rs b/support/texlab/src/parser/latex/lexer/types.rs
new file mode 100644
index 0000000000..4355c021c1
--- /dev/null
+++ b/support/texlab/src/parser/latex/lexer/types.rs
@@ -0,0 +1,132 @@
+use logos::Logos;
+
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Logos)]
+pub enum Token {
+ #[regex(r"[\r\n]+", priority = 2)]
+ LineBreak,
+
+ #[regex(r"[^\S\r\n]+", priority = 1)]
+ Whitespace,
+
+ #[regex(r"%[^\r\n]*")]
+ LineComment,
+
+ #[token("{")]
+ LCurly,
+
+ #[token("}")]
+ RCurly,
+
+ #[token("[")]
+ LBrack,
+
+ #[token("]")]
+ RBrack,
+
+ #[token("(")]
+ LParen,
+
+ #[token(")")]
+ RParen,
+
+ #[token(",")]
+ Comma,
+
+ #[token("=")]
+ Eq,
+
+ #[regex(r"[^\s\\%\{\},\$\[\]\(\)=]+")]
+ #[error]
+ Word,
+
+ #[regex(r"\$\$?")]
+ Dollar,
+
+ #[regex(r"\\", lex_command_name)]
+ CommandName(CommandName),
+}
+
+fn lex_command_name(lexer: &mut logos::Lexer<Token>) -> CommandName {
+ let input = &lexer.source()[lexer.span().end..];
+
+ let mut chars = input.chars();
+ let Some(c) = chars.next() else { return CommandName::Generic };
+ lexer.bump(c.len_utf8());
+ if !c.is_alphanumeric() && c != '@' {
+ return CommandName::Generic;
+ }
+
+ while let Some(c) = chars.next() {
+ match c {
+ '*' => {
+ lexer.bump(c.len_utf8());
+ break;
+ }
+ c if c.is_alphanumeric() => {
+ lexer.bump(c.len_utf8());
+ }
+ '@' | ':' | '_' => {
+ lexer.bump(c.len_utf8());
+ }
+ _ => {
+ break;
+ }
+ };
+ }
+
+ CommandName::Generic
+}
+
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
+pub enum CommandName {
+ Generic,
+ BeginEnvironment,
+ EndEnvironment,
+ BeginEquation,
+ EndEquation,
+ Section(SectionLevel),
+ EnumItem,
+ Caption,
+ Citation,
+ PackageInclude,
+ ClassInclude,
+ LatexInclude,
+ BiblatexInclude,
+ BibtexInclude,
+ GraphicsInclude,
+ SvgInclude,
+ InkscapeInclude,
+ VerbatimInclude,
+ Import,
+ LabelDefinition,
+ LabelReference,
+ LabelReferenceRange,
+ LabelNumber,
+ CommandDefinition,
+ MathOperator,
+ GlossaryEntryDefinition,
+ GlossaryEntryReference,
+ AcronymDefinition,
+ AcronymDeclaration,
+ AcronymReference,
+ TheoremDefinition,
+ ColorReference,
+ ColorDefinition,
+ ColorSetDefinition,
+ TikzLibraryImport,
+ EnvironmentDefinition,
+ GraphicsPath,
+ BeginBlockComment,
+ EndBlockComment,
+}
+
+#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
+pub enum SectionLevel {
+ Part,
+ Chapter,
+ Section,
+ Subsection,
+ Subsubsection,
+ Paragraph,
+ Subparagraph,
+}
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap
index 14c73e7da5..1a12800267 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap
@@ -9,17 +9,21 @@ ROOT@0..48
WORD@0..3 "Foo"
LINE_BREAK@3..4 "\n"
BLOCK_COMMENT@4..22
- BEGIN_BLOCK_COMMENT_NAME@4..12 "\\iffalse"
- VERBATIM@12..19 "\nTest1\n"
- END_BLOCK_COMMENT_NAME@19..22 "\\fi"
+ COMMAND_NAME@4..12 "\\iffalse"
+ LINE_BREAK@12..13 "\n"
+ WORD@13..18 "Test1"
+ LINE_BREAK@18..19 "\n"
+ COMMAND_NAME@19..22 "\\fi"
LINE_BREAK@22..23 "\n"
TEXT@23..27
WORD@23..26 "Bar"
LINE_BREAK@26..27 "\n"
BLOCK_COMMENT@27..44
- BEGIN_BLOCK_COMMENT_NAME@27..35 "\\iffalse"
- VERBATIM@35..41 "\n\\fii\n"
- END_BLOCK_COMMENT_NAME@41..44 "\\fi"
+ COMMAND_NAME@27..35 "\\iffalse"
+ LINE_BREAK@35..36 "\n"
+ COMMAND_NAME@36..40 "\\fii"
+ LINE_BREAK@40..41 "\n"
+ COMMAND_NAME@41..44 "\\fi"
LINE_BREAK@44..45 "\n"
TEXT@45..48
WORD@45..48 "Baz"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap
index 33e119c524..8b314f42ad 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/caption/caption_default.txt
ROOT@0..27
PREAMBLE@0..27
CAPTION@0..27
- CAPTION_NAME@0..8 "\\caption"
+ COMMAND_NAME@0..8 "\\caption"
BRACK_GROUP@8..13
L_BRACK@8..9 "["
TEXT@9..12
@@ -18,7 +18,7 @@ ROOT@0..27
WORD@14..17 "Foo"
WHITESPACE@17..18 " "
GENERIC_COMMAND@18..23
- GENERIC_COMMAND_NAME@18..22 "\\Bar"
+ COMMAND_NAME@18..22 "\\Bar"
WHITESPACE@22..23 " "
TEXT@23..26
WORD@23..26 "Baz"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap
index a016dcebed..9bbabd4b56 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/caption/caption_default_error.txt
ROOT@0..26
PREAMBLE@0..26
CAPTION@0..26
- CAPTION_NAME@0..8 "\\caption"
+ COMMAND_NAME@0..8 "\\caption"
BRACK_GROUP@8..13
L_BRACK@8..9 "["
TEXT@9..12
@@ -18,9 +18,8 @@ ROOT@0..26
WORD@14..17 "Foo"
WHITESPACE@17..18 " "
GENERIC_COMMAND@18..23
- GENERIC_COMMAND_NAME@18..22 "\\Bar"
+ COMMAND_NAME@18..22 "\\Bar"
WHITESPACE@22..23 " "
TEXT@23..26
WORD@23..26 "Baz"
- MISSING@26..26 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap
index 9303bd3ebe..4e12380396 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap
@@ -7,21 +7,21 @@ ROOT@0..39
PREAMBLE@0..39
ENVIRONMENT@0..39
BEGIN@0..14
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..14
L_CURLY@6..7 "{"
KEY@7..13
WORD@7..13 "figure"
R_CURLY@13..14 "}"
CAPTION@14..27
- CAPTION_NAME@14..22 "\\caption"
+ COMMAND_NAME@14..22 "\\caption"
CURLY_GROUP@22..27
L_CURLY@22..23 "{"
TEXT@23..26
WORD@23..26 "Foo"
R_CURLY@26..27 "}"
END@27..39
- END_ENVIRONMENT_NAME@27..31 "\\end"
+ COMMAND_NAME@27..31 "\\end"
CURLY_GROUP_WORD@31..39
L_CURLY@31..32 "{"
KEY@32..38
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap
index 6af368cc21..9e0769dd57 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap
@@ -6,14 +6,14 @@ input_file: src/parser/test_data/latex/caption/caption_minimal.txt
ROOT@0..22
PREAMBLE@0..22
CAPTION@0..22
- CAPTION_NAME@0..8 "\\caption"
+ COMMAND_NAME@0..8 "\\caption"
CURLY_GROUP@8..22
L_CURLY@8..9 "{"
TEXT@9..13
WORD@9..12 "Foo"
WHITESPACE@12..13 " "
GENERIC_COMMAND@13..18
- GENERIC_COMMAND_NAME@13..17 "\\Bar"
+ COMMAND_NAME@13..17 "\\Bar"
WHITESPACE@17..18 " "
TEXT@18..21
WORD@18..21 "Baz"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap
index 68fc629613..845f1f3682 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap
@@ -6,16 +6,15 @@ input_file: src/parser/test_data/latex/caption/caption_minimal_error.txt
ROOT@0..21
PREAMBLE@0..21
CAPTION@0..21
- CAPTION_NAME@0..8 "\\caption"
+ COMMAND_NAME@0..8 "\\caption"
CURLY_GROUP@8..21
L_CURLY@8..9 "{"
TEXT@9..13
WORD@9..12 "Foo"
WHITESPACE@12..13 " "
GENERIC_COMMAND@13..18
- GENERIC_COMMAND_NAME@13..17 "\\Bar"
+ COMMAND_NAME@13..17 "\\Bar"
WHITESPACE@17..18 " "
TEXT@18..21
WORD@18..21 "Baz"
- MISSING@21..21 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap
index fbf2b5123e..c075d59f77 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_empty.txt
ROOT@0..7
PREAMBLE@0..7
CITATION@0..7
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
CURLY_GROUP_WORD_LIST@5..7
L_CURLY@5..6 "{"
R_CURLY@6..7 "}"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap
index 72bd618594..1a2993bfeb 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap
@@ -6,10 +6,9 @@ input_file: src/parser/test_data/latex/citation/citation_missing_brace.txt
ROOT@0..9
PREAMBLE@0..9
CITATION@0..9
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
CURLY_GROUP_WORD_LIST@5..9
L_CURLY@5..6 "{"
KEY@6..9
WORD@6..9 "foo"
- MISSING@9..9 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap
index 81716cf8b1..92ad9815e4 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_multiple_keys.txt
ROOT@0..15
PREAMBLE@0..15
CITATION@0..15
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
CURLY_GROUP_WORD_LIST@5..15
L_CURLY@5..6 "{"
KEY@6..9
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap
index f5afdca536..a14278731f 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_prenote.txt
ROOT@0..15
PREAMBLE@0..15
CITATION@0..15
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
BRACK_GROUP@5..10
L_BRACK@5..6 "["
TEXT@6..9
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap
index feecca0435..96c3996286 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_prenote_postnote.txt
ROOT@0..20
PREAMBLE@0..20
CITATION@0..20
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
BRACK_GROUP@5..10
L_BRACK@5..6 "["
TEXT@6..9
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap
index 2a8acd1173..d97fad470c 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_redundant_comma.txt
ROOT@0..12
PREAMBLE@0..12
CITATION@0..12
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
CURLY_GROUP_WORD_LIST@5..12
L_CURLY@5..6 "{"
COMMA@6..7 ","
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap
index faa2e07155..3e2bb4cdf8 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_simple.txt
ROOT@0..10
PREAMBLE@0..10
CITATION@0..10
- CITATION_NAME@0..5 "\\cite"
+ COMMAND_NAME@0..5 "\\cite"
CURLY_GROUP_WORD_LIST@5..10
L_CURLY@5..6 "{"
KEY@6..9
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap
index 3bcd74701c..7ab875d747 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/citation/citation_star.txt
ROOT@0..10
PREAMBLE@0..10
CITATION@0..10
- CITATION_NAME@0..7 "\\nocite"
+ COMMAND_NAME@0..7 "\\nocite"
CURLY_GROUP_WORD_LIST@7..10
L_CURLY@7..8 "{"
KEY@8..9
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap
index 163ea09071..92ec32991d 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/color/color_definition_simple.txt
ROOT@0..33
PREAMBLE@0..33
COLOR_DEFINITION@0..33
- COLOR_DEFINITION_NAME@0..12 "\\definecolor"
+ COMMAND_NAME@0..12 "\\definecolor"
CURLY_GROUP_WORD@12..17
L_CURLY@12..13 "{"
KEY@13..16
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap
index 0c68b5eae0..0033103085 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/color/color_reference_simple.txt
ROOT@0..13
PREAMBLE@0..13
COLOR_REFERENCE@0..13
- COLOR_REFERENCE_NAME@0..6 "\\color"
+ COMMAND_NAME@0..6 "\\color"
CURLY_GROUP_WORD@6..13
L_CURLY@6..7 "{"
KEY@7..12
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap
index 2e3be43ecb..017f8aef82 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/color/color_set_definition_error1.txt
ROOT@0..39
PREAMBLE@0..39
COLOR_SET_DEFINITION@0..39
- COLOR_SET_DEFINITION_NAME@0..15 "\\definecolorset"
+ COMMAND_NAME@0..15 "\\definecolorset"
BRACK_GROUP_WORD@15..19
L_BRACK@15..16 "["
KEY@16..18
@@ -30,5 +30,4 @@ ROOT@0..39
KEY@35..38
WORD@35..38 "bar"
R_CURLY@38..39 "}"
- MISSING@39..39 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap
index ee15174688..984dfcbabb 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/color/color_set_definition_error2.txt
ROOT@0..30
PREAMBLE@0..30
COLOR_SET_DEFINITION@0..30
- COLOR_SET_DEFINITION_NAME@0..15 "\\definecolorset"
+ COMMAND_NAME@0..15 "\\definecolorset"
CURLY_GROUP_WORD_LIST@15..25
L_CURLY@15..16 "{"
KEY@16..19
@@ -20,6 +20,4 @@ ROOT@0..30
KEY@26..29
WORD@26..29 "foo"
R_CURLY@29..30 "}"
- MISSING@30..30 ""
- MISSING@30..30 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap
index 3416786dda..67fc1ed0bb 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/color/color_set_definition_error3.txt
ROOT@0..25
PREAMBLE@0..25
COLOR_SET_DEFINITION@0..25
- COLOR_SET_DEFINITION_NAME@0..15 "\\definecolorset"
+ COMMAND_NAME@0..15 "\\definecolorset"
CURLY_GROUP_WORD_LIST@15..25
L_CURLY@15..16 "{"
KEY@16..19
@@ -15,7 +15,4 @@ ROOT@0..25
KEY@20..24
WORD@20..24 "HTML"
R_CURLY@24..25 "}"
- MISSING@25..25 ""
- MISSING@25..25 ""
- MISSING@25..25 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap
index 5c16d9d7a5..e939ab2230 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap
@@ -6,9 +6,5 @@ input_file: src/parser/test_data/latex/color/color_set_definition_error4.txt
ROOT@0..15
PREAMBLE@0..15
COLOR_SET_DEFINITION@0..15
- COLOR_SET_DEFINITION_NAME@0..15 "\\definecolorset"
- MISSING@15..15 ""
- MISSING@15..15 ""
- MISSING@15..15 ""
- MISSING@15..15 ""
+ COMMAND_NAME@0..15 "\\definecolorset"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap
index a4cff9c7a1..b699543115 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/color/color_set_definition_simple.txt
ROOT@0..44
PREAMBLE@0..44
COLOR_SET_DEFINITION@0..44
- COLOR_SET_DEFINITION_NAME@0..15 "\\definecolorset"
+ COMMAND_NAME@0..15 "\\definecolorset"
BRACK_GROUP_WORD@15..19
L_BRACK@15..16 "["
KEY@16..18
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap
index a10287b262..fac8dcb1e0 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap
@@ -6,10 +6,10 @@ input_file: src/parser/test_data/latex/command_definition/command_definition_no_
ROOT@0..22
PREAMBLE@0..22
COMMAND_DEFINITION@0..22
- COMMAND_DEFINITION_NAME@0..11 "\\newcommand"
+ COMMAND_NAME@0..11 "\\newcommand"
CURLY_GROUP_COMMAND@11..17
L_CURLY@11..12 "{"
- GENERIC_COMMAND_NAME@12..16 "\\foo"
+ COMMAND_NAME@12..16 "\\foo"
R_CURLY@16..17 "}"
CURLY_GROUP@17..22
L_CURLY@17..18 "{"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap
index ae9b54e0c8..0096ebbe60 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap
@@ -6,10 +6,9 @@ input_file: src/parser/test_data/latex/command_definition/command_definition_no_
ROOT@0..17
PREAMBLE@0..17
COMMAND_DEFINITION@0..17
- COMMAND_DEFINITION_NAME@0..11 "\\newcommand"
+ COMMAND_NAME@0..11 "\\newcommand"
CURLY_GROUP_COMMAND@11..17
L_CURLY@11..12 "{"
- GENERIC_COMMAND_NAME@12..16 "\\foo"
+ COMMAND_NAME@12..16 "\\foo"
R_CURLY@16..17 "}"
- MISSING@17..17 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap
index 2e1f2f2956..018824e5e2 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap
@@ -6,10 +6,8 @@ input_file: src/parser/test_data/latex/command_definition/command_definition_no_
ROOT@0..16
PREAMBLE@0..16
COMMAND_DEFINITION@0..16
- COMMAND_DEFINITION_NAME@0..11 "\\newcommand"
+ COMMAND_NAME@0..11 "\\newcommand"
CURLY_GROUP_COMMAND@11..16
L_CURLY@11..12 "{"
- GENERIC_COMMAND_NAME@12..16 "\\foo"
- MISSING@16..16 ""
- MISSING@16..16 ""
+ COMMAND_NAME@12..16 "\\foo"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap
index fe1a3ad6ec..3435088461 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap
@@ -6,10 +6,10 @@ input_file: src/parser/test_data/latex/command_definition/command_definition_opt
ROOT@0..29
PREAMBLE@0..29
COMMAND_DEFINITION@0..29
- COMMAND_DEFINITION_NAME@0..11 "\\newcommand"
+ COMMAND_NAME@0..11 "\\newcommand"
CURLY_GROUP_COMMAND@11..17
L_CURLY@11..12 "{"
- GENERIC_COMMAND_NAME@12..16 "\\foo"
+ COMMAND_NAME@12..16 "\\foo"
R_CURLY@16..17 "}"
BRACK_GROUP_WORD@17..20
L_BRACK@17..18 "["
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap
index 422fdd0d5b..806a0e2081 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap
@@ -6,8 +6,7 @@ input_file: src/parser/test_data/latex/command_definition/command_definition_sim
ROOT@0..23
PREAMBLE@0..23
COMMAND_DEFINITION@0..19
- COMMAND_DEFINITION_NAME@0..11 "\\newcommand"
- MISSING@11..11 ""
+ COMMAND_NAME@0..11 "\\newcommand"
BRACK_GROUP_WORD@11..14
L_BRACK@11..12 "["
KEY@12..13
@@ -16,7 +15,7 @@ ROOT@0..23
CURLY_GROUP@14..19
L_CURLY@14..15 "{"
GENERIC_COMMAND@15..18
- GENERIC_COMMAND_NAME@15..18 "\\id"
+ COMMAND_NAME@15..18 "\\id"
R_CURLY@18..19 "}"
CURLY_GROUP@19..23
L_CURLY@19..20 "{"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap
index 9ee38a1796..2dfccb38dd 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap
@@ -6,15 +6,15 @@ input_file: src/parser/test_data/latex/command_definition/command_definition_wit
ROOT@0..80
PREAMBLE@0..80
COMMAND_DEFINITION@0..80
- COMMAND_DEFINITION_NAME@0..11 "\\newcommand"
+ COMMAND_NAME@0..11 "\\newcommand"
CURLY_GROUP_COMMAND@11..35
L_CURLY@11..12 "{"
- GENERIC_COMMAND_NAME@12..34 "\\CVSubHeadingListStart"
+ COMMAND_NAME@12..34 "\\CVSubHeadingListStart"
R_CURLY@34..35 "}"
CURLY_GROUP@35..80
L_CURLY@35..36 "{"
BEGIN@36..79
- BEGIN_ENVIRONMENT_NAME@36..42 "\\begin"
+ COMMAND_NAME@36..42 "\\begin"
CURLY_GROUP_WORD@42..51
L_CURLY@42..43 "{"
KEY@43..50
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap
index 371d1272c4..4cdcd846b6 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap
@@ -6,10 +6,9 @@ input_file: src/parser/test_data/latex/command_definition/math_operator_no_impl.
ROOT@0..26
PREAMBLE@0..26
MATH_OPERATOR@0..26
- MATH_OPERATOR_NAME@0..20 "\\DeclareMathOperator"
+ COMMAND_NAME@0..20 "\\DeclareMathOperator"
CURLY_GROUP_COMMAND@20..26
L_CURLY@20..21 "{"
- GENERIC_COMMAND_NAME@21..25 "\\foo"
+ COMMAND_NAME@21..25 "\\foo"
R_CURLY@25..26 "}"
- MISSING@26..26 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap
index 004e6918e4..fe6beef40f 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap
@@ -6,10 +6,10 @@ input_file: src/parser/test_data/latex/command_definition/math_operator_simple.t
ROOT@0..31
PREAMBLE@0..31
MATH_OPERATOR@0..31
- MATH_OPERATOR_NAME@0..20 "\\DeclareMathOperator"
+ COMMAND_NAME@0..20 "\\DeclareMathOperator"
CURLY_GROUP_COMMAND@20..26
L_CURLY@20..21 "{"
- GENERIC_COMMAND_NAME@21..25 "\\foo"
+ COMMAND_NAME@21..25 "\\foo"
R_CURLY@25..26 "}"
CURLY_GROUP@26..31
L_CURLY@26..27 "{"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap
index abbc71e6ed..a16c3a2563 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap
@@ -6,16 +6,33 @@ input_file: src/parser/test_data/latex/environment/environment_asymptote.txt
ROOT@0..50
PREAMBLE@0..50
ENVIRONMENT@0..50
- BEGIN@0..11
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
- CURLY_GROUP_WORD@6..11
+ BEGIN@0..16
+ COMMAND_NAME@0..6 "\\begin"
+ CURLY_GROUP_WORD@6..16
L_CURLY@6..7 "{"
KEY@7..10
WORD@7..10 "asy"
R_CURLY@10..11 "}"
- VERBATIM@11..41 "\n printf(\"Hello Wo ..."
+ LINE_BREAK@11..12 "\n"
+ WHITESPACE@12..16 " "
+ TEXT@16..22
+ WORD@16..22 "printf"
+ MIXED_GROUP@22..39
+ L_PAREN@22..23 "("
+ TEXT@23..35
+ WORD@23..29 "\"Hello"
+ WHITESPACE@29..30 " "
+ WORD@30..35 "World"
+ GENERIC_COMMAND@35..37
+ COMMAND_NAME@35..37 "\\n"
+ TEXT@37..38
+ WORD@37..38 "\""
+ R_PAREN@38..39 ")"
+ TEXT@39..41
+ WORD@39..40 ";"
+ LINE_BREAK@40..41 "\n"
END@41..50
- END_ENVIRONMENT_NAME@41..45 "\\end"
+ COMMAND_NAME@41..45 "\\end"
CURLY_GROUP_WORD@45..50
L_CURLY@45..46 "{"
KEY@46..49
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap
index fb45f5d35b..4a99a3b175 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/environment/environment_definition.txt
ROOT@0..47
PREAMBLE@0..47
ENVIRONMENT_DEFINITION@0..47
- ENVIRONMENT_DEFINITION_NAME@0..15 "\\newenvironment"
+ COMMAND_NAME@0..15 "\\newenvironment"
CURLY_GROUP_WORD@15..20
L_CURLY@15..16 "{"
KEY@16..19
@@ -20,7 +20,7 @@ ROOT@0..47
CURLY_GROUP@23..36
L_CURLY@23..24 "{"
GENERIC_COMMAND@24..35
- BEGIN_ENVIRONMENT_NAME@24..30 "\\begin"
+ COMMAND_NAME@24..30 "\\begin"
CURLY_GROUP@30..35
L_CURLY@30..31 "{"
TEXT@31..34
@@ -30,7 +30,7 @@ ROOT@0..47
CURLY_GROUP@36..47
L_CURLY@36..37 "{"
GENERIC_COMMAND@37..46
- END_ENVIRONMENT_NAME@37..41 "\\end"
+ COMMAND_NAME@37..41 "\\end"
CURLY_GROUP@41..46
L_CURLY@41..42 "{"
TEXT@42..45
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap
index 10009e851b..c9304ff387 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/environment/environment_definition_option
ROOT@0..44
PREAMBLE@0..44
ENVIRONMENT_DEFINITION@0..44
- ENVIRONMENT_DEFINITION_NAME@0..15 "\\newenvironment"
+ COMMAND_NAME@0..15 "\\newenvironment"
CURLY_GROUP_WORD@15..20
L_CURLY@15..16 "{"
KEY@16..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap
index e3274ef70e..35b8155fd8 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap
@@ -7,7 +7,7 @@ ROOT@0..43
PREAMBLE@0..43
ENVIRONMENT@0..43
BEGIN@0..12
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..12
L_CURLY@6..7 "{"
KEY@7..10
@@ -16,7 +16,7 @@ ROOT@0..43
WHITESPACE@11..12 " "
ENVIRONMENT@12..34
BEGIN@12..24
- BEGIN_ENVIRONMENT_NAME@12..18 "\\begin"
+ COMMAND_NAME@12..18 "\\begin"
CURLY_GROUP_WORD@18..24
L_CURLY@18..19 "{"
KEY@19..22
@@ -24,7 +24,7 @@ ROOT@0..43
R_CURLY@22..23 "}"
WHITESPACE@23..24 " "
END@24..34
- END_ENVIRONMENT_NAME@24..28 "\\end"
+ COMMAND_NAME@24..28 "\\end"
CURLY_GROUP_WORD@28..34
L_CURLY@28..29 "{"
KEY@29..32
@@ -32,7 +32,7 @@ ROOT@0..43
R_CURLY@32..33 "}"
WHITESPACE@33..34 " "
END@34..43
- END_ENVIRONMENT_NAME@34..38 "\\end"
+ COMMAND_NAME@34..38 "\\end"
CURLY_GROUP_WORD@38..43
L_CURLY@38..39 "{"
KEY@39..42
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap
index 698be0eae7..88f9d3b3fd 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap
@@ -7,16 +7,15 @@ ROOT@0..52
PREAMBLE@0..52
ENVIRONMENT@0..52
BEGIN@0..11
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..11
L_CURLY@6..7 "{"
KEY@7..11
WORD@7..10 "foo"
WHITESPACE@10..11 " "
- MISSING@11..11 ""
ENVIRONMENT@11..44
BEGIN@11..34
- BEGIN_ENVIRONMENT_NAME@11..17 "\\begin"
+ COMMAND_NAME@11..17 "\\begin"
CURLY_GROUP_WORD@17..34
L_CURLY@17..18 "{"
KEY@18..34
@@ -26,9 +25,8 @@ ROOT@0..52
WHITESPACE@27..28 " "
WORD@28..33 "World"
WHITESPACE@33..34 " "
- MISSING@34..34 ""
END@34..44
- END_ENVIRONMENT_NAME@34..38 "\\end"
+ COMMAND_NAME@34..38 "\\end"
CURLY_GROUP_WORD@38..44
L_CURLY@38..39 "{"
KEY@39..42
@@ -36,10 +34,9 @@ ROOT@0..52
R_CURLY@42..43 "}"
WHITESPACE@43..44 " "
END@44..52
- END_ENVIRONMENT_NAME@44..48 "\\end"
+ COMMAND_NAME@44..48 "\\end"
CURLY_GROUP_WORD@48..52
L_CURLY@48..49 "{"
KEY@49..52
WORD@49..52 "bar"
- MISSING@52..52 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap
index db57d39580..996237cd42 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap
@@ -7,7 +7,7 @@ ROOT@0..33
PREAMBLE@0..33
ENVIRONMENT@0..33
BEGIN@0..12
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..12
L_CURLY@6..7 "{"
KEY@7..10
@@ -20,7 +20,7 @@ ROOT@0..33
WORD@18..23 "World"
WHITESPACE@23..24 " "
END@24..33
- END_ENVIRONMENT_NAME@24..28 "\\end"
+ COMMAND_NAME@24..28 "\\end"
CURLY_GROUP_WORD@28..33
L_CURLY@28..29 "{"
KEY@29..32
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap
index 0974c69449..55b92d4afb 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap
@@ -6,12 +6,12 @@ input_file: src/parser/test_data/latex/equation.txt
ROOT@0..13
PREAMBLE@0..13
EQUATION@0..13
- BEGIN_EQUATION_NAME@0..2 "\\["
+ COMMAND_NAME@0..2 "\\["
WHITESPACE@2..3 " "
TEXT@3..11
WORD@3..6 "foo"
WHITESPACE@6..7 " "
WORD@7..10 "bar"
WHITESPACE@10..11 " "
- END_EQUATION_NAME@11..13 "\\]"
+ COMMAND_NAME@11..13 "\\]"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap
index c649fc6a6a..57e520cf38 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap
@@ -7,7 +7,7 @@ ROOT@0..28
PREAMBLE@0..28
ENVIRONMENT@0..28
BEGIN@0..10
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..10
L_CURLY@6..7 "{"
KEY@7..8
@@ -20,10 +20,10 @@ ROOT@0..28
WORD@14..17 "bar"
WHITESPACE@17..18 " "
GENERIC_COMMAND@18..21
- END_EQUATION_NAME@18..20 "\\]"
+ COMMAND_NAME@18..20 "\\]"
WHITESPACE@20..21 " "
END@21..28
- END_ENVIRONMENT_NAME@21..25 "\\end"
+ COMMAND_NAME@21..25 "\\end"
CURLY_GROUP_WORD@25..28
L_CURLY@25..26 "{"
KEY@26..27
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap
index 9fee38a855..0db73ad9aa 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/generic_command_args.txt
ROOT@0..14
PREAMBLE@0..14
GENERIC_COMMAND@0..14
- GENERIC_COMMAND_NAME@0..4 "\\foo"
+ COMMAND_NAME@0..4 "\\foo"
CURLY_GROUP@4..9
L_CURLY@4..5 "{"
TEXT@5..8
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap
index dcd2382d02..1886dedea7 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap
@@ -6,5 +6,5 @@ input_file: src/parser/test_data/latex/generic_command_empty.txt
ROOT@0..4
PREAMBLE@0..4
GENERIC_COMMAND@0..4
- GENERIC_COMMAND_NAME@0..4 "\\foo"
+ COMMAND_NAME@0..4 "\\foo"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap
index d7d88a32ce..6ae6cd50be 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap
@@ -6,5 +6,5 @@ input_file: src/parser/test_data/latex/generic_command_escape.txt
ROOT@0..2
PREAMBLE@0..2
GENERIC_COMMAND@0..2
- GENERIC_COMMAND_NAME@0..2 "\\#"
+ COMMAND_NAME@0..2 "\\#"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap
index c1298e50fc..279817a877 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/acronym_declaration.txt
ROOT@0..64
PREAMBLE@0..64
ACRONYM_DECLARATION@0..64
- ACRONYM_DECLARATION_NAME@0..15 "\\DeclareAcronym"
+ COMMAND_NAME@0..15 "\\DeclareAcronym"
CURLY_GROUP_WORD@15..19
L_CURLY@15..16 "{"
KEY@16..18
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap
index eac9b6e3ba..90388ec5ee 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/acronym_definition_options.txt
ROOT@0..76
PREAMBLE@0..76
ACRONYM_DEFINITION@0..76
- ACRONYM_DEFINITION_NAME@0..11 "\\newacronym"
+ COMMAND_NAME@0..11 "\\newacronym"
BRACK_GROUP_KEY_VALUE@11..43
L_BRACK@11..12 "["
KEY_VALUE_BODY@12..42
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap
index e6bfe2a9d5..eadfed4596 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/acronym_definition_simple.txt
ROOT@0..44
PREAMBLE@0..44
ACRONYM_DEFINITION@0..44
- ACRONYM_DEFINITION_NAME@0..11 "\\newacronym"
+ COMMAND_NAME@0..11 "\\newacronym"
CURLY_GROUP_WORD@11..21
L_CURLY@11..12 "{"
KEY@12..20
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap
index 9babc04165..25c03edbad 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/acronym_package.txt
ROOT@0..35
PREAMBLE@0..35
ACRONYM_DEFINITION@0..35
- ACRONYM_DEFINITION_NAME@0..5 "\\acro"
+ COMMAND_NAME@0..5 "\\acro"
CURLY_GROUP_WORD@5..10
L_CURLY@5..6 "{"
KEY@6..9
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap
index 99a8fbc562..1edbf986f8 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/acronym_reference_options.txt
ROOT@0..32
PREAMBLE@0..32
ACRONYM_REFERENCE@0..32
- ACRONYM_REFERENCE_NAME@0..9 "\\acrshort"
+ COMMAND_NAME@0..9 "\\acrshort"
BRACK_GROUP_KEY_VALUE@9..22
L_BRACK@9..10 "["
KEY_VALUE_BODY@10..21
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap
index 08effadf7e..38e68a3a33 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/acronym_reference_simple.txt
ROOT@0..19
PREAMBLE@0..19
ACRONYM_REFERENCE@0..19
- ACRONYM_REFERENCE_NAME@0..9 "\\acrshort"
+ COMMAND_NAME@0..9 "\\acrshort"
CURLY_GROUP_WORD@9..19
L_CURLY@9..10 "{"
KEY@10..18
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap
index 4ab51a0db3..901d0bf8c2 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/glossary_entry_definition_simple
ROOT@0..39
PREAMBLE@0..39
GLOSSARY_ENTRY_DEFINITION@0..39
- GLOSSARY_ENTRY_DEFINITION_NAME@0..17 "\\newglossaryentry"
+ COMMAND_NAME@0..17 "\\newglossaryentry"
CURLY_GROUP_WORD@17..22
L_CURLY@17..18 "{"
KEY@18..21
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap
index d97e984b77..263f4a7146 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/glossary_entry_reference_options
ROOT@0..25
PREAMBLE@0..25
GLOSSARY_ENTRY_REFERENCE@0..25
- GLOSSARY_ENTRY_REFERENCE_NAME@0..4 "\\gls"
+ COMMAND_NAME@0..4 "\\gls"
BRACK_GROUP_KEY_VALUE@4..20
L_BRACK@4..5 "["
KEY_VALUE_BODY@5..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap
index 8c8fb0c1e2..72713fee9a 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/glossary/glossary_entry_reference_simple.
ROOT@0..9
PREAMBLE@0..9
GLOSSARY_ENTRY_REFERENCE@0..9
- GLOSSARY_ENTRY_REFERENCE_NAME@0..4 "\\gls"
+ COMMAND_NAME@0..4 "\\gls"
CURLY_GROUP_WORD@4..9
L_CURLY@4..5 "{"
KEY@5..8
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap
index 9067d36c7d..392c6f3b6e 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap
@@ -1,12 +1,12 @@
---
source: src/parser/latex.rs
-assertion_line: 1361
expression: root
+input_file: src/parser/test_data/latex/graphics_path.txt
---
ROOT@0..28
PREAMBLE@0..28
GRAPHICS_PATH@0..28
- GRAPHICS_PATH_NAME@0..13 "\\graphicspath"
+ COMMAND_NAME@0..13 "\\graphicspath"
CURLY_GROUP@13..28
L_CURLY@13..14 "{"
CURLY_GROUP_WORD@14..27
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap
index 4092b2e8e9..34d958314d 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap
@@ -1,18 +1,18 @@
---
source: src/parser/latex.rs
-assertion_line: 1348
expression: root
+input_file: src/parser/test_data/latex/graphics_path_command.txt
---
ROOT@0..32
PREAMBLE@0..32
GRAPHICS_PATH@0..32
- GRAPHICS_PATH_NAME@0..13 "\\graphicspath"
+ COMMAND_NAME@0..13 "\\graphicspath"
CURLY_GROUP@13..32
L_CURLY@13..14 "{"
CURLY_GROUP_WORD@14..31
L_CURLY@14..15 "{"
KEY@15..30
- GENERIC_COMMAND_NAME@15..22 "\\subfix"
+ COMMAND_NAME@15..22 "\\subfix"
CURLY_GROUP_WORD@22..30
L_CURLY@22..23 "{"
KEY@23..29
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap
index 0eb034bbb3..88b92c1a3b 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap
@@ -1,12 +1,12 @@
---
source: src/parser/latex.rs
-assertion_line: 1348
expression: root
+input_file: src/parser/test_data/latex/graphics_path_options.txt
---
ROOT@0..33
PREAMBLE@0..33
GRAPHICS_PATH@0..13
- GRAPHICS_PATH_NAME@0..13 "\\graphicspath"
+ COMMAND_NAME@0..13 "\\graphicspath"
MIXED_GROUP@13..18
L_BRACK@13..14 "["
TEXT@14..17
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap
index 68969f9c11..bc3e6e68ef 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap
@@ -11,5 +11,4 @@ ROOT@0..12
WORD@1..6 "hello"
WHITESPACE@6..7 " "
WORD@7..12 "world"
- MISSING@12..12 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap
index eae04433d1..fad46a2c97 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap
@@ -7,7 +7,7 @@ ROOT@0..28
PREAMBLE@0..28
ENVIRONMENT@0..28
BEGIN@0..10
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..10
L_CURLY@6..7 "{"
KEY@7..8
@@ -15,16 +15,15 @@ ROOT@0..28
R_CURLY@8..9 "}"
WHITESPACE@9..10 " "
EQUATION@10..21
- BEGIN_EQUATION_NAME@10..12 "\\["
+ COMMAND_NAME@10..12 "\\["
WHITESPACE@12..13 " "
TEXT@13..21
WORD@13..16 "foo"
WHITESPACE@16..17 " "
WORD@17..20 "bar"
WHITESPACE@20..21 " "
- MISSING@21..21 ""
END@21..28
- END_ENVIRONMENT_NAME@21..25 "\\end"
+ COMMAND_NAME@21..25 "\\end"
CURLY_GROUP_WORD@25..28
L_CURLY@25..26 "{"
KEY@26..27
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap
index a396d2e984..9046238457 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap
@@ -9,7 +9,6 @@ ROOT@0..6
L_CURLY@0..1 "{"
MIXED_GROUP@1..2
L_BRACK@1..2 "["
- MISSING@2..2 ""
R_CURLY@2..3 "}"
CURLY_GROUP@3..6
L_CURLY@3..4 "{"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap
index 82d7e9db45..cb181c7fdb 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap
@@ -9,5 +9,4 @@ ROOT@0..2
R_CURLY@0..1 "}"
CURLY_GROUP@1..2
L_CURLY@1..2 "{"
- MISSING@2..2 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap
index 7dd82d48bc..8e8accd9fc 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap
@@ -9,5 +9,4 @@ ROOT@0..2
R_BRACK@0..1 "]"
MIXED_GROUP@1..2
L_BRACK@1..2 "["
- MISSING@2..2 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap
index 3c45c0c14c..82c14ec404 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap
@@ -11,6 +11,5 @@ ROOT@0..4
R_BRACK@1..2 "]"
MIXED_GROUP@2..3
L_BRACK@2..3 "["
- MISSING@3..3 ""
R_CURLY@3..4 "}"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap
index 897d693fd0..9e0c086956 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/biblatex_include_options.txt
ROOT@0..42
PREAMBLE@0..42
BIBLATEX_INCLUDE@0..42
- BIBLATEX_INCLUDE_NAME@0..15 "\\addbibresource"
+ COMMAND_NAME@0..15 "\\addbibresource"
BRACK_GROUP_KEY_VALUE@15..29
L_BRACK@15..16 "["
KEY_VALUE_BODY@16..28
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap
index a4be9c38cb..80c0afdc78 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/biblatex_include_simple.txt
ROOT@0..28
PREAMBLE@0..28
BIBLATEX_INCLUDE@0..28
- BIBLATEX_INCLUDE_NAME@0..15 "\\addbibresource"
+ COMMAND_NAME@0..15 "\\addbibresource"
CURLY_GROUP_WORD_LIST@15..28
L_CURLY@15..16 "{"
KEY@16..27
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap
index 0a8f9cd3f6..0273ad8d6b 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/bibtex_include_simple.txt
ROOT@0..22
PREAMBLE@0..22
BIBTEX_INCLUDE@0..22
- BIBTEX_INCLUDE_NAME@0..13 "\\bibliography"
+ COMMAND_NAME@0..13 "\\bibliography"
CURLY_GROUP_WORD_LIST@13..22
L_CURLY@13..14 "{"
KEY@14..21
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap
index 37ea745308..68b9f3c94e 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/class_include_empty.txt
ROOT@0..16
PREAMBLE@0..16
CLASS_INCLUDE@0..16
- CLASS_INCLUDE_NAME@0..14 "\\documentclass"
+ COMMAND_NAME@0..14 "\\documentclass"
CURLY_GROUP_WORD_LIST@14..16
L_CURLY@14..15 "{"
R_CURLY@15..16 "}"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap
index ff95f8358f..e501b654c4 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/class_include_options.txt
ROOT@0..44
PREAMBLE@0..44
CLASS_INCLUDE@0..44
- CLASS_INCLUDE_NAME@0..14 "\\documentclass"
+ COMMAND_NAME@0..14 "\\documentclass"
BRACK_GROUP_KEY_VALUE@14..35
L_BRACK@14..15 "["
KEY_VALUE_BODY@15..34
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap
index 670fa2b902..5b4f6114a6 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/class_include_simple.txt
ROOT@0..23
PREAMBLE@0..23
CLASS_INCLUDE@0..23
- CLASS_INCLUDE_NAME@0..14 "\\documentclass"
+ COMMAND_NAME@0..14 "\\documentclass"
CURLY_GROUP_WORD_LIST@14..23
L_CURLY@14..15 "{"
KEY@15..22
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap
index 0332499c66..ea3e96323d 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/graphics_include_command.txt
ROOT@0..52
PREAMBLE@0..52
GRAPHICS_INCLUDE@0..52
- GRAPHICS_INCLUDE_NAME@0..16 "\\includegraphics"
+ COMMAND_NAME@0..16 "\\includegraphics"
BRACK_GROUP_KEY_VALUE@16..37
L_BRACK@16..17 "["
KEY_VALUE_BODY@17..36
@@ -18,14 +18,14 @@ ROOT@0..52
TEXT@23..26
WORD@23..26 "0.5"
GENERIC_COMMAND@26..36
- GENERIC_COMMAND_NAME@26..36 "\\textwidth"
+ COMMAND_NAME@26..36 "\\textwidth"
R_BRACK@36..37 "]"
CURLY_GROUP_WORD_LIST@37..52
L_CURLY@37..38 "{"
KEY@38..51
- GENERIC_COMMAND_NAME@38..42 "\\foo"
+ COMMAND_NAME@38..42 "\\foo"
WORD@42..43 "."
- GENERIC_COMMAND_NAME@43..47 "\\bar"
+ COMMAND_NAME@43..47 "\\bar"
WORD@47..51 ".pdf"
R_CURLY@51..52 "}"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap
index 5259eb5072..3b60d765b8 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/graphics_include_complicated_opti
ROOT@0..39
PREAMBLE@0..39
GRAPHICS_INCLUDE@0..39
- GRAPHICS_INCLUDE_NAME@0..16 "\\includegraphics"
+ COMMAND_NAME@0..16 "\\includegraphics"
BRACK_GROUP_KEY_VALUE@16..37
L_BRACK@16..17 "["
KEY_VALUE_BODY@17..36
@@ -18,7 +18,7 @@ ROOT@0..39
TEXT@23..26
WORD@23..26 "0.5"
GENERIC_COMMAND@26..36
- GENERIC_COMMAND_NAME@26..36 "\\textwidth"
+ COMMAND_NAME@26..36 "\\textwidth"
R_BRACK@36..37 "]"
CURLY_GROUP_WORD_LIST@37..39
L_CURLY@37..38 "{"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap
index 5ed7df9cfc..b0817db126 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/graphics_include_options.txt
ROOT@0..39
PREAMBLE@0..39
GRAPHICS_INCLUDE@0..39
- GRAPHICS_INCLUDE_NAME@0..16 "\\includegraphics"
+ COMMAND_NAME@0..16 "\\includegraphics"
BRACK_GROUP_KEY_VALUE@16..26
L_BRACK@16..17 "["
KEY_VALUE_BODY@17..25
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap
index cabb065d24..ef53c6faa5 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/graphics_include_simple.txt
ROOT@0..29
PREAMBLE@0..29
GRAPHICS_INCLUDE@0..29
- GRAPHICS_INCLUDE_NAME@0..16 "\\includegraphics"
+ COMMAND_NAME@0..16 "\\includegraphics"
CURLY_GROUP_WORD_LIST@16..29
L_CURLY@16..17 "{"
KEY@17..28
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap
index dad78222c2..b4fc1b4244 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap
@@ -6,11 +6,9 @@ input_file: src/parser/test_data/latex/include/import_incomplete.txt
ROOT@0..11
PREAMBLE@0..11
IMPORT@0..11
- IMPORT_NAME@0..7 "\\import"
+ COMMAND_NAME@0..7 "\\import"
CURLY_GROUP_WORD@7..11
L_CURLY@7..8 "{"
KEY@8..11
WORD@8..11 "foo"
- MISSING@11..11 ""
- MISSING@11..11 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap
index 9e4fdeb284..d703c0b994 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/import_simple.txt
ROOT@0..17
PREAMBLE@0..17
IMPORT@0..17
- IMPORT_NAME@0..7 "\\import"
+ COMMAND_NAME@0..7 "\\import"
CURLY_GROUP_WORD@7..12
L_CURLY@7..8 "{"
KEY@8..11
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap
index d0e8321692..4594b959f3 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/inkscape_include_options.txt
ROOT@0..30
PREAMBLE@0..30
SVG_INCLUDE@0..30
- SVG_INCLUDE_NAME@0..11 "\\includesvg"
+ COMMAND_NAME@0..11 "\\includesvg"
BRACK_GROUP_KEY_VALUE@11..21
L_BRACK@11..12 "["
KEY_VALUE_BODY@12..20
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap
index 1d1e68f33c..b74c855e53 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/inkscape_include_simple.txt
ROOT@0..20
PREAMBLE@0..20
SVG_INCLUDE@0..20
- SVG_INCLUDE_NAME@0..11 "\\includesvg"
+ COMMAND_NAME@0..11 "\\includesvg"
CURLY_GROUP_WORD_LIST@11..20
L_CURLY@11..12 "{"
KEY@12..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap
index abf7865a42..f49d0ccea6 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/latex_include_equality_sign.txt
ROOT@0..17
PREAMBLE@0..17
LATEX_INCLUDE@0..17
- LATEX_INCLUDE_NAME@0..8 "\\include"
+ COMMAND_NAME@0..8 "\\include"
CURLY_GROUP_WORD_LIST@8..17
L_CURLY@8..9 "{"
KEY@9..16
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap
index 2315a2ad7c..1b853f4686 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/latex_include_simple.txt
ROOT@0..17
PREAMBLE@0..17
LATEX_INCLUDE@0..17
- LATEX_INCLUDE_NAME@0..8 "\\include"
+ COMMAND_NAME@0..8 "\\include"
CURLY_GROUP_WORD_LIST@8..17
L_CURLY@8..9 "{"
KEY@9..16
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap
index 0ba79f0c41..dee2e19577 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/latex_input_path_brackets.txt
ROOT@0..20
PREAMBLE@0..20
LATEX_INCLUDE@0..20
- LATEX_INCLUDE_NAME@0..6 "\\input"
+ COMMAND_NAME@0..6 "\\input"
CURLY_GROUP_WORD_LIST@6..20
L_CURLY@6..7 "{"
KEY@7..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap
index 36e2ab5aeb..c8746b66e5 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/package_include_empty.txt
ROOT@0..13
PREAMBLE@0..13
PACKAGE_INCLUDE@0..13
- PACKAGE_INCLUDE_NAME@0..11 "\\usepackage"
+ COMMAND_NAME@0..11 "\\usepackage"
CURLY_GROUP_WORD_LIST@11..13
L_CURLY@11..12 "{"
R_CURLY@12..13 "}"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap
index 876f7313d7..e6ca358d8b 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/package_include_multiple.txt
ROOT@0..28
PREAMBLE@0..28
PACKAGE_INCLUDE@0..28
- PACKAGE_INCLUDE_NAME@0..11 "\\usepackage"
+ COMMAND_NAME@0..11 "\\usepackage"
CURLY_GROUP_WORD_LIST@11..28
L_CURLY@11..12 "{"
KEY@12..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap
index 32a624f769..a65948daf8 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/package_include_options.txt
ROOT@0..41
PREAMBLE@0..41
PACKAGE_INCLUDE@0..41
- PACKAGE_INCLUDE_NAME@0..11 "\\usepackage"
+ COMMAND_NAME@0..11 "\\usepackage"
BRACK_GROUP_KEY_VALUE@11..32
L_BRACK@11..12 "["
KEY_VALUE_BODY@12..31
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap
index 014ed983dd..5f91723920 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/package_include_simple.txt
ROOT@0..20
PREAMBLE@0..20
PACKAGE_INCLUDE@0..20
- PACKAGE_INCLUDE_NAME@0..11 "\\usepackage"
+ COMMAND_NAME@0..11 "\\usepackage"
CURLY_GROUP_WORD_LIST@11..20
L_CURLY@11..12 "{"
KEY@12..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap
index 7f5f78415e..f20083a1bc 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/pgf_library_import_simple.txt
ROOT@0..19
PREAMBLE@0..19
TIKZ_LIBRARY_IMPORT@0..19
- TIKZ_LIBRARY_IMPORT_NAME@0..14 "\\usepgflibrary"
+ COMMAND_NAME@0..14 "\\usepgflibrary"
CURLY_GROUP_WORD_LIST@14..19
L_CURLY@14..15 "{"
KEY@15..18
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap
index 2410aeaa5a..412e18691f 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/svg_include_options.txt
ROOT@0..34
PREAMBLE@0..34
SVG_INCLUDE@0..34
- SVG_INCLUDE_NAME@0..11 "\\includesvg"
+ COMMAND_NAME@0..11 "\\includesvg"
BRACK_GROUP_KEY_VALUE@11..21
L_BRACK@11..12 "["
KEY_VALUE_BODY@12..20
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap
index 61dd22f045..da3a9b4a6d 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/svg_include_simple.txt
ROOT@0..24
PREAMBLE@0..24
SVG_INCLUDE@0..24
- SVG_INCLUDE_NAME@0..11 "\\includesvg"
+ COMMAND_NAME@0..11 "\\includesvg"
CURLY_GROUP_WORD_LIST@11..24
L_CURLY@11..12 "{"
KEY@12..23
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap
index c68ff02964..e44115196a 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/tikz_library_import_simple.txt
ROOT@0..20
PREAMBLE@0..20
TIKZ_LIBRARY_IMPORT@0..20
- TIKZ_LIBRARY_IMPORT_NAME@0..15 "\\usetikzlibrary"
+ COMMAND_NAME@0..15 "\\usetikzlibrary"
CURLY_GROUP_WORD_LIST@15..20
L_CURLY@15..16 "{"
KEY@16..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap
index 3c35fddf18..ffdc042047 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/include/verbatim_include_simple.txt
ROOT@0..27
PREAMBLE@0..27
VERBATIM_INCLUDE@0..27
- VERBATIM_INCLUDE_NAME@0..14 "\\verbatiminput"
+ COMMAND_NAME@0..14 "\\verbatiminput"
CURLY_GROUP_WORD_LIST@14..27
L_CURLY@14..15 "{"
KEY@15..26
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap
index c055d183bd..fa5e02f35d 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap
@@ -11,7 +11,7 @@ ROOT@0..19
WORD@1..2 "x"
WHITESPACE@2..3 " "
GENERIC_COMMAND@3..18
- GENERIC_COMMAND_NAME@3..6 "\\in"
+ COMMAND_NAME@3..6 "\\in"
WHITESPACE@6..7 " "
MIXED_GROUP@7..18
L_BRACK@7..8 "["
@@ -20,7 +20,7 @@ ROOT@0..19
COMMA@9..10 ","
WHITESPACE@10..11 " "
GENERIC_COMMAND@11..17
- GENERIC_COMMAND_NAME@11..17 "\\infty"
+ COMMAND_NAME@11..17 "\\infty"
R_PAREN@17..18 ")"
DOLLAR@18..19 "$"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap
index 7084156fce..692cd065a1 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap
@@ -11,7 +11,7 @@ ROOT@0..21
WORD@2..3 "x"
WHITESPACE@3..4 " "
GENERIC_COMMAND@4..19
- GENERIC_COMMAND_NAME@4..7 "\\in"
+ COMMAND_NAME@4..7 "\\in"
WHITESPACE@7..8 " "
MIXED_GROUP@8..19
L_BRACK@8..9 "["
@@ -20,7 +20,7 @@ ROOT@0..21
COMMA@10..11 ","
WHITESPACE@11..12 " "
GENERIC_COMMAND@12..18
- GENERIC_COMMAND_NAME@12..18 "\\infty"
+ COMMAND_NAME@12..18 "\\infty"
R_PAREN@18..19 ")"
DOLLAR@19..21 "$$"
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap
index 8530953285..1d9f6db48b 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/issue_745.txt
ROOT@0..271
PREAMBLE@0..271
CLASS_INCLUDE@0..24
- CLASS_INCLUDE_NAME@0..14 "\\documentclass"
+ COMMAND_NAME@0..14 "\\documentclass"
CURLY_GROUP_WORD_LIST@14..24
L_CURLY@14..15 "{"
KEY@15..22
@@ -14,18 +14,19 @@ ROOT@0..271
R_CURLY@22..23 "}"
LINE_BREAK@23..24 "\n"
PACKAGE_INCLUDE@24..50
- PACKAGE_INCLUDE_NAME@24..35 "\\usepackage"
+ COMMAND_NAME@24..35 "\\usepackage"
CURLY_GROUP_WORD_LIST@35..50
L_CURLY@35..36 "{"
KEY@36..46
WORD@36..46 "tabularray"
R_CURLY@46..47 "}"
- WHITESPACE@47..50 " \n\n"
+ WHITESPACE@47..48 " "
+ LINE_BREAK@48..50 "\n\n"
GENERIC_COMMAND@50..64
- GENERIC_COMMAND_NAME@50..63 "\\ExplSyntaxOn"
+ COMMAND_NAME@50..63 "\\ExplSyntaxOn"
LINE_BREAK@63..64 "\n"
GENERIC_COMMAND@64..223
- GENERIC_COMMAND_NAME@64..87 "\\NewDocumentEnvironment"
+ COMMAND_NAME@64..87 "\\NewDocumentEnvironment"
CURLY_GROUP@87..96
L_CURLY@87..88 "{"
TEXT@88..95
@@ -41,69 +42,79 @@ ROOT@0..271
TEXT@100..101
WORD@100..101 "m"
R_CURLY@101..102 "}"
- WHITESPACE@102..107 "\n "
+ LINE_BREAK@102..103 "\n"
+ WHITESPACE@103..107 " "
CURLY_GROUP@107..200
L_CURLY@107..108 "{"
- WHITESPACE@108..113 "\n "
+ LINE_BREAK@108..109 "\n"
+ WHITESPACE@109..113 " "
GENERIC_COMMAND@113..194
- GENERIC_COMMAND_NAME@113..119 "\\use:x"
- WHITESPACE@119..124 "\n "
+ COMMAND_NAME@113..119 "\\use:x"
+ LINE_BREAK@119..120 "\n"
+ WHITESPACE@120..124 " "
CURLY_GROUP@124..194
L_CURLY@124..125 "{"
- WHITESPACE@125..130 "\n "
+ LINE_BREAK@125..126 "\n"
+ WHITESPACE@126..130 " "
GENERIC_COMMAND@130..141
- GENERIC_COMMAND_NAME@130..140 "\\exp_not:N"
+ COMMAND_NAME@130..140 "\\exp_not:N"
WHITESPACE@140..141 " "
ENVIRONMENT@141..188
BEGIN@141..179
- BEGIN_ENVIRONMENT_NAME@141..147 "\\begin"
+ COMMAND_NAME@141..147 "\\begin"
CURLY_GROUP_WORD@147..158
L_CURLY@147..148 "{"
KEY@148..152
WORD@148..152 "tblr"
R_CURLY@152..153 "}"
- WHITESPACE@153..158 "\n "
+ LINE_BREAK@153..154 "\n"
+ WHITESPACE@154..158 " "
BRACK_GROUP@158..179
L_BRACK@158..159 "["
GENERIC_COMMAND@159..173
- GENERIC_COMMAND_NAME@159..169 "\\exp_not:n"
+ COMMAND_NAME@159..169 "\\exp_not:n"
CURLY_GROUP@169..173
L_CURLY@169..170 "{"
TEXT@170..172
WORD@170..172 "#1"
R_CURLY@172..173 "}"
R_BRACK@173..174 "]"
- WHITESPACE@174..179 "\n "
+ LINE_BREAK@174..175 "\n"
+ WHITESPACE@175..179 " "
CURLY_GROUP@179..188
L_CURLY@179..180 "{"
TEXT@180..182
WORD@180..182 "#2"
R_CURLY@182..183 "}"
- WHITESPACE@183..188 "\n "
- MISSING@188..188 ""
+ LINE_BREAK@183..184 "\n"
+ WHITESPACE@184..188 " "
R_CURLY@188..189 "}"
- WHITESPACE@189..194 "\n "
+ LINE_BREAK@189..190 "\n"
+ WHITESPACE@190..194 " "
R_CURLY@194..195 "}"
- WHITESPACE@195..200 "\n "
+ LINE_BREAK@195..196 "\n"
+ WHITESPACE@196..200 " "
CURLY_GROUP@200..223
L_CURLY@200..201 "{"
- WHITESPACE@201..206 "\n "
+ LINE_BREAK@201..202 "\n"
+ WHITESPACE@202..206 " "
GENERIC_COMMAND@206..221
- END_ENVIRONMENT_NAME@206..210 "\\end"
+ COMMAND_NAME@206..210 "\\end"
CURLY_GROUP@210..221
L_CURLY@210..211 "{"
TEXT@211..215
WORD@211..215 "tblr"
R_CURLY@215..216 "}"
- WHITESPACE@216..221 "\n "
+ LINE_BREAK@216..217 "\n"
+ WHITESPACE@217..221 " "
R_CURLY@221..222 "}"
LINE_BREAK@222..223 "\n"
GENERIC_COMMAND@223..239
- GENERIC_COMMAND_NAME@223..237 "\\ExplSyntaxOff"
+ COMMAND_NAME@223..237 "\\ExplSyntaxOff"
LINE_BREAK@237..239 "\n\n"
ENVIRONMENT@239..271
BEGIN@239..257
- BEGIN_ENVIRONMENT_NAME@239..245 "\\begin"
+ COMMAND_NAME@239..245 "\\begin"
CURLY_GROUP_WORD@245..257
L_CURLY@245..246 "{"
KEY@246..254
@@ -111,7 +122,7 @@ ROOT@0..271
R_CURLY@254..255 "}"
LINE_BREAK@255..257 "\n\n"
END@257..271
- END_ENVIRONMENT_NAME@257..261 "\\end"
+ COMMAND_NAME@257..261 "\\end"
CURLY_GROUP_WORD@261..271
L_CURLY@261..262 "{"
KEY@262..270
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap
index ff20c01008..4756b13c49 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap
@@ -1,12 +1,12 @@
---
source: src/parser/latex.rs
-assertion_line: 1361
expression: root
+input_file: src/parser/test_data/latex/issue_789.txt
---
ROOT@0..19
PREAMBLE@0..19
GRAPHICS_PATH@0..19
- GRAPHICS_PATH_NAME@0..13 "\\graphicspath"
+ COMMAND_NAME@0..13 "\\graphicspath"
CURLY_GROUP_WORD@13..19
L_CURLY@13..14 "{"
KEY@14..18
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap
new file mode 100644
index 0000000000..0069449097
--- /dev/null
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap
@@ -0,0 +1,62 @@
+---
+source: src/parser/latex.rs
+expression: root
+input_file: src/parser/test_data/latex/issue_853.txt
+---
+ROOT@0..135
+ PREAMBLE@0..135
+ CLASS_INCLUDE@0..24
+ COMMAND_NAME@0..14 "\\documentclass"
+ CURLY_GROUP_WORD_LIST@14..24
+ L_CURLY@14..15 "{"
+ KEY@15..22
+ WORD@15..22 "minimal"
+ R_CURLY@22..23 "}"
+ LINE_BREAK@23..24 "\n"
+ ENVIRONMENT@24..135
+ BEGIN@24..41
+ COMMAND_NAME@24..30 "\\begin"
+ CURLY_GROUP_WORD@30..41
+ L_CURLY@30..31 "{"
+ KEY@31..39
+ WORD@31..39 "document"
+ R_CURLY@39..40 "}"
+ LINE_BREAK@40..41 "\n"
+ TEXT@41..75
+ WORD@41..45 "This"
+ WHITESPACE@45..46 " "
+ WORD@46..48 "is"
+ WHITESPACE@48..49 " "
+ WORD@49..51 "an"
+ WHITESPACE@51..52 " "
+ WORD@52..56 "asdf"
+ WHITESPACE@56..57 " "
+ WORD@57..66 "undefined"
+ WHITESPACE@66..67 " "
+ WORD@67..74 "command"
+ LINE_BREAK@74..75 "\n"
+ BLOCK_COMMENT@75..120
+ COMMAND_NAME@75..83 "\\iffalse"
+ LINE_BREAK@83..84 "\n"
+ WHITESPACE@84..86 " "
+ BLOCK_COMMENT@86..97
+ COMMAND_NAME@86..94 "\\iffalse"
+ COMMAND_NAME@94..97 "\\fi"
+ LINE_BREAK@97..98 "\n"
+ WHITESPACE@98..100 " "
+ COMMAND_NAME@100..104 "\\end"
+ L_CURLY@104..105 "{"
+ WORD@105..114 "enumerate"
+ R_CURLY@114..115 "}"
+ WHITESPACE@115..116 " "
+ LINE_BREAK@116..117 "\n"
+ COMMAND_NAME@117..120 "\\fi"
+ LINE_BREAK@120..121 "\n"
+ END@121..135
+ COMMAND_NAME@121..125 "\\end"
+ CURLY_GROUP_WORD@125..135
+ L_CURLY@125..126 "{"
+ KEY@126..134
+ WORD@126..134 "document"
+ R_CURLY@134..135 "}"
+
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap
new file mode 100644
index 0000000000..4ed4c71e59
--- /dev/null
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap
@@ -0,0 +1,33 @@
+---
+source: src/parser/latex.rs
+expression: root
+input_file: src/parser/test_data/latex/issue_857.txt
+---
+ROOT@0..55
+ PREAMBLE@0..55
+ COMMAND_DEFINITION@0..11
+ COMMAND_NAME@0..11 "\\newcommand"
+ GENERIC_COMMAND@11..17
+ COMMAND_NAME@11..14 "\\ö"
+ CURLY_GROUP@14..17
+ L_CURLY@14..15 "{"
+ R_CURLY@15..16 "}"
+ LINE_BREAK@16..17 "\n"
+ COMMAND_DEFINITION@17..38
+ COMMAND_NAME@17..28 "\\newcommand"
+ CURLY_GROUP_COMMAND@28..35
+ L_CURLY@28..29 "{"
+ COMMAND_NAME@29..34 "\\öö"
+ R_CURLY@34..35 "}"
+ CURLY_GROUP@35..38
+ L_CURLY@35..36 "{"
+ R_CURLY@36..37 "}"
+ LINE_BREAK@37..38 "\n"
+ COMMAND_DEFINITION@38..49
+ COMMAND_NAME@38..49 "\\newcommand"
+ GENERIC_COMMAND@49..55
+ COMMAND_NAME@49..53 "\\123"
+ CURLY_GROUP@53..55
+ L_CURLY@53..54 "{"
+ R_CURLY@54..55 "}"
+
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap
index 7f2ff377b8..57c3a3bf3a 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap
@@ -6,13 +6,12 @@ input_file: src/parser/test_data/latex/label/label_definition_line_break.txt
ROOT@0..19
PREAMBLE@0..19
LABEL_DEFINITION@0..13
- LABEL_DEFINITION_NAME@0..6 "\\label"
+ COMMAND_NAME@0..6 "\\label"
CURLY_GROUP_WORD@6..13
L_CURLY@6..7 "{"
KEY@7..13
WORD@7..12 "hello"
LINE_BREAK@12..13 "\n"
- MISSING@13..13 ""
TEXT@13..18
WORD@13..18 "world"
ERROR@18..19
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap
index a2e8b85b55..49c17d26eb 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/label/label_definition_simple.txt
ROOT@0..11
PREAMBLE@0..11
LABEL_DEFINITION@0..11
- LABEL_DEFINITION_NAME@0..6 "\\label"
+ COMMAND_NAME@0..6 "\\label"
CURLY_GROUP_WORD@6..11
L_CURLY@6..7 "{"
KEY@7..10
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap
index 9afdf9e88e..cc5824ea16 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/label/label_number.txt
ROOT@0..21
PREAMBLE@0..21
LABEL_NUMBER@0..21
- LABEL_NUMBER_NAME@0..9 "\\newlabel"
+ COMMAND_NAME@0..9 "\\newlabel"
CURLY_GROUP_WORD@9..14
L_CURLY@9..10 "{"
KEY@10..13
@@ -20,5 +20,4 @@ ROOT@0..21
WORD@16..19 "1.1"
R_CURLY@19..20 "}"
R_CURLY@20..21 "}"
- MISSING@21..21 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap
index 93580e846e..c44c7a2c5c 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/label/label_reference_equation.txt
ROOT@0..11
PREAMBLE@0..11
LABEL_REFERENCE@0..11
- LABEL_REFERENCE_NAME@0..6 "\\eqref"
+ COMMAND_NAME@0..6 "\\eqref"
CURLY_GROUP_WORD_LIST@6..11
L_CURLY@6..7 "{"
KEY@7..10
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap
index 64e2d9af44..c654786a3e 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap
@@ -9,7 +9,7 @@ ROOT@0..47
WORD@0..8 "Equation"
WHITESPACE@8..9 " "
LABEL_REFERENCE@9..24
- LABEL_REFERENCE_NAME@9..15 "\\eqref"
+ COMMAND_NAME@9..15 "\\eqref"
CURLY_GROUP_WORD_LIST@15..24
L_CURLY@15..16 "{"
KEY@16..24
@@ -19,9 +19,8 @@ ROOT@0..47
WHITESPACE@21..22 " "
WORD@22..23 "a"
WHITESPACE@23..24 " "
- MISSING@24..24 ""
GENERIC_COMMAND@24..38
- GENERIC_COMMAND_NAME@24..29 "\\emph"
+ COMMAND_NAME@24..29 "\\emph"
CURLY_GROUP@29..38
L_CURLY@29..30 "{"
TEXT@30..36
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap
index 27d56c6789..556a04766e 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/label/label_reference_multiple.txt
ROOT@0..14
PREAMBLE@0..14
LABEL_REFERENCE@0..14
- LABEL_REFERENCE_NAME@0..4 "\\ref"
+ COMMAND_NAME@0..4 "\\ref"
CURLY_GROUP_WORD_LIST@4..14
L_CURLY@4..5 "{"
KEY@5..8
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap
index ce5e6a49b5..ff82c6f558 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap
@@ -6,12 +6,11 @@ input_file: src/parser/test_data/latex/label/label_reference_range_error.txt
ROOT@0..19
PREAMBLE@0..19
LABEL_REFERENCE_RANGE@0..19
- LABEL_REFERENCE_RANGE_NAME@0..10 "\\crefrange"
+ COMMAND_NAME@0..10 "\\crefrange"
CURLY_GROUP_WORD@10..14
L_CURLY@10..11 "{"
KEY@11..14
WORD@11..14 "foo"
- MISSING@14..14 ""
CURLY_GROUP_WORD@14..19
L_CURLY@14..15 "{"
KEY@15..18
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap
index b682f40ebc..5a8910b8d2 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap
@@ -6,11 +6,10 @@ input_file: src/parser/test_data/latex/label/label_reference_range_incomplete.tx
ROOT@0..15
PREAMBLE@0..15
LABEL_REFERENCE_RANGE@0..15
- LABEL_REFERENCE_RANGE_NAME@0..10 "\\crefrange"
+ COMMAND_NAME@0..10 "\\crefrange"
CURLY_GROUP_WORD@10..15
L_CURLY@10..11 "{"
KEY@11..14
WORD@11..14 "foo"
R_CURLY@14..15 "}"
- MISSING@15..15 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap
index e76708bf43..a03632ff5b 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/label/label_reference_range_simple.txt
ROOT@0..20
PREAMBLE@0..20
LABEL_REFERENCE_RANGE@0..20
- LABEL_REFERENCE_RANGE_NAME@0..10 "\\crefrange"
+ COMMAND_NAME@0..10 "\\crefrange"
CURLY_GROUP_WORD@10..15
L_CURLY@10..11 "{"
KEY@11..14
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap
index 398a6c1682..3734ba74f9 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/label/label_reference_simple.txt
ROOT@0..9
PREAMBLE@0..9
LABEL_REFERENCE@0..9
- LABEL_REFERENCE_NAME@0..4 "\\ref"
+ COMMAND_NAME@0..4 "\\ref"
CURLY_GROUP_WORD_LIST@4..9
L_CURLY@4..5 "{"
KEY@5..8
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap
index 4c6222045c..45bcb12842 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap
@@ -7,7 +7,7 @@ ROOT@0..60
PREAMBLE@0..60
ENVIRONMENT@0..60
BEGIN@0..18
- BEGIN_ENVIRONMENT_NAME@0..6 "\\begin"
+ COMMAND_NAME@0..6 "\\begin"
CURLY_GROUP_WORD@6..18
L_CURLY@6..7 "{"
KEY@7..16
@@ -15,13 +15,13 @@ ROOT@0..60
R_CURLY@16..17 "}"
WHITESPACE@17..18 " "
ENUM_ITEM@18..26
- ENUM_ITEM_NAME@18..23 "\\item"
+ COMMAND_NAME@18..23 "\\item"
WHITESPACE@23..24 " "
TEXT@24..26
WORD@24..25 "1"
WHITESPACE@25..26 " "
ENUM_ITEM@26..37
- ENUM_ITEM_NAME@26..31 "\\item"
+ COMMAND_NAME@26..31 "\\item"
BRACK_GROUP@31..35
L_BRACK@31..32 "["
TEXT@32..33
@@ -32,13 +32,13 @@ ROOT@0..60
WORD@35..36 "2"
WHITESPACE@36..37 " "
ENUM_ITEM@37..45
- ENUM_ITEM_NAME@37..42 "\\item"
+ COMMAND_NAME@37..42 "\\item"
WHITESPACE@42..43 " "
TEXT@43..45
WORD@43..44 "3"
WHITESPACE@44..45 " "
END@45..60
- END_ENVIRONMENT_NAME@45..49 "\\end"
+ COMMAND_NAME@45..49 "\\end"
CURLY_GROUP_WORD@49..60
L_CURLY@49..50 "{"
KEY@50..59
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap
index c5f7aede51..877d7e28d4 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/structure/structure_invalid_nesting.txt
ROOT@0..27
PREAMBLE@0..27
SECTION@0..14
- SECTION_NAME@0..8 "\\section"
+ COMMAND_NAME@0..8 "\\section"
CURLY_GROUP@8..14
L_CURLY@8..9 "{"
TEXT@9..12
@@ -14,7 +14,7 @@ ROOT@0..27
R_CURLY@12..13 "}"
WHITESPACE@13..14 " "
CHAPTER@14..27
- CHAPTER_NAME@14..22 "\\chapter"
+ COMMAND_NAME@14..22 "\\chapter"
CURLY_GROUP@22..27
L_CURLY@22..23 "{"
TEXT@23..26
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap
index 1f93b8c11f..e4a3cddc7b 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap
@@ -6,49 +6,49 @@ input_file: src/parser/test_data/latex/structure/structure_nested.txt
ROOT@0..90
PREAMBLE@0..90
PART@0..90
- PART_NAME@0..5 "\\part"
+ COMMAND_NAME@0..5 "\\part"
CURLY_GROUP@5..8
L_CURLY@5..6 "{"
TEXT@6..7
WORD@6..7 "1"
R_CURLY@7..8 "}"
CHAPTER@8..90
- CHAPTER_NAME@8..16 "\\chapter"
+ COMMAND_NAME@8..16 "\\chapter"
CURLY_GROUP@16..19
L_CURLY@16..17 "{"
TEXT@17..18
WORD@17..18 "2"
R_CURLY@18..19 "}"
SECTION@19..90
- SECTION_NAME@19..27 "\\section"
+ COMMAND_NAME@19..27 "\\section"
CURLY_GROUP@27..30
L_CURLY@27..28 "{"
TEXT@28..29
WORD@28..29 "3"
R_CURLY@29..30 "}"
SUBSECTION@30..90
- SUBSECTION_NAME@30..41 "\\subsection"
+ COMMAND_NAME@30..41 "\\subsection"
CURLY_GROUP@41..44
L_CURLY@41..42 "{"
TEXT@42..43
WORD@42..43 "4"
R_CURLY@43..44 "}"
SUBSUBSECTION@44..90
- SUBSUBSECTION_NAME@44..58 "\\subsubsection"
+ COMMAND_NAME@44..58 "\\subsubsection"
CURLY_GROUP@58..61
L_CURLY@58..59 "{"
TEXT@59..60
WORD@59..60 "5"
R_CURLY@60..61 "}"
PARAGRAPH@61..90
- PARAGRAPH_NAME@61..71 "\\paragraph"
+ COMMAND_NAME@61..71 "\\paragraph"
CURLY_GROUP@71..74
L_CURLY@71..72 "{"
TEXT@72..73
WORD@72..73 "6"
R_CURLY@73..74 "}"
SUBPARAGRAPH@74..90
- SUBPARAGRAPH_NAME@74..87 "\\subparagraph"
+ COMMAND_NAME@74..87 "\\subparagraph"
CURLY_GROUP@87..90
L_CURLY@87..88 "{"
TEXT@88..89
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap
index 03a29cb4bd..4a925e7e44 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/structure/structure_siblings.txt
ROOT@0..35
PREAMBLE@0..35
SECTION@0..18
- SECTION_NAME@0..8 "\\section"
+ COMMAND_NAME@0..8 "\\section"
CURLY_GROUP@8..14
L_CURLY@8..9 "{"
TEXT@9..12
@@ -17,7 +17,7 @@ ROOT@0..35
WORD@14..17 "Foo"
WHITESPACE@17..18 " "
SECTION@18..35
- SECTION_NAME@18..26 "\\section"
+ COMMAND_NAME@18..26 "\\section"
CURLY_GROUP@26..32
L_CURLY@26..27 "{"
TEXT@27..30
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap
index 81b9c92758..6aa441cbba 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_ful
ROOT@0..31
PREAMBLE@0..31
THEOREM_DEFINITION@0..31
- THEOREM_DEFINITION_NAME@0..11 "\\newtheorem"
+ COMMAND_NAME@0..11 "\\newtheorem"
CURLY_GROUP_WORD@11..16
L_CURLY@11..12 "{"
KEY@12..15
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap
index b422a2619f..d205e65183 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_nam
ROOT@0..21
PREAMBLE@0..21
THEOREM_DEFINITION@0..21
- THEOREM_DEFINITION_NAME@0..11 "\\newtheorem"
+ COMMAND_NAME@0..11 "\\newtheorem"
CURLY_GROUP_WORD@11..16
L_CURLY@11..12 "{"
KEY@12..15
@@ -17,5 +17,4 @@ ROOT@0..21
KEY@17..20
WORD@17..20 "bar"
R_BRACK@20..21 "]"
- MISSING@21..21 ""
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap
index 0b1a3f3e48..8d198b3940 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_nam
ROOT@0..21
PREAMBLE@0..21
THEOREM_DEFINITION@0..21
- THEOREM_DEFINITION_NAME@0..11 "\\newtheorem"
+ COMMAND_NAME@0..11 "\\newtheorem"
CURLY_GROUP_WORD@11..16
L_CURLY@11..12 "{"
KEY@12..15
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap
index 1f84c653bd..ffa7d31541 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap
@@ -6,7 +6,7 @@ input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_nam
ROOT@0..26
PREAMBLE@0..26
THEOREM_DEFINITION@0..26
- THEOREM_DEFINITION_NAME@0..11 "\\newtheorem"
+ COMMAND_NAME@0..11 "\\newtheorem"
CURLY_GROUP_WORD@11..16
L_CURLY@11..12 "{"
KEY@12..15
diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap
index 8c85579665..afad760dd2 100644
--- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap
+++ b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap
@@ -6,11 +6,10 @@ input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_onl
ROOT@0..16
PREAMBLE@0..16
THEOREM_DEFINITION@0..16
- THEOREM_DEFINITION_NAME@0..11 "\\newtheorem"
+ COMMAND_NAME@0..11 "\\newtheorem"
CURLY_GROUP_WORD@11..16
L_CURLY@11..12 "{"
KEY@12..15
WORD@12..15 "foo"
R_CURLY@15..16 "}"
- MISSING@16..16 ""
diff --git a/support/texlab/src/parser/test_data/latex/issue_853.txt b/support/texlab/src/parser/test_data/latex/issue_853.txt
new file mode 100644
index 0000000000..312889717c
--- /dev/null
+++ b/support/texlab/src/parser/test_data/latex/issue_853.txt
@@ -0,0 +1,8 @@
+\documentclass{minimal}
+\begin{document}
+This is an asdf undefined command
+\iffalse
+ \iffalse\fi
+ \end{enumerate}
+\fi
+\end{document} \ No newline at end of file
diff --git a/support/texlab/src/parser/test_data/latex/issue_857.txt b/support/texlab/src/parser/test_data/latex/issue_857.txt
new file mode 100644
index 0000000000..0640263c84
--- /dev/null
+++ b/support/texlab/src/parser/test_data/latex/issue_857.txt
@@ -0,0 +1,3 @@
+\newcommand\ö{}
+\newcommand{\öö}{}
+\newcommand\123{} \ No newline at end of file
diff --git a/support/texlab/src/server.rs b/support/texlab/src/server.rs
index 567d912435..bf0ef64261 100644
--- a/support/texlab/src/server.rs
+++ b/support/texlab/src/server.rs
@@ -1,4 +1,5 @@
mod dispatch;
+pub mod options;
mod query;
use std::{
@@ -27,7 +28,8 @@ use crate::{
build::{self, BuildParams, BuildResult, BuildStatus},
completion::{self, builder::CompletionItemData},
definition, folding, formatting, forward_search, highlight, hover, inlay_hint, link,
- reference, rename, symbol, workspace_command,
+ reference, rename, symbol,
+ workspace_command::{change_environment, clean, dep_graph},
},
normalize_uri,
syntax::bibtex,
@@ -35,9 +37,11 @@ use crate::{
self, capabilities::ClientCapabilitiesExt, components::COMPONENT_DATABASE,
line_index_ext::LineIndexExt,
},
- Db, Options, StartupOptions,
+ Config, Db,
};
+use self::options::{Options, StartupOptions};
+
#[derive(Debug)]
enum InternalMessage {
SetDistro(Distro),
@@ -86,6 +90,45 @@ impl Server {
});
}
+ fn run_and_request_with_db<R, S, Q>(&self, id: RequestId, query: Q)
+ where
+ R: Request,
+ S: Serialize,
+ Q: FnOnce(&dyn Db) -> Option<(S, R::Params)> + Send + 'static,
+ {
+ let client = self.client.clone();
+ self.engine.fork(move |db| match query(db) {
+ Some((result, request_params)) => {
+ let response = lsp_server::Response::new_ok(id, result);
+ client.send_response(response).unwrap();
+ client.send_request::<R>(request_params).unwrap();
+ }
+ None => {
+ let response = lsp_server::Response::new_ok(id, Option::<S>::None);
+ client.send_response(response).unwrap();
+ }
+ });
+ }
+
+ fn run_errorable<R, Q>(&self, id: RequestId, query: Q)
+ where
+ R: Serialize,
+ Q: FnOnce() -> Result<R> + Send + 'static,
+ {
+ let client = self.client.clone();
+ self.pool.execute(move || match query() {
+ Ok(result) => {
+ let response = lsp_server::Response::new_ok(id, result);
+ client.send_response(response).unwrap();
+ }
+ Err(why) => {
+ client
+ .send_error(id, ErrorCode::InternalError, why.to_string())
+ .unwrap();
+ }
+ });
+ }
+
fn capabilities(&self) -> ServerCapabilities {
ServerCapabilities {
text_document_sync: Some(TextDocumentSyncCapability::Options(
@@ -131,6 +174,7 @@ impl Server {
commands: vec![
"texlab.cleanAuxiliary".into(),
"texlab.cleanArtifacts".into(),
+ "texlab.changeEnvironment".into(),
],
..Default::default()
}),
@@ -150,10 +194,12 @@ impl Server {
.with_durability(salsa::Durability::HIGH)
.to(params.capabilities);
- workspace
- .set_client_info(db)
+ db::ServerContext::get(db)
+ .set_always_incomplete_completion_list(db)
.with_durability(salsa::Durability::HIGH)
- .to(params.client_info);
+ .to(params
+ .client_info
+ .map_or(false, |client| &client.name == "Visual Studio Code"));
let root_dirs = params
.workspace_folders
@@ -260,7 +306,7 @@ impl Server {
fn publish_diagnostics_with_delay(&mut self) {
let db = self.engine.read();
let sender = self.internal_tx.clone();
- let delay = Workspace::get(db).options(db).diagnostics_delay.0;
+ let delay = db.config().diagnostics.delay;
self.pool.execute(move || {
std::thread::sleep(delay);
sender.send(InternalMessage::Diagnostics).unwrap();
@@ -304,11 +350,10 @@ impl Server {
fn update_options(&mut self, options: Options) {
let db = self.engine.write();
- let workspace = Workspace::get(db);
- workspace
- .set_options(db)
+ db::ServerContext::get(db)
+ .set_config(db)
.with_durability(salsa::Durability::MEDIUM)
- .to(options);
+ .to(Config::from(options));
self.watcher.watch(db);
}
@@ -354,11 +399,7 @@ impl Server {
self.update_workspace();
- if workspace
- .options(self.engine.read())
- .chktex
- .on_open_and_save
- {
+ if self.engine.read().config().diagnostics.chktex.on_open {
self.run_chktex(document);
}
@@ -379,12 +420,11 @@ impl Server {
for change in params.content_changes {
match change.range {
Some(range) => {
- let range = document.contents(db).line_index(db).offset_lsp_range(range);
+ let range = document.line_index(db).offset_lsp_range(range);
document.edit(db, range, &change.text);
}
None => {
document
- .contents(db)
.set_text(db)
.with_durability(salsa::Durability::LOW)
.to(change.text);
@@ -399,7 +439,7 @@ impl Server {
self.update_workspace();
- if workspace.options(self.engine.read()).chktex.on_edit {
+ if self.engine.read().config().diagnostics.chktex.on_edit {
self.run_chktex(document);
}
@@ -412,7 +452,7 @@ impl Server {
let db = self.engine.read();
let workspace = Workspace::get(db);
- if workspace.options(db).build.on_save {
+ if db.config().build.on_save {
self.build_internal(uri.clone(), |_| ())?;
}
@@ -420,7 +460,7 @@ impl Server {
let db = self.engine.read();
if let Some(document) = workspace.lookup_uri(db, &uri) {
- if workspace.options(db).chktex.on_open_and_save {
+ if db.config().diagnostics.chktex.on_save {
self.run_chktex(document);
}
}
@@ -550,7 +590,6 @@ impl Server {
let workspace = Workspace::get(db);
if let Some(document) = workspace.lookup_uri(db, &uri) {
let position = document
- .contents(db)
.line_index(db)
.offset_lsp(params.text_document_position_params.position);
@@ -618,28 +657,34 @@ impl Server {
}
fn execute_command(&mut self, id: RequestId, params: ExecuteCommandParams) -> Result<()> {
- let db = self.engine.read();
- match workspace_command::select(db, &params.command, params.arguments) {
- Ok(command) => {
- let client = self.client.clone();
- self.pool.execute(move || {
- match command.run() {
- Ok(()) => {
- client
- .send_response(lsp_server::Response::new_ok(id, ()))
- .unwrap();
- }
- Err(why) => {
- client
- .send_error(id, ErrorCode::InternalError, why.to_string())
- .unwrap();
- }
- };
+ match params.command.as_str() {
+ "texlab.cleanAuxiliary" => {
+ let db = self.engine.read();
+ let opt = clean::CleanOptions::Auxiliary;
+ let command = clean::CleanCommand::new(db, opt, params.arguments);
+ self.run_errorable(id, || command?.run());
+ }
+ "texlab.cleanArtifacts" => {
+ let db = self.engine.read();
+ let opt = clean::CleanOptions::Auxiliary;
+ let command = clean::CleanCommand::new(db, opt, params.arguments);
+ self.run_errorable(id, || command?.run());
+ }
+ "texlab.changeEnvironment" => {
+ self.run_and_request_with_db::<ApplyWorkspaceEdit, _, _>(id, move |db| {
+ change_environment::change_environment(db, params.arguments)
});
}
- Err(why) => {
+ "texlab.showDependencyGraph" => {
+ self.run_with_db(id, move |db| dep_graph::show_dependency_graph(db).unwrap());
+ }
+ _ => {
self.client
- .send_error(id, ErrorCode::InvalidParams, why.to_string())
+ .send_error(
+ id,
+ ErrorCode::InvalidParams,
+ format!("Unknown workspace command: {}", params.command),
+ )
.unwrap();
}
};
@@ -699,7 +744,7 @@ impl Server {
}
};
- let forward_search_after = Workspace::get(db).options(db).build.forward_search_after;
+ let forward_search_after = db.config().build.forward_search_after;
let sender = self.internal_tx.clone();
self.pool.execute(move || {
diff --git a/support/texlab/src/server/options.rs b/support/texlab/src/server/options.rs
new file mode 100644
index 0000000000..fb7260ebf2
--- /dev/null
+++ b/support/texlab/src/server/options.rs
@@ -0,0 +1,214 @@
+use std::time::Duration;
+
+use regex::Regex;
+use serde::{Deserialize, Serialize};
+
+use crate::{Config, Formatter, SynctexConfig};
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct Options {
+ pub root_directory: Option<String>,
+ pub aux_directory: Option<String>,
+ pub bibtex_formatter: BibtexFormatter,
+ pub latex_formatter: LatexFormatter,
+ pub formatter_line_length: Option<i32>,
+ pub diagnostics: DiagnosticsOptions,
+ pub diagnostics_delay: Option<u64>,
+ pub build: BuildOptions,
+ pub chktex: ChktexOptions,
+ pub symbols: SymbolOptions,
+ pub latexindent: LatexindentOptions,
+ pub forward_search: ForwardSearchOptions,
+ pub experimental: ExperimentalOptions,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum BibtexFormatter {
+ None,
+ Texlab,
+ Latexindent,
+}
+
+impl Default for BibtexFormatter {
+ fn default() -> Self {
+ Self::Texlab
+ }
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum LatexFormatter {
+ None,
+ Texlab,
+ Latexindent,
+}
+
+impl Default for LatexFormatter {
+ fn default() -> Self {
+ Self::Latexindent
+ }
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct LatexindentOptions {
+ pub local: Option<String>,
+ pub modify_line_breaks: bool,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct BuildOptions {
+ pub executable: Option<String>,
+ pub args: Option<Vec<String>>,
+ pub on_save: bool,
+ pub forward_search_after: bool,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct ChktexOptions {
+ pub on_open_and_save: bool,
+ pub on_edit: bool,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct ForwardSearchOptions {
+ pub executable: Option<String>,
+ pub args: Option<Vec<String>>,
+}
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct DiagnosticsOptions {
+ pub allowed_patterns: Vec<RegexPattern>,
+ pub ignored_patterns: Vec<RegexPattern>,
+}
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct SymbolOptions {
+ pub allowed_patterns: Vec<RegexPattern>,
+ pub ignored_patterns: Vec<RegexPattern>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct RegexPattern(#[serde(with = "serde_regex")] pub Regex);
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct ExperimentalOptions {
+ pub math_environments: Vec<String>,
+ pub enum_environments: Vec<String>,
+ pub verbatim_environments: Vec<String>,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(default)]
+pub struct StartupOptions {
+ pub skip_distro: bool,
+}
+
+impl From<Options> for Config {
+ fn from(value: Options) -> Self {
+ let mut config = Config::default();
+ config.root_dir = value.root_directory;
+
+ config.build.program = value.build.executable.unwrap_or(config.build.program);
+ config.build.args = value.build.args.unwrap_or(config.build.args);
+ config.build.on_save = value.build.on_save;
+ config.build.forward_search_after = value.build.forward_search_after;
+ config.build.output_dir = value.aux_directory.unwrap_or_else(|| String::from("."));
+
+ config.diagnostics.allowed_patterns = value
+ .diagnostics
+ .allowed_patterns
+ .into_iter()
+ .map(|pattern| pattern.0)
+ .collect();
+
+ config.diagnostics.ignored_patterns = value
+ .diagnostics
+ .ignored_patterns
+ .into_iter()
+ .map(|pattern| pattern.0)
+ .collect();
+
+ config.diagnostics.delay = value
+ .diagnostics_delay
+ .map_or(config.diagnostics.delay, Duration::from_millis);
+
+ config.diagnostics.chktex.on_open = value.chktex.on_open_and_save;
+ config.diagnostics.chktex.on_save = value.chktex.on_open_and_save;
+ config.diagnostics.chktex.on_edit = value.chktex.on_edit;
+
+ config.formatting.tex_formatter = match value.latex_formatter {
+ LatexFormatter::None => Formatter::Null,
+ LatexFormatter::Texlab => Formatter::Server,
+ LatexFormatter::Latexindent => Formatter::LatexIndent,
+ };
+
+ config.formatting.tex_formatter = match value.bibtex_formatter {
+ BibtexFormatter::None => Formatter::Null,
+ BibtexFormatter::Texlab => Formatter::Server,
+ BibtexFormatter::Latexindent => Formatter::LatexIndent,
+ };
+
+ config.formatting.line_length =
+ value
+ .formatter_line_length
+ .map_or(80, |len| if len < 0 { usize::MAX } else { len as usize });
+
+ config.formatting.latex_indent.local = value.latexindent.local;
+ config.formatting.latex_indent.modify_line_breaks = value.latexindent.modify_line_breaks;
+
+ config.synctex = value
+ .forward_search
+ .executable
+ .zip(value.forward_search.args)
+ .map(|(program, args)| SynctexConfig { program, args });
+
+ config.symbols.allowed_patterns = value
+ .symbols
+ .allowed_patterns
+ .into_iter()
+ .map(|pattern| pattern.0)
+ .collect();
+
+ config.symbols.ignored_patterns = value
+ .symbols
+ .ignored_patterns
+ .into_iter()
+ .map(|pattern| pattern.0)
+ .collect();
+
+ config
+ .syntax
+ .math_environments
+ .extend(value.experimental.math_environments);
+
+ config
+ .syntax
+ .enum_environments
+ .extend(value.experimental.enum_environments);
+
+ config
+ .syntax
+ .verbatim_environments
+ .extend(value.experimental.verbatim_environments);
+
+ config
+ }
+}
diff --git a/support/texlab/src/syntax/latex/cst.rs b/support/texlab/src/syntax/latex/cst.rs
index d7c9ec9bc7..767aa50ecc 100644
--- a/support/texlab/src/syntax/latex/cst.rs
+++ b/support/texlab/src/syntax/latex/cst.rs
@@ -222,7 +222,7 @@ impl CurlyGroupCommand {
self.syntax()
.children_with_tokens()
.filter_map(|node| node.into_token())
- .find(|node| node.kind() == GENERIC_COMMAND_NAME)
+ .find(|node| node.kind() == COMMAND_NAME)
}
}
@@ -312,7 +312,7 @@ impl GenericCommand {
self.syntax()
.children_with_tokens()
.filter_map(|node| node.into_token())
- .find(|node| node.kind() == GENERIC_COMMAND_NAME)
+ .find(|node| node.kind() == COMMAND_NAME)
}
}
diff --git a/support/texlab/src/syntax/latex/kind.rs b/support/texlab/src/syntax/latex/kind.rs
index 81e0ea3588..3eadc90b48 100644
--- a/support/texlab/src/syntax/latex/kind.rs
+++ b/support/texlab/src/syntax/latex/kind.rs
@@ -3,7 +3,6 @@
#[repr(u16)]
pub enum SyntaxKind {
ERROR = 0,
- MISSING,
LINE_BREAK,
WHITESPACE,
@@ -19,51 +18,7 @@ pub enum SyntaxKind {
EQUALITY_SIGN,
WORD,
DOLLAR,
- GENERIC_COMMAND_NAME,
- BEGIN_ENVIRONMENT_NAME,
- END_ENVIRONMENT_NAME,
- BEGIN_EQUATION_NAME,
- END_EQUATION_NAME,
- PART_NAME,
- CHAPTER_NAME,
- SECTION_NAME,
- SUBSECTION_NAME,
- SUBSUBSECTION_NAME,
- PARAGRAPH_NAME,
- SUBPARAGRAPH_NAME,
- ENUM_ITEM_NAME,
- CAPTION_NAME,
- CITATION_NAME,
- PACKAGE_INCLUDE_NAME,
- CLASS_INCLUDE_NAME,
- LATEX_INCLUDE_NAME,
- BIBLATEX_INCLUDE_NAME,
- BIBTEX_INCLUDE_NAME,
- GRAPHICS_INCLUDE_NAME,
- SVG_INCLUDE_NAME,
- INKSCAPE_INCLUDE_NAME,
- VERBATIM_INCLUDE_NAME,
- IMPORT_NAME,
- LABEL_DEFINITION_NAME,
- LABEL_REFERENCE_NAME,
- LABEL_REFERENCE_RANGE_NAME,
- LABEL_NUMBER_NAME,
- COMMAND_DEFINITION_NAME,
- MATH_OPERATOR_NAME,
- GLOSSARY_ENTRY_DEFINITION_NAME,
- GLOSSARY_ENTRY_REFERENCE_NAME,
- ACRONYM_DEFINITION_NAME,
- ACRONYM_DECLARATION_NAME,
- ACRONYM_REFERENCE_NAME,
- THEOREM_DEFINITION_NAME,
- COLOR_REFERENCE_NAME,
- COLOR_DEFINITION_NAME,
- COLOR_SET_DEFINITION_NAME,
- TIKZ_LIBRARY_IMPORT_NAME,
- ENVIRONMENT_DEFINITION_NAME,
- BEGIN_BLOCK_COMMENT_NAME,
- END_BLOCK_COMMENT_NAME,
- GRAPHICS_PATH_NAME,
+ COMMAND_NAME,
PREAMBLE,
TEXT,
@@ -129,56 +84,6 @@ pub enum SyntaxKind {
ROOT,
}
-impl SyntaxKind {
- pub fn is_command_name(&self) -> bool {
- use SyntaxKind::*;
- matches!(
- self,
- GENERIC_COMMAND_NAME
- | BEGIN_ENVIRONMENT_NAME
- | END_ENVIRONMENT_NAME
- | BEGIN_EQUATION_NAME
- | END_EQUATION_NAME
- | PART_NAME
- | CHAPTER_NAME
- | SECTION_NAME
- | SUBSECTION_NAME
- | SUBSUBSECTION_NAME
- | PARAGRAPH_NAME
- | SUBPARAGRAPH_NAME
- | ENUM_ITEM_NAME
- | CAPTION_NAME
- | CITATION_NAME
- | PACKAGE_INCLUDE_NAME
- | CLASS_INCLUDE_NAME
- | LATEX_INCLUDE_NAME
- | BIBLATEX_INCLUDE_NAME
- | BIBTEX_INCLUDE_NAME
- | GRAPHICS_INCLUDE_NAME
- | SVG_INCLUDE_NAME
- | INKSCAPE_INCLUDE_NAME
- | VERBATIM_INCLUDE_NAME
- | IMPORT_NAME
- | LABEL_DEFINITION_NAME
- | LABEL_REFERENCE_NAME
- | LABEL_REFERENCE_RANGE_NAME
- | LABEL_NUMBER_NAME
- | COMMAND_DEFINITION_NAME
- | MATH_OPERATOR_NAME
- | GLOSSARY_ENTRY_DEFINITION_NAME
- | GLOSSARY_ENTRY_REFERENCE_NAME
- | ACRONYM_DEFINITION_NAME
- | ACRONYM_DECLARATION_NAME
- | ACRONYM_REFERENCE_NAME
- | THEOREM_DEFINITION_NAME
- | COLOR_REFERENCE_NAME
- | COLOR_DEFINITION_NAME
- | COLOR_SET_DEFINITION_NAME
- | TIKZ_LIBRARY_IMPORT_NAME
- )
- }
-}
-
impl From<SyntaxKind> for rowan::SyntaxKind {
fn from(kind: SyntaxKind) -> Self {
Self(kind as u16)
diff --git a/support/texlab/src/tests.rs b/support/texlab/src/tests.rs
deleted file mode 100644
index c6afcfc20c..0000000000
--- a/support/texlab/src/tests.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-mod client;
-mod fixture;
-mod issues;
-mod text_document;
-mod workspace;
diff --git a/support/texlab/src/util/chktex.rs b/support/texlab/src/util/chktex.rs
index d87eff5f9c..0774207917 100644
--- a/support/texlab/src/util/chktex.rs
+++ b/support/texlab/src/util/chktex.rs
@@ -42,7 +42,7 @@ impl Command {
log::debug!("Calling ChkTeX from directory: {}", working_dir.display());
- let text = document.contents(db).text(db).clone();
+ let text = document.text(db).clone();
Some(Self { text, working_dir })
}
diff --git a/support/texlab/src/util/cursor.rs b/support/texlab/src/util/cursor.rs
index 63579c433c..d3168155da 100644
--- a/support/texlab/src/util/cursor.rs
+++ b/support/texlab/src/util/cursor.rs
@@ -24,7 +24,7 @@ impl Cursor {
let left = left?;
let right = right?;
- if left.kind().is_command_name() {
+ if left.kind() == latex::COMMAND_NAME {
return Some(Self::Tex(left));
}
@@ -36,7 +36,7 @@ impl Cursor {
return Some(Self::Tex(left));
}
- if right.kind().is_command_name() {
+ if right.kind() == latex::COMMAND_NAME {
return Some(Self::Tex(right));
}
@@ -105,7 +105,7 @@ impl Cursor {
pub fn command_range(&self, offset: TextSize) -> Option<TextRange> {
self.as_tex()
- .filter(|token| token.kind().is_command_name())
+ .filter(|token| token.kind() == latex::COMMAND_NAME)
.filter(|token| token.text_range().start() != offset)
.map(|token| token.text_range())
.map(|range| TextRange::new(range.start() + TextSize::from(1), range.end()))
@@ -135,7 +135,7 @@ impl<'db, T> CursorContext<'db, T> {
pub fn new(db: &'db dyn Db, uri: &Url, position: Position, params: T) -> Option<Self> {
let workspace = Workspace::get(db);
let document = workspace.lookup_uri(db, uri)?;
- let line_index = document.contents(db).line_index(db);
+ let line_index = document.line_index(db);
let offset = line_index.offset_lsp(position);
let cursor = match document.parse(db) {
@@ -251,6 +251,22 @@ impl<'db, T> CursorContext<'db, T> {
Some((name, range))
}
+ pub fn find_environment(&self) -> Option<(latex::Key, latex::Key)> {
+ let token = self.cursor.as_tex()?;
+
+ for env in token
+ .parent_ancestors()
+ .filter_map(latex::Environment::cast)
+ {
+ let beg = env.begin()?.name()?.key()?;
+ let end = env.end()?.name()?.key()?;
+
+ return Some((beg, end));
+ }
+
+ None
+ }
+
pub fn find_curly_group_word(&self) -> Option<(String, TextRange, latex::CurlyGroupWord)> {
let token = self.cursor.as_tex()?;
let key = latex::Key::cast(token.parent()?);
@@ -285,8 +301,7 @@ impl<'db, T> CursorContext<'db, T> {
let range = if group
.syntax()
.last_token()
- .filter(|tok| tok.kind() == latex::MISSING)
- .is_some()
+ .map_or(false, |tok| tok.kind() != latex::R_CURLY)
{
TextRange::new(latex::small_range(&key).start(), token.text_range().end())
} else {
diff --git a/support/texlab/src/util/label.rs b/support/texlab/src/util/label.rs
index 50e2ea21e7..74c72b234a 100644
--- a/support/texlab/src/util/label.rs
+++ b/support/texlab/src/util/label.rs
@@ -10,8 +10,6 @@ use crate::{
use self::LabeledObject::*;
-use super::lang_data::LANGUAGE_DATA;
-
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum LabeledFloatKind {
Figure,
@@ -135,7 +133,7 @@ pub fn render(db: &dyn Db, document: Document, label_def: label::Name) -> Option
render_label_float(parent.clone(), label_num)
.or_else(|| render_label_section(parent.clone(), label_num))
.or_else(|| render_label_enum_item(db, parent.clone(), label_num))
- .or_else(|| render_label_equation(parent.clone(), label_num))
+ .or_else(|| render_label_equation(db, parent.clone(), label_num))
.or_else(|| render_label_theorem(db, document, parent, label_num))
})
}
@@ -214,20 +212,20 @@ fn render_label_enum_item(
})
}
-fn render_label_equation(parent: latex::SyntaxNode, number: Option<Word>) -> Option<RenderedLabel> {
- let environment = latex::Environment::cast(parent)?;
- let environment_name = environment.begin()?.name()?.key()?.to_string();
+fn render_label_equation(
+ db: &dyn Db,
+ parent: latex::SyntaxNode,
+ number: Option<Word>,
+) -> Option<RenderedLabel> {
+ let env = latex::Environment::cast(parent)?;
+ let env_name = env.begin()?.name()?.key()?.to_string();
- if !LANGUAGE_DATA
- .math_environments
- .iter()
- .any(|name| name == &environment_name)
- {
+ if !db.config().syntax.math_environments.contains(&env_name) {
return None;
}
Some(RenderedLabel {
- range: latex::small_range(&environment),
+ range: latex::small_range(&env),
number,
object: LabeledObject::Equation,
})
diff --git a/support/texlab/src/util/lang_data.rs b/support/texlab/src/util/lang_data.rs
index f270c3f65e..734ceb6df2 100644
--- a/support/texlab/src/util/lang_data.rs
+++ b/support/texlab/src/util/lang_data.rs
@@ -36,8 +36,6 @@ pub struct LanguageData {
pub fields: Vec<BibtexFieldDoc>,
pub pgf_libraries: Vec<String>,
pub tikz_libraries: Vec<String>,
- pub math_environments: Vec<String>,
- pub enum_environments: Vec<String>,
}
impl LanguageData {
diff --git a/support/texlab/src/util/regex_filter.rs b/support/texlab/src/util/regex_filter.rs
index f107ea16fe..a33417464e 100644
--- a/support/texlab/src/util/regex_filter.rs
+++ b/support/texlab/src/util/regex_filter.rs
@@ -1,21 +1,17 @@
-use crate::RegexPattern;
+use regex::Regex;
-pub fn filter(
- text: &str,
- allowed_patterns: &[RegexPattern],
- ignored_patterns: &[RegexPattern],
-) -> bool {
+pub fn filter(text: &str, allowed_patterns: &[Regex], ignored_patterns: &[Regex]) -> bool {
if !allowed_patterns.is_empty()
&& !allowed_patterns
.iter()
- .any(|pattern| pattern.0.is_match(text))
+ .any(|pattern| pattern.is_match(text))
{
return false;
}
if ignored_patterns
.iter()
- .any(|pattern| pattern.0.is_match(text))
+ .any(|pattern| pattern.is_match(text))
{
return false;
}
diff --git a/support/texlab/tests/lsp/fixture.rs b/support/texlab/tests/lsp/fixture.rs
index 182c5d40b8..ebebe1f5e6 100644
--- a/support/texlab/tests/lsp/fixture.rs
+++ b/support/texlab/tests/lsp/fixture.rs
@@ -1,5 +1,6 @@
use std::{
path::{Path, PathBuf},
+ sync::Once,
thread::JoinHandle,
};
@@ -117,6 +118,8 @@ impl Document {
}
}
+static LOGGER: Once = Once::new();
+
#[derive(Debug)]
pub struct TestBed {
fixture: Fixture,
@@ -138,6 +141,20 @@ impl Drop for TestBed {
impl TestBed {
pub fn new(fixture: &str) -> Result<Self> {
+ LOGGER.call_once(|| {
+ if option_env!("TEST_LOG") == Some("1") {
+ fern::Dispatch::new()
+ .filter(|metadata| {
+ metadata.target().contains("texlab")
+ || metadata.target().contains("lsp_server")
+ })
+ .level(log::LevelFilter::Trace)
+ .chain(std::io::stderr())
+ .apply()
+ .unwrap()
+ }
+ });
+
let fixture = Fixture::parse(fixture);
let (server_conn, client_conn) = Connection::memory();
diff --git a/support/texlab/tests/lsp/text_document/completion.rs b/support/texlab/tests/lsp/text_document/completion.rs
index 7e0c3c31d4..3c2e7962d4 100644
--- a/support/texlab/tests/lsp/text_document/completion.rs
+++ b/support/texlab/tests/lsp/text_document/completion.rs
@@ -819,3 +819,36 @@ fn test_project_resolution_texlabroot() {
%! .texlabroot"#
));
}
+
+#[test]
+fn issue_857_1() {
+ assert_json_snapshot!(complete(
+ r#"
+%! bug.tex
+\documentclass{article}
+\newcommand{\ö}{foo}
+\newcommand{\öö}{bar}
+\newcommand{\ööabc}{baz}
+\begin{document}
+\ö
+ |
+ ^
+\end{document}
+"#
+ ));
+}
+
+#[test]
+fn issue_864() {
+ assert_json_snapshot!(complete(
+ r#"
+%! bug.tex
+\documentclass{article}
+\def\あいうえお{}
+\begin{document}
+\あ
+ |
+ ^
+\end{document}"#
+ ))
+}
diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap b/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap
new file mode 100644
index 0000000000..2b8f89b48d
--- /dev/null
+++ b/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap
@@ -0,0 +1,21 @@
+---
+source: tests/lsp/text_document/completion.rs
+expression: "complete(r#\"\n%! bug.tex\n\\documentclass{article}\n\\newcommand{\\ö}{foo}\n\\newcommand{\\öö}{bar}\n\\newcommand{\\ööabc}{baz}\n\\begin{document}\n\\ö\n |\n ^\n\\end{document}\n\"#)"
+---
+[
+ {
+ "label": "ö",
+ "detail": "user-defined",
+ "preselect": false
+ },
+ {
+ "label": "öö",
+ "detail": "user-defined",
+ "preselect": false
+ },
+ {
+ "label": "ööabc",
+ "detail": "user-defined",
+ "preselect": false
+ }
+]
diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap b/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap
new file mode 100644
index 0000000000..11adde5924
--- /dev/null
+++ b/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap
@@ -0,0 +1,11 @@
+---
+source: tests/lsp/text_document/completion.rs
+expression: "complete(r#\"\n%! bug.tex\n\\documentclass{article}\n\\def\\あいうえお{}\n\\begin{document}\n\\あ\n |\n ^\n\\end{document}\"#)"
+---
+[
+ {
+ "label": "あいうえお",
+ "detail": "user-defined",
+ "preselect": false
+ }
+]
diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap b/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap
index accf4a875c..b8568fd2fd 100644
--- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap
+++ b/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap
@@ -8,7 +8,7 @@ expression: "find_hints(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepackag
"line": 3,
"character": 27
},
- "label": "Section 1 (Foo)",
+ "label": "Section 1",
"paddingLeft": true
},
{
@@ -16,7 +16,7 @@ expression: "find_hints(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepackag
"line": 4,
"character": 27
},
- "label": "Section 2 (Bar)",
+ "label": "Section 2",
"paddingLeft": true
},
{
@@ -24,7 +24,7 @@ expression: "find_hints(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepackag
"line": 5,
"character": 30
},
- "label": "Subsection 2.1 (Baz)",
+ "label": "Subsection 2.1",
"paddingLeft": true
},
{
@@ -32,7 +32,7 @@ expression: "find_hints(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepackag
"line": 8,
"character": 18
},
- "label": "Figure fig:qux: Qux",
+ "label": "Figure fig:qux",
"paddingLeft": true
}
]
diff --git a/support/texlab/texlab.1 b/support/texlab/texlab.1
index bdfff79498..88d329d360 100644
--- a/support/texlab/texlab.1
+++ b/support/texlab/texlab.1
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
-.TH TEXLAB "1" "February 2023" "texlab 5.3.0" "User Commands"
+.TH TEXLAB "1" "March 2023" "texlab 5.4.0" "User Commands"
.SH NAME
-texlab \- manual page for texlab 5.3.0
+texlab \- manual page for texlab 5.4.0
.SH SYNOPSIS
.B texlab
[\fI\,OPTIONS\/\fR]
diff --git a/support/texlab/texlab.pdf b/support/texlab/texlab.pdf
index 8b172bff34..9cec928f80 100644
--- a/support/texlab/texlab.pdf
+++ b/support/texlab/texlab.pdf
Binary files differ