diff options
author | Norbert Preining <norbert@preining.info> | 2023-04-12 03:01:14 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-04-12 03:01:14 +0000 |
commit | 45c7bac9080d91b53c686e776fc6217d7f139b86 (patch) | |
tree | 9dd0ad4713ddbc97580545398e8a3c84ac52bf49 /support | |
parent | e6c62f5e4d4a4d5ab654dad1652e83a5a4a42891 (diff) |
CTAN sync 202304120301
Diffstat (limited to 'support')
-rw-r--r-- | support/latexindent/LatexIndent/Document.pm | 8 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/FileExtension.pm | 13 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/LogFile.pm | 9 | ||||
-rw-r--r-- | support/latexindent/LatexIndent/Version.pm | 4 | ||||
-rw-r--r-- | support/latexindent/README | 2 | ||||
-rw-r--r-- | support/latexindent/bin/linux/latexindent | bin | 6163996 -> 6164028 bytes | |||
-rw-r--r-- | support/latexindent/bin/macos/latexindent | bin | 6393199 -> 6393230 bytes | |||
-rw-r--r-- | support/latexindent/defaultSettings.yaml | 2 | ||||
-rw-r--r-- | support/latexindent/documentation/latexindent-yaml-schema.json | 2 | ||||
-rw-r--r-- | support/latexindent/documentation/latexindent.pdf | bin | 1243960 -> 1244704 bytes | |||
-rwxr-xr-x | support/latexindent/latexindent.pl | 2 | ||||
-rw-r--r-- | support/texlab/CHANGELOG.md | 7 | ||||
-rw-r--r-- | support/texlab/Cargo.lock | 755 | ||||
-rw-r--r-- | support/texlab/Cargo.toml | 87 | ||||
-rw-r--r-- | support/texlab/benches/bench_main.rs | 25 | ||||
-rw-r--r-- | support/texlab/crates/base-db/Cargo.toml | 25 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/config.rs (renamed from support/texlab/src/config.rs) | 105 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/diagnostics.rs | 25 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/diagnostics/bib.rs | 69 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/diagnostics/log.rs | 68 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/diagnostics/tex.rs | 116 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/document.rs | 196 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/graph.rs | 161 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/lib.rs | 9 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/line_index.rs (renamed from support/texlab/src/util/line_index.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/semantics.rs | 17 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/semantics/auxiliary.rs | 39 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/semantics/tex.rs | 292 | ||||
-rw-r--r-- | support/texlab/crates/base-db/src/workspace.rs | 302 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/Cargo.toml | 26 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/driver.rs (renamed from support/texlab/src/citation/driver.rs) | 5 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/entry.rs (renamed from support/texlab/src/citation/entry.rs) | 58 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/field.rs (renamed from support/texlab/src/citation/field.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/field/author.rs (renamed from support/texlab/src/citation/field/author.rs) | 24 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/field/date.rs (renamed from support/texlab/src/citation/field/date.rs) | 16 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/field/number.rs (renamed from support/texlab/src/citation/field/number.rs) | 20 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/field/text.rs (renamed from support/texlab/src/citation/field/text.rs) | 59 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/lib.rs (renamed from support/texlab/src/citation.rs) | 5 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/output.rs (renamed from support/texlab/src/citation/output.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_aksin_2006.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__article_aksin_2006.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_betram_1996.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__article_betram_1996.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_blom_2021.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__article_blom_2021.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_jain_1999.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__article_jain_1999.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_kastenholz_2006.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__article_kastenholz_2006.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_rivest_1978.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__article_rivest_1978.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_aho_2006.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__book_aho_2006.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_averroes_1998.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__book_averroes_1998.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_knuth_1984.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__book_knuth_1984.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__collection_matuz_1990.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__collection_matuz_1990.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__inproceedings_combi_2004.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__inproceedings_combi_2004.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__inproceedings_erwin_2007.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__inproceedings_erwin_2007.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__mvbook_nietzsche_1988.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__mvbook_nietzsche_1988.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/snapshots/citeproc__tests__patent_almendro_1998.snap (renamed from support/texlab/src/citation/snapshots/texlab__citation__tests__patent_almendro_1998.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/citeproc/src/tests.rs (renamed from support/texlab/src/citation/tests.rs) | 4 | ||||
-rw-r--r-- | support/texlab/crates/distro/Cargo.toml | 14 | ||||
-rw-r--r-- | support/texlab/crates/distro/src/file_name_db.rs (renamed from support/texlab/src/distro/file_name_db.rs) | 2 | ||||
-rw-r--r-- | support/texlab/crates/distro/src/kpsewhich.rs (renamed from support/texlab/src/distro/kpsewhich.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/distro/src/language.rs | 42 | ||||
-rw-r--r-- | support/texlab/crates/distro/src/lib.rs (renamed from support/texlab/src/distro.rs) | 3 | ||||
-rw-r--r-- | support/texlab/crates/distro/src/miktex.rs (renamed from support/texlab/src/distro/miktex.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/distro/src/texlive.rs (renamed from support/texlab/src/distro/texlive.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/Cargo.toml | 20 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/bibtex.rs (renamed from support/texlab/src/parser/bibtex.rs) | 14 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/build_log.rs (renamed from support/texlab/src/parser/build_log.rs) | 3 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex.rs (renamed from support/texlab/src/parser/latex.rs) | 9 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex/lexer.rs (renamed from support/texlab/src/parser/latex/lexer.rs) | 5 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex/lexer/commands.rs (renamed from support/texlab/src/parser/latex/lexer/commands.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/latex/lexer/types.rs (renamed from support/texlab/src/parser/latex/lexer/types.rs) | 1 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/lib.rs (renamed from support/texlab/src/parser.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@comment.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@comment.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@issue_809.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@issue_809.txt.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@preamble.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@preamble.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__aho_2006.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__aho_2006.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__aksin_2006.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__aksin_2006.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__almendro_1998.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__almendro_1998.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__averroes_1998.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__averroes_1998.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__betram_1996.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__betram_1996.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__blom_2021.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__blom_2021.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__combi_2004.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__combi_2004.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__erwin_2007.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__erwin_2007.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__jain_1999.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__jain_1999.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__kastenholz_2006.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__kastenholz_2006.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__knuth_1984.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__knuth_1984.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__matuz_1990.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__matuz_1990.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__nietzsche_1998.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__nietzsche_1998.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__rivest_1978.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__rivest_1978.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@001.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@001.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@002.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@002.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@003.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@004.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@004.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@005.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@006.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@006.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@007.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@007.txt.snap) | 3 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@block_comments.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_default.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_default_error.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_figure.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_minimal.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_minimal_error.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_empty.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_missing_brace.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_prenote.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_star.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_definition_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_reference_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error1.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error2.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error3.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error4.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_asymptote.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_definition.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_nested.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@equation.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@equation_missing_begin.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_args.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_empty.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_escape.txt.snap | 10 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_declaration.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_package.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path_command.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__curly_group_missing_end.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__curly_group_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__equation_missing_end.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__escaped_brackets.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_braces.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_brackets.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@hello_world.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@hello_world.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__biblatex_include_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__biblatex_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__bibtex_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_empty.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_command.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__import_incomplete.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__import_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__inkscape_include_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__inkscape_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_empty.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_multiple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__svg_include_options.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__svg_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__verbatim_include_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@inline.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@inline_double_dollar.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_745.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_789.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_853.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_857.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_874.txt.snap | 28 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_definition_line_break.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_definition_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_number.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_equation.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_incomplete.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_multiple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_error.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_simple.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter.txt.snap | 10 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter_error.txt.snap | 10 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_enum_item.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_nested.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_siblings.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap (renamed from support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/comment.txt (renamed from support/texlab/src/parser/test_data/bibtex/comment.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/issue_809.txt (renamed from support/texlab/src/parser/test_data/bibtex/issue_809.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/preamble.txt (renamed from support/texlab/src/parser/test_data/bibtex/preamble.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/aho_2006.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/aho_2006.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/aksin_2006.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/aksin_2006.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/almendro_1998.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/almendro_1998.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/averroes_1998.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/averroes_1998.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/betram_1996.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/betram_1996.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/blom_2021.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/blom_2021.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/combi_2004.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/combi_2004.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/erwin_2007.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/erwin_2007.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/jain_1999.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/jain_1999.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/kastenholz_2006.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/kastenholz_2006.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/knuth_1984.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/knuth_1984.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/matuz_1990.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/matuz_1990.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/nietzsche_1998.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/nietzsche_1998.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/bibtex/samples/rivest_1978.txt (renamed from support/texlab/src/parser/test_data/bibtex/samples/rivest_1978.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/001.txt (renamed from support/texlab/src/parser/test_data/build_log/001.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/002.txt (renamed from support/texlab/src/parser/test_data/build_log/002.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/003.txt (renamed from support/texlab/src/parser/test_data/build_log/003.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/004.txt (renamed from support/texlab/src/parser/test_data/build_log/004.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/005.txt (renamed from support/texlab/src/parser/test_data/build_log/005.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/006.txt (renamed from support/texlab/src/parser/test_data/build_log/006.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/build_log/007.txt (renamed from support/texlab/src/parser/test_data/build_log/007.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/block_comments.txt (renamed from support/texlab/src/parser/test_data/latex/block_comments.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/caption/caption_default.txt (renamed from support/texlab/src/parser/test_data/latex/caption/caption_default.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/caption/caption_default_error.txt (renamed from support/texlab/src/parser/test_data/latex/caption/caption_default_error.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/caption/caption_figure.txt (renamed from support/texlab/src/parser/test_data/latex/caption/caption_figure.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/caption/caption_minimal.txt (renamed from support/texlab/src/parser/test_data/latex/caption/caption_minimal.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/caption/caption_minimal_error.txt (renamed from support/texlab/src/parser/test_data/latex/caption/caption_minimal_error.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_empty.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_empty.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_missing_brace.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_missing_brace.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_multiple_keys.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_multiple_keys.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_prenote.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_prenote.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_prenote_postnote.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_prenote_postnote.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_redundant_comma.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_redundant_comma.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_simple.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/citation/citation_star.txt (renamed from support/texlab/src/parser/test_data/latex/citation/citation_star.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_definition_simple.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_definition_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_reference_simple.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_reference_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error1.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_set_definition_error1.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error2.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_set_definition_error2.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error3.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_set_definition_error3.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error4.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_set_definition_error4.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_simple.txt (renamed from support/texlab/src/parser/test_data/latex/color/color_set_definition_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_argc.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_argc.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_impl.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_impl.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_impl_error.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_impl_error.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_optional.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/command_definition_optional.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_simple.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/command_definition_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_with_begin.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/command_definition_with_begin.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/math_operator_no_impl.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/math_operator_no_impl.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/command_definition/math_operator_simple.txt (renamed from support/texlab/src/parser/test_data/latex/command_definition/math_operator_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/environment/environment_asymptote.txt (renamed from support/texlab/src/parser/test_data/latex/environment/environment_asymptote.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/environment/environment_definition.txt (renamed from support/texlab/src/parser/test_data/latex/environment/environment_definition.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/environment/environment_definition_optional_arg.txt (renamed from support/texlab/src/parser/test_data/latex/environment/environment_definition_optional_arg.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/environment/environment_nested.txt (renamed from support/texlab/src/parser/test_data/latex/environment/environment_nested.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/environment/environment_nested_missing_braces.txt (renamed from support/texlab/src/parser/test_data/latex/environment/environment_nested_missing_braces.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/environment/environment_simple.txt (renamed from support/texlab/src/parser/test_data/latex/environment/environment_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/equation.txt (renamed from support/texlab/src/parser/test_data/latex/equation.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/equation_missing_begin.txt (renamed from support/texlab/src/parser/test_data/latex/equation_missing_begin.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/generic_command_args.txt (renamed from support/texlab/src/parser/test_data/latex/generic_command_args.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/generic_command_empty.txt (renamed from support/texlab/src/parser/test_data/latex/generic_command_empty.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/generic_command_escape.txt (renamed from support/texlab/src/parser/test_data/latex/generic_command_escape.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/acronym_declaration.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/acronym_declaration.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/acronym_definition_options.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/acronym_definition_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/acronym_definition_simple.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/acronym_definition_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/acronym_package.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/acronym_package.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/acronym_reference_options.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/acronym_reference_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/acronym_reference_simple.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/acronym_reference_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_definition_simple.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/glossary_entry_definition_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_reference_options.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/glossary_entry_reference_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_reference_simple.txt (renamed from support/texlab/src/parser/test_data/latex/glossary/glossary_entry_reference_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/graphics_path.txt (renamed from support/texlab/src/parser/test_data/latex/graphics_path.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/graphics_path_command.txt (renamed from support/texlab/src/parser/test_data/latex/graphics_path_command.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/graphics_path_options.txt (renamed from support/texlab/src/parser/test_data/latex/graphics_path_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/curly_group_missing_end.txt (renamed from support/texlab/src/parser/test_data/latex/group/curly_group_missing_end.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/curly_group_simple.txt (renamed from support/texlab/src/parser/test_data/latex/group/curly_group_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/equation_missing_end.txt (renamed from support/texlab/src/parser/test_data/latex/group/equation_missing_end.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/escaped_brackets.txt (renamed from support/texlab/src/parser/test_data/latex/group/escaped_brackets.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/unmatched_braces.txt (renamed from support/texlab/src/parser/test_data/latex/group/unmatched_braces.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/unmatched_brackets.txt (renamed from support/texlab/src/parser/test_data/latex/group/unmatched_brackets.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/group/unmatched_brackets_with_group.txt (renamed from support/texlab/src/parser/test_data/latex/group/unmatched_brackets_with_group.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/hello_world.txt (renamed from support/texlab/src/parser/test_data/latex/hello_world.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/biblatex_include_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/biblatex_include_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/biblatex_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/biblatex_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/bibtex_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/bibtex_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/class_include_empty.txt (renamed from support/texlab/src/parser/test_data/latex/include/class_include_empty.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/class_include_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/class_include_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/class_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/class_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/graphics_include_command.txt (renamed from support/texlab/src/parser/test_data/latex/include/graphics_include_command.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/graphics_include_complicated_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/graphics_include_complicated_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/graphics_include_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/graphics_include_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/graphics_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/graphics_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/import_incomplete.txt (renamed from support/texlab/src/parser/test_data/latex/include/import_incomplete.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/import_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/import_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/inkscape_include_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/inkscape_include_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/inkscape_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/inkscape_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/latex_include_equality_sign.txt (renamed from support/texlab/src/parser/test_data/latex/include/latex_include_equality_sign.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/latex_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/latex_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/latex_input_path_brackets.txt (renamed from support/texlab/src/parser/test_data/latex/include/latex_input_path_brackets.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/package_include_empty.txt (renamed from support/texlab/src/parser/test_data/latex/include/package_include_empty.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/package_include_multiple.txt (renamed from support/texlab/src/parser/test_data/latex/include/package_include_multiple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/package_include_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/package_include_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/package_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/package_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/pgf_library_import_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/pgf_library_import_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/svg_include_options.txt (renamed from support/texlab/src/parser/test_data/latex/include/svg_include_options.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/svg_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/svg_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/tikz_library_import_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/tikz_library_import_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/include/verbatim_include_simple.txt (renamed from support/texlab/src/parser/test_data/latex/include/verbatim_include_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/inline.txt (renamed from support/texlab/src/parser/test_data/latex/inline.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/inline_double_dollar.txt (renamed from support/texlab/src/parser/test_data/latex/inline_double_dollar.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/issue_745.txt (renamed from support/texlab/src/parser/test_data/latex/issue_745.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/issue_789.txt (renamed from support/texlab/src/parser/test_data/latex/issue_789.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/issue_853.txt (renamed from support/texlab/src/parser/test_data/latex/issue_853.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/issue_857.txt (renamed from support/texlab/src/parser/test_data/latex/issue_857.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/issue_874.txt | 1 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_definition_line_break.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_definition_line_break.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_definition_simple.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_definition_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_number.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_number.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_equation.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_equation.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_incomplete.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_incomplete.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_multiple.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_multiple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_error.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_range_error.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_incomplete.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_range_incomplete.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_simple.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_range_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/label/label_reference_simple.txt (renamed from support/texlab/src/parser/test_data/latex/label/label_reference_simple.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/parameter.txt (renamed from support/texlab/src/parser/test_data/latex/parameter.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/parameter_error.txt (renamed from support/texlab/src/parser/test_data/latex/parameter_error.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/structure/structure_enum_item.txt (renamed from support/texlab/src/parser/test_data/latex/structure/structure_enum_item.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/structure/structure_invalid_nesting.txt (renamed from support/texlab/src/parser/test_data/latex/structure/structure_invalid_nesting.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/structure/structure_nested.txt (renamed from support/texlab/src/parser/test_data/latex/structure/structure_nested.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/structure/structure_siblings.txt (renamed from support/texlab/src/parser/test_data/latex/structure/structure_siblings.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_full.txt (renamed from support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_full.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt (renamed from support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt (renamed from support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt (renamed from support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_only_name.txt (renamed from support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_only_name.txt) | 0 | ||||
-rw-r--r-- | support/texlab/crates/syntax/Cargo.toml | 14 | ||||
-rw-r--r-- | support/texlab/crates/syntax/src/bibtex.rs (renamed from support/texlab/src/syntax/bibtex.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/syntax/src/latex.rs (renamed from support/texlab/src/syntax/latex.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/syntax/src/latex/cst.rs (renamed from support/texlab/src/syntax/latex/cst.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/syntax/src/latex/kind.rs (renamed from support/texlab/src/syntax/latex/kind.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/syntax/src/lib.rs (renamed from support/texlab/src/syntax.rs) | 13 | ||||
-rw-r--r-- | support/texlab/crates/texlab/Cargo.toml | 78 | ||||
-rw-r--r-- | support/texlab/crates/texlab/benches/bench_main.rs | 43 | ||||
-rw-r--r-- | support/texlab/crates/texlab/data/components.json.gz (renamed from support/texlab/data/components.json.gz) | bin | 6970534 -> 6970534 bytes | |||
-rw-r--r-- | support/texlab/crates/texlab/data/lang_data.json (renamed from support/texlab/data/lang_data.json) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/client.rs (renamed from support/texlab/src/client.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features.rs (renamed from support/texlab/src/features.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/build.rs (renamed from support/texlab/src/features/build.rs) | 79 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/build/progress.rs (renamed from support/texlab/src/features/build/progress.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion.rs (renamed from support/texlab/src/features/completion.rs) | 17 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/acronym_ref.rs | 31 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/argument.rs (renamed from support/texlab/src/features/completion/argument.rs) | 13 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/begin_snippet.rs (renamed from support/texlab/src/features/completion/begin_snippet.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/builder.rs (renamed from support/texlab/src/features/completion/builder.rs) | 157 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/citation.rs (renamed from support/texlab/src/features/completion/citation.rs) | 21 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/color.rs (renamed from support/texlab/src/features/completion/color.rs) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/color_model.rs (renamed from support/texlab/src/features/completion/color_model.rs) | 3 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/component_command.rs (renamed from support/texlab/src/features/completion/component_command.rs) | 2 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/component_environment.rs (renamed from support/texlab/src/features/completion/component_environment.rs) | 2 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/entry_type.rs (renamed from support/texlab/src/features/completion/entry_type.rs) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/field.rs (renamed from support/texlab/src/features/completion/field.rs) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/glossary_ref.rs | 37 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/import.rs (renamed from support/texlab/src/features/completion/import.rs) | 8 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/include.rs (renamed from support/texlab/src/features/completion/include.rs) | 33 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/label.rs | 72 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/theorem.rs | 21 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/tikz_library.rs (renamed from support/texlab/src/features/completion/tikz_library.rs) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/user_command.rs | 21 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/completion/user_environment.rs | 26 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/definition.rs (renamed from support/texlab/src/features/definition.rs) | 21 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/definition/command.rs | 45 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/definition/document.rs (renamed from support/texlab/src/features/definition/document.rs) | 13 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/definition/entry.rs | 42 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/definition/label.rs | 37 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/definition/string.rs (renamed from support/texlab/src/features/definition/string.rs) | 17 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/folding.rs (renamed from support/texlab/src/features/folding.rs) | 27 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/formatting.rs | 29 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs (renamed from support/texlab/src/features/formatting/bibtex_internal.rs) | 22 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/formatting/latexindent.rs (renamed from support/texlab/src/features/formatting/latexindent.rs) | 29 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/forward_search.rs (renamed from support/texlab/src/features/forward_search.rs) | 54 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/highlight.rs | 15 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/highlight/label.rs | 30 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover.rs (renamed from support/texlab/src/features/hover.rs) | 13 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover/citation.rs (renamed from support/texlab/src/features/hover/citation.rs) | 12 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover/component.rs | 23 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover/entry_type.rs (renamed from support/texlab/src/features/hover/entry_type.rs) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover/field.rs (renamed from support/texlab/src/features/hover/field.rs) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover/label.rs | 26 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/hover/string_ref.rs (renamed from support/texlab/src/features/hover/string_ref.rs) | 13 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/inlay_hint.rs | 48 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/inlay_hint/label.rs | 39 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/link.rs | 38 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/link/include.rs | 22 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/reference.rs (renamed from support/texlab/src/features/reference.rs) | 24 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/reference/entry.rs (renamed from support/texlab/src/features/reference/entry.rs) | 34 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/reference/label.rs | 36 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/reference/string.rs (renamed from support/texlab/src/features/reference/string.rs) | 19 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/rename.rs (renamed from support/texlab/src/features/rename.rs) | 29 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/rename/command.rs | 39 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/rename/entry.rs (renamed from support/texlab/src/features/rename/entry.rs) | 38 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/rename/label.rs | 37 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/symbol.rs (renamed from support/texlab/src/features/symbol.rs) | 57 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/symbol/bibtex.rs (renamed from support/texlab/src/features/symbol/bibtex.rs) | 25 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/symbol/latex.rs (renamed from support/texlab/src/features/symbol/latex.rs) | 289 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/symbol/project_order.rs | 203 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/symbol/types.rs (renamed from support/texlab/src/features/symbol/types.rs) | 15 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/workspace_command.rs (renamed from support/texlab/src/features/workspace_command.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/workspace_command/change_environment.rs (renamed from support/texlab/src/features/workspace_command/change_environment.rs) | 14 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/workspace_command/clean.rs (renamed from support/texlab/src/features/workspace_command/clean.rs) | 28 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/features/workspace_command/dep_graph.rs | 57 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/lib.rs | 33 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/main.rs (renamed from support/texlab/src/main.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/server.rs (renamed from support/texlab/src/server.rs) | 380 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/server/dispatch.rs (renamed from support/texlab/src/server/dispatch.rs) | 5 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/server/options.rs (renamed from support/texlab/src/server/options.rs) | 3 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util.rs (renamed from support/texlab/src/util.rs) | 2 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/capabilities.rs (renamed from support/texlab/src/util/capabilities.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/chktex.rs (renamed from support/texlab/src/util/chktex.rs) | 45 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/components.rs (renamed from support/texlab/src/util/components.rs) | 22 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/cursor.rs (renamed from support/texlab/src/util/cursor.rs) | 52 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/diagnostics.rs | 120 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/label.rs | 202 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/lang_data.rs (renamed from support/texlab/src/util/lang_data.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/line_index_ext.rs (renamed from support/texlab/src/util/line_index_ext.rs) | 15 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/lsp_enums.rs (renamed from support/texlab/src/util/lsp_enums.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/src/util/regex_filter.rs (renamed from support/texlab/src/util/regex_filter.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/fixture.rs (renamed from support/texlab/tests/lsp/fixture.rs) | 41 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/main.rs (renamed from support/texlab/tests/lsp/main.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document.rs (renamed from support/texlab/tests/lsp/text_document.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/completion.rs (renamed from support/texlab/tests/lsp/text_document/completion.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/definition.rs (renamed from support/texlab/tests/lsp/text_document/definition.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/document_highlight.rs (renamed from support/texlab/tests/lsp/text_document/document_highlight.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/document_link.rs (renamed from support/texlab/tests/lsp/text_document/document_link.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/document_symbol.rs (renamed from support/texlab/tests/lsp/text_document/document_symbol.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/folding_range.rs (renamed from support/texlab/tests/lsp/text_document/folding_range.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/formatting.rs (renamed from support/texlab/tests/lsp/text_document/formatting.rs) | 3 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/hover.rs (renamed from support/texlab/tests/lsp/text_document/hover.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/inlay_hint.rs (renamed from support/texlab/tests/lsp/text_document/inlay_hint.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/references.rs (renamed from support/texlab/tests/lsp/text_document/references.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/rename.rs (renamed from support/texlab/tests/lsp/text_document/rename.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_package_ref.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_package_ref.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_empty.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_empty.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_empty.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_empty.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_word.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_word.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__begin_environment_without_snippet_support.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__begin_environment_without_snippet_support.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_acronym.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_acronym.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace_multiple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace_multiple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_word.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_word.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_bibtex.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_bibtex.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple_package.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple_package.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_class.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_class.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_command_definition.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_command_definition.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple_end.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple_end.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_preamble.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_preamble.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_string.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_string.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_at_empty.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_at_empty.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_article.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_article.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_preamble.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_preamble.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_string.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_string.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_complete_entry.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_complete_entry.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_closed.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_closed.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_open.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_open.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_field_name.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_field_name.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_closed.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_closed.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_open.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_open.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_simple.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_simple.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_closed_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_closed_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_closed_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_closed_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap) | 2 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__label.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__label.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_import.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_import.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_texlabroot.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_texlabroot.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_begin.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_begin.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_end.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_end.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_closed_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_closed_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_open_brace.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_open_brace.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_command.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_command.snap) | 2 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_environment.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_environment.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_import.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_import.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_include.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_include.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_flat.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_flat.snap) | 12 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_nested.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_nested.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_flat.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_flat.snap) | 8 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_nested.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_nested.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_flat.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_flat.snap) | 8 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_nested.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_nested.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__ignored_patterns.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__ignored_patterns.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_flat.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_flat.snap) | 8 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_nested.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_nested.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_flat.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_flat.snap) | 10 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_nested.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_nested.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__bibtex.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__bibtex.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__latex.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__latex.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_command.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_command.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_insert_braces.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_insert_braces.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_join_strings.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_join_strings.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_multiple_entries.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_multiple_entries.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_parens.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_parens.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_preamble.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_preamble.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_string.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_string.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_trailing_comma.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_trailing_comma.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_wrap_long_lines.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_wrap_long_lines.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_cite.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_cite.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_entry.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_entry.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__component_known_package.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__component_known_package.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__entry_type_known_type.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__entry_type_known_type.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__field_known.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__field_known.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file_mumber.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file_mumber.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__section.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__section.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__string_inside_reference.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__string_inside_reference.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap (renamed from support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace.rs (renamed from support/texlab/tests/lsp/workspace.rs) | 0 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_bibtex.snap (renamed from support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_bibtex.snap) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_figure.snap (renamed from support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_figure.snap) | 4 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_item.snap (renamed from support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_item.snap) | 8 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_math.snap (renamed from support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_math.snap) | 6 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_section.snap (renamed from support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_section.snap) | 10 | ||||
-rw-r--r-- | support/texlab/crates/texlab/tests/lsp/workspace/symbol.rs (renamed from support/texlab/tests/lsp/workspace/symbol.rs) | 0 | ||||
-rw-r--r-- | support/texlab/src/db.rs | 15 | ||||
-rw-r--r-- | support/texlab/src/db/analysis.rs | 221 | ||||
-rw-r--r-- | support/texlab/src/db/analysis/label.rs | 122 | ||||
-rw-r--r-- | support/texlab/src/db/context.rs | 18 | ||||
-rw-r--r-- | support/texlab/src/db/diagnostics.rs | 177 | ||||
-rw-r--r-- | support/texlab/src/db/diagnostics/bib.rs | 112 | ||||
-rw-r--r-- | support/texlab/src/db/diagnostics/log.rs | 100 | ||||
-rw-r--r-- | support/texlab/src/db/diagnostics/tex.rs | 147 | ||||
-rw-r--r-- | support/texlab/src/db/discovery.rs | 258 | ||||
-rw-r--r-- | support/texlab/src/db/document.rs | 199 | ||||
-rw-r--r-- | support/texlab/src/db/parse.rs | 79 | ||||
-rw-r--r-- | support/texlab/src/db/workspace.rs | 211 | ||||
-rw-r--r-- | support/texlab/src/features/completion/acronym_ref.rs | 29 | ||||
-rw-r--r-- | support/texlab/src/features/completion/glossary_ref.rs | 35 | ||||
-rw-r--r-- | support/texlab/src/features/completion/label.rs | 79 | ||||
-rw-r--r-- | support/texlab/src/features/completion/theorem.rs | 21 | ||||
-rw-r--r-- | support/texlab/src/features/completion/user_command.rs | 30 | ||||
-rw-r--r-- | support/texlab/src/features/completion/user_environment.rs | 25 | ||||
-rw-r--r-- | support/texlab/src/features/definition/command.rs | 41 | ||||
-rw-r--r-- | support/texlab/src/features/definition/entry.rs | 43 | ||||
-rw-r--r-- | support/texlab/src/features/definition/label.rs | 38 | ||||
-rw-r--r-- | support/texlab/src/features/formatting.rs | 33 | ||||
-rw-r--r-- | support/texlab/src/features/highlight.rs | 10 | ||||
-rw-r--r-- | support/texlab/src/features/highlight/label.rs | 32 | ||||
-rw-r--r-- | support/texlab/src/features/hover/component.rs | 28 | ||||
-rw-r--r-- | support/texlab/src/features/hover/label.rs | 23 | ||||
-rw-r--r-- | support/texlab/src/features/inlay_hint.rs | 45 | ||||
-rw-r--r-- | support/texlab/src/features/inlay_hint/label.rs | 48 | ||||
-rw-r--r-- | support/texlab/src/features/link.rs | 41 | ||||
-rw-r--r-- | support/texlab/src/features/link/include.rs | 25 | ||||
-rw-r--r-- | support/texlab/src/features/reference/label.rs | 36 | ||||
-rw-r--r-- | support/texlab/src/features/rename/command.rs | 37 | ||||
-rw-r--r-- | support/texlab/src/features/rename/label.rs | 76 | ||||
-rw-r--r-- | support/texlab/src/features/symbol/project_order.rs | 202 | ||||
-rw-r--r-- | support/texlab/src/features/workspace_command/dep_graph.rs | 57 | ||||
-rw-r--r-- | support/texlab/src/lib.rs | 125 | ||||
-rw-r--r-- | support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap | 10 | ||||
-rw-r--r-- | support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter.txt.snap | 10 | ||||
-rw-r--r-- | support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter_error.txt.snap | 10 | ||||
-rw-r--r-- | support/texlab/src/server/query.rs | 32 | ||||
-rw-r--r-- | support/texlab/src/util/label.rs | 267 | ||||
-rw-r--r-- | support/texlab/texlab.1 | 4 | ||||
-rw-r--r-- | support/texlab/texlab.pdf | bin | 26434 -> 26391 bytes |
589 files changed, 4713 insertions, 5048 deletions
diff --git a/support/latexindent/LatexIndent/Document.pm b/support/latexindent/LatexIndent/Document.pm index 4a99721a34..16a01bf209 100644 --- a/support/latexindent/LatexIndent/Document.pm +++ b/support/latexindent/LatexIndent/Document.pm @@ -240,15 +240,7 @@ sub output_indented_text { } elsif ( $switches{outputToFile} ) { - # diacritics in file names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439) - # - # note, related: - # - # git config --add core.quotePath false - ${$self}{outputToFile} = decode( "utf-8", ${$self}{outputToFile} ); - $logger->info("Outputting to file ${$self}{outputToFile}"); - open( OUTPUTFILE, ">", ${$self}{outputToFile} ); print OUTPUTFILE ${$self}{body}; close(OUTPUTFILE); diff --git a/support/latexindent/LatexIndent/FileExtension.pm b/support/latexindent/LatexIndent/FileExtension.pm index b0f49f246d..b61ffc1bb4 100644 --- a/support/latexindent/LatexIndent/FileExtension.pm +++ b/support/latexindent/LatexIndent/FileExtension.pm @@ -21,6 +21,7 @@ use PerlIO::encoding; use open ':std', ':encoding(UTF-8)'; use File::Basename; # to get the filename and directory path use Exporter qw/import/; +use Encode qw/decode/; use LatexIndent::GetYamlSettings qw/%mainSettings/; use LatexIndent::Switches qw/%switches $is_check_switch_active/; use LatexIndent::LogFile qw/$logger/; @@ -114,7 +115,12 @@ sub file_extension_check { $logger->info("*-o switch active: output file check"); - ${$self}{outputToFile} = $switches{outputToFile}; + # diacritics in file names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439) + # + # note, related: + # + # git config --add core.quotePath false + ${$self}{outputToFile} = decode( "utf-8", $switches{outputToFile} ); if ( $fileName eq "-" and $switches{outputToFile} =~ m/^\+/ ) { $logger->info("STDIN input mode active, -o switch is removing all + symbols"); @@ -124,7 +130,7 @@ sub file_extension_check { # the -o file name might begin with a + symbol if ( $switches{outputToFile} =~ m/^\+(.*)/ and $1 ne "+" ) { $logger->info("-o switch called with + symbol at the beginning: ${$self}{outputToFile}"); - ${$self}{outputToFile} = ${$self}{baseName} . $1; + ${$self}{outputToFile} = decode( "utf-8", ${$self}{baseName} . $1 ); $logger->info("output file is now: ${$self}{outputToFile}"); } @@ -137,7 +143,8 @@ sub file_extension_check { # if there is no extension, then add the extension from the file to be operated upon if ( !$ext ) { - $logger->info("-o switch called with file name without extension: $switches{outputToFile}"); + $logger->info( + "-o switch called with file name without extension: " . decode( "utf-8", $switches{outputToFile} ) ); ${$self}{outputToFile} = $name . ( $name =~ m/\.\z/ ? q() : "." ) . $strippedFileExtension; $logger->info( "Updated to ${$self}{outputToFile} as the file extension of the input file is $strippedFileExtension"); diff --git a/support/latexindent/LatexIndent/LogFile.pm b/support/latexindent/LatexIndent/LogFile.pm index 93b6ad0930..5847ca42f4 100644 --- a/support/latexindent/LatexIndent/LogFile.pm +++ b/support/latexindent/LatexIndent/LogFile.pm @@ -129,12 +129,9 @@ ENDQUOTE # cruft directory ${$self}{cruftDirectory} = $switches{cruftDirectory} || ( dirname ${$self}{fileName} ); - # diacritics in cruft directory (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439) - ${$self}{cruftDirectory} = decode( "utf-8", ${$self}{cruftDirectory} ); - # if cruft directory does not exist if ( !( -d ${$self}{cruftDirectory} ) ) { - $logger->fatal("*Could not find directory ${$self}{cruftDirectory}"); + $logger->fatal( "*Could not find directory " . decode( "utf-8", ${$self}{cruftDirectory} ) ); $logger->fatal("Exiting, no indentation done."); $self->output_logfile(); exit(6); @@ -143,6 +140,8 @@ ENDQUOTE my $logfileName = ( $switches{cruftDirectory} ? ${$self}{cruftDirectory} . "/" : '' ) . ( $switches{logFileName} || "indent.log" ); + $logfileName = decode( "utf-8", $logfileName ); + # details of the script to log file $logger->info("*$FindBin::Script version $versionNumber, $versionDate, a script to indent .tex files"); $logger->info("$FindBin::Script lives here: $FindBin::RealBin/"); @@ -247,7 +246,7 @@ ENDQUOTE } $logger->info("*Directory for backup files and $logfileName:"); - $logger->info("${$self}{cruftDirectory}"); + $logger->info( $switches{cruftDirectory} ? decode( "utf-8", ${$self}{cruftDirectory} ) : ${$self}{cruftDirectory} ); # output location of modules if ( $FindBin::Script eq 'latexindent.pl' or ( $FindBin::Script eq 'latexindent.exe' and $switches{trace} ) ) { diff --git a/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm index 457e9c83bf..998d3dbfe3 100644 --- a/support/latexindent/LatexIndent/Version.pm +++ b/support/latexindent/LatexIndent/Version.pm @@ -20,6 +20,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.20.5'; -our $versionDate = '2023-04-07'; +our $versionNumber = '3.20.6'; +our $versionDate = '2023-04-11'; 1 diff --git a/support/latexindent/README b/support/latexindent/README index 4a3d96433c..95461bf24f 100644 --- a/support/latexindent/README +++ b/support/latexindent/README @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - latexindent.pl, version 3.20.5, 2023-04-07 + latexindent.pl, version 3.20.6, 2023-04-11 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/support/latexindent/bin/linux/latexindent b/support/latexindent/bin/linux/latexindent Binary files differindex 3941080085..b4d88492d7 100644 --- a/support/latexindent/bin/linux/latexindent +++ b/support/latexindent/bin/linux/latexindent diff --git a/support/latexindent/bin/macos/latexindent b/support/latexindent/bin/macos/latexindent Binary files differindex ef6d8e84b2..e4d021aaba 100644 --- a/support/latexindent/bin/macos/latexindent +++ b/support/latexindent/bin/macos/latexindent diff --git a/support/latexindent/defaultSettings.yaml b/support/latexindent/defaultSettings.yaml index 51a8b22229..309ba003af 100644 --- a/support/latexindent/defaultSettings.yaml +++ b/support/latexindent/defaultSettings.yaml @@ -1,5 +1,5 @@ # -# latexindent.pl, version 3.20.5, 2023-04-07 +# latexindent.pl, version 3.20.6, 2023-04-11 # # defaultSettings.yaml, the default settings for latexindent.pl # diff --git a/support/latexindent/documentation/latexindent-yaml-schema.json b/support/latexindent/documentation/latexindent-yaml-schema.json index f2089565dc..ec760e70ac 100644 --- a/support/latexindent/documentation/latexindent-yaml-schema.json +++ b/support/latexindent/documentation/latexindent-yaml-schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/schema", "$id": "latexindent-yaml-schema.json", "title": "latexindent.pl YAML schema", - "description": "latexindent.pl YAML schema helper, V3.20.5 2023-04-07", + "description": "latexindent.pl YAML schema helper, V3.20.6 2023-04-11", "type": "object", "properties": { "fileExtensionPreference": { diff --git a/support/latexindent/documentation/latexindent.pdf b/support/latexindent/documentation/latexindent.pdf Binary files differindex e6d1ead45d..deaf1a130f 100644 --- a/support/latexindent/documentation/latexindent.pdf +++ b/support/latexindent/documentation/latexindent.pdf diff --git a/support/latexindent/latexindent.pl b/support/latexindent/latexindent.pl index 90e9408b0a..8a041b5435 100755 --- a/support/latexindent/latexindent.pl +++ b/support/latexindent/latexindent.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# latexindent.pl, version 3.20.5, 2023-04-07 +# latexindent.pl, version 3.20.6, 2023-04-11 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/support/texlab/CHANGELOG.md b/support/texlab/CHANGELOG.md index 39bb7e4e54..557b8ea682 100644 --- a/support/texlab/CHANGELOG.md +++ b/support/texlab/CHANGELOG.md @@ -5,6 +5,13 @@ 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.2] - 2023-04-11 + +### Fixed + +- Fix memory leak when editing documents over a long time ([#856](https://github.com/latex-lsp/texlab/issues/856)) +- Fix parsing parentheses in file paths ([#874](https://github.com/latex-lsp/texlab/issues/874)) + ## [5.4.1] - 2023-03-26 ### Fixed diff --git a/support/texlab/Cargo.lock b/support/texlab/Cargo.lock index 7349b26f7d..724266ddb8 100644 --- a/support/texlab/Cargo.lock +++ b/support/texlab/Cargo.lock @@ -9,17 +9,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] name = "aho-corasick" version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -44,16 +33,50 @@ dependencies = [ ] [[package]] -name = "anyhow" -version = "1.0.69" +name = "anstream" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-wincon", + "concolor-override", + "concolor-query", + "is-terminal", + "utf8parse", +] [[package]] -name = "arc-swap" -version = "1.6.0" +name = "anstyle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" + +[[package]] +name = "anstyle-parse" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-wincon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +dependencies = [ + "anstyle", + "windows-sys 0.45.0", +] + +[[package]] +name = "anyhow" +version = "1.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" [[package]] name = "assert_unordered" @@ -82,6 +105,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] +name = "base-db" +version = "0.0.0" +dependencies = [ + "dirs", + "distro", + "itertools", + "log", + "notify", + "once_cell", + "parser", + "regex", + "rowan", + "rustc-hash", + "syntax", + "text-size", + "url", +] + +[[package]] name = "beef" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -104,9 +146,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" +checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", "serde", @@ -138,9 +180,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" dependencies = [ "num-integer", "num-traits", @@ -174,6 +216,24 @@ dependencies = [ ] [[package]] +name = "citeproc" +version = "0.0.0" +dependencies = [ + "chrono", + "human_name", + "insta", + "isocountry", + "itertools", + "parser", + "rowan", + "rustc-hash", + "syntax", + "titlecase", + "unicode-normalization", + "url", +] + +[[package]] name = "clap" version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -187,30 +247,38 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.8" +version = "4.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" +checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", - "clap_lex 0.3.2", - "is-terminal", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex 0.4.1", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.8" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bec8e5c9d09e439c4335b1af0abaab56dcf3b94999a936e1bb47b9134288f0" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] @@ -224,11 +292,23 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" + +[[package]] +name = "concolor-override" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" + +[[package]] +name = "concolor-query" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" dependencies = [ - "os_str_bytes", + "windows-sys 0.45.0", ] [[package]] @@ -251,9 +331,9 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" dependencies = [ "libc", ] @@ -304,24 +384,10 @@ dependencies = [ ] [[package]] -name = "crossbeam" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" -dependencies = [ - "cfg-if", - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -347,21 +413,11 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset", "scopeguard", ] [[package]] -name = "crossbeam-queue" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] name = "crossbeam-utils" version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -405,22 +461,30 @@ dependencies = [ [[package]] name = "dirs" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "dece029acd3353e3a58ac2e3eb3c8d6c35827a892edc6cc4138ef9c33df46ecd" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b" dependencies = [ "libc", "redox_users", - "winapi", + "windows-sys 0.45.0", +] + +[[package]] +name = "distro" +version = "0.0.0" +dependencies = [ + "anyhow", + "rustc-hash", ] [[package]] @@ -455,13 +519,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -475,16 +539,6 @@ dependencies = [ ] [[package]] -name = "eyre" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" -dependencies = [ - "indenter", - "once_cell", -] - -[[package]] name = "fastrand" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -495,23 +549,23 @@ dependencies = [ [[package]] name = "fern" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a" +checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" dependencies = [ "log", ] [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "windows-sys 0.45.0", + "redox_syscall 0.2.16", + "windows-sys 0.48.0", ] [[package]] @@ -525,19 +579,6 @@ dependencies = [ ] [[package]] -name = "flume" -version = "0.10.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project", - "spin", -] - -[[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -562,18 +603,6 @@ dependencies = [ ] [[package]] -name = "futures-core" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" - -[[package]] -name = "futures-sink" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" - -[[package]] name = "fuzzy-matcher" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -584,9 +613,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -594,15 +623,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -629,18 +656,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashlink" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" -dependencies = [ - "hashbrown", -] [[package]] name = "heck" @@ -703,16 +718,10 @@ dependencies = [ ] [[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - -[[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -740,9 +749,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.28.0" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea5b3894afe466b4bcf0388630fc15e11938a6074af0cd637c825ba2ec8a099" +checksum = "9a28d25139df397cbca21408bb742cf6837e04cdbebf1b07b760caf971d6a972" dependencies = [ "console", "globset", @@ -767,24 +776,25 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ + "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -855,9 +865,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] name = "linked-hash-map" @@ -867,9 +877,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" [[package]] name = "lock_api" @@ -892,25 +902,34 @@ dependencies = [ [[package]] name = "logos" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1" +checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" dependencies = [ "logos-derive", ] [[package]] -name = "logos-derive" -version = "0.12.1" +name = "logos-codegen" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c" +checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" dependencies = [ "beef", "fnv", "proc-macro2", "quote", "regex-syntax", - "syn", + "syn 2.0.13", +] + +[[package]] +name = "logos-derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" +dependencies = [ + "logos-codegen", ] [[package]] @@ -946,15 +965,6 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" @@ -984,15 +994,6 @@ dependencies = [ ] [[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom", -] - -[[package]] name = "notify" version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1053,9 +1054,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "os_str_bytes" -version = "6.4.1" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" [[package]] name = "parking_lot" @@ -1075,12 +1076,24 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] [[package]] +name = "parser" +version = "0.0.0" +dependencies = [ + "insta", + "logos", + "once_cell", + "regex", + "rowan", + "syntax", +] + +[[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1088,9 +1101,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.6" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cbd939b234e95d72bc393d51788aec68aeeb5d51e748ca08ff3aad58cb722f7" +checksum = "7b1403e8401ad5dedea73c626b99758535b342502f8d1e361f4a2dd952749122" dependencies = [ "thiserror", "ucd-trie", @@ -1098,9 +1111,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.6" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a81186863f3d0a27340815be8f2078dd8050b14cd71913db9fbda795e5f707d7" +checksum = "be99c4c1d2fc2769b1d00239431d711d08f6efedcecb8b6e30707160aee99c15" dependencies = [ "pest", "pest_generator", @@ -1108,22 +1121,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.6" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a1ef20bf3193c15ac345acb32e26b3dc3223aff4d77ae4fc5359567683796b" +checksum = "e56094789873daa36164de2e822b3888c6ae4b4f9da555a1103587658c805b1e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "pest_meta" -version = "2.5.6" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3b284b1f13a20dc5ebc90aff59a51b8d7137c221131b52a7260c08cbc1cc80" +checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e" dependencies = [ "once_cell", "pest", @@ -1169,26 +1182,6 @@ dependencies = [ ] [[package]] -name = "pin-project" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "plotters" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1217,43 +1210,19 @@ dependencies = [ ] [[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -1305,21 +1274,30 @@ dependencies = [ ] [[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] name = "redox_users" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.7.1" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" dependencies = [ "aho-corasick", "memchr", @@ -1328,19 +1306,19 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "rowan" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5811547e7ba31e903fe48c8ceab10d40d70a101f3d15523c847cce91aa71f332" +checksum = "64449cfef9483a475ed56ae30e2da5ee96448789fb2aa240a04beb6a055078bf" dependencies = [ "countme", "hashbrown", - "memoffset 0.6.5", + "memoffset", "rustc-hash", "text-size", ] @@ -1353,61 +1331,25 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.36.9" +version = "0.37.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] -name = "rustversion" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" - -[[package]] name = "ryu" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] -name = "salsa-2022" -version = "0.1.0" -source = "git+https://github.com/salsa-rs/salsa?rev=ef7c0f12c8159e7025316e959c26f6278a576fa5#ef7c0f12c8159e7025316e959c26f6278a576fa5" -dependencies = [ - "arc-swap", - "crossbeam", - "crossbeam-utils", - "dashmap", - "hashlink", - "indexmap", - "log", - "parking_lot", - "rustc-hash", - "salsa-2022-macros", - "smallvec", -] - -[[package]] -name = "salsa-2022-macros" -version = "0.1.0" -source = "git+https://github.com/salsa-rs/salsa?rev=ef7c0f12c8159e7025316e959c26f6278a576fa5#ef7c0f12c8159e7025316e959c26f6278a576fa5" -dependencies = [ - "eyre", - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1424,29 +1366,29 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.154" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cdd151213925e7f1ab45a9bbfb129316bd00799784b174b7cc7bcd16961c49e" +checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.154" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc80d722935453bcafdc2c9a73cd6fac4dc1938f0346035d84bf99fa9e33217" +checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" dependencies = [ "itoa", "ryu", @@ -1465,13 +1407,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc" +checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] @@ -1522,47 +1464,27 @@ dependencies = [ ] [[package]] -name = "spin" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc" -dependencies = [ - "lock_api", -] - -[[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.24.3" +name = "syn" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "heck", "proc-macro2", "quote", - "rustversion", - "syn", + "unicode-ident", ] [[package]] name = "syn" -version = "1.0.109" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" dependencies = [ "proc-macro2", "quote", @@ -1570,70 +1492,68 @@ dependencies = [ ] [[package]] -name = "tempfile" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +name = "syntax" +version = "0.0.0" dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.42.0", + "itertools", + "rowan", ] [[package]] -name = "termcolor" -version = "1.2.0" +name = "tempfile" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ - "winapi-util", + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.45.0", ] [[package]] name = "texlab" -version = "5.4.1" +version = "5.4.2" dependencies = [ "anyhow", "assert_unordered", - "chrono", - "clap 4.1.8", + "base-db", + "citeproc", + "clap 4.2.1", "criterion", "crossbeam-channel", "dashmap", "dirs", + "distro", "encoding_rs", "encoding_rs_io", "fern", "flate2", - "flume", "fuzzy-matcher", "human_name", "insta", - "isocountry", "itertools", "log", - "logos", "lsp-server", "lsp-types", "notify", "once_cell", + "parking_lot", + "parser", "regex", "rowan", "rustc-hash", - "salsa-2022", "serde", "serde_json", "serde_regex", "serde_repr", "smol_str", - "strum", + "syntax", "tempfile", "thiserror", "threadpool", "titlecase", - "unicode-normalization", ] [[package]] @@ -1650,22 +1570,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] @@ -1737,9 +1657,9 @@ checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "unicode-bidi" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-case-mapping" @@ -1787,6 +1707,12 @@ dependencies = [ ] [[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1794,12 +1720,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ "same-file", - "winapi", "winapi-util", ] @@ -1830,7 +1755,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -1852,7 +1777,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1910,13 +1835,13 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 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", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -1925,65 +1850,131 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 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", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "yaml-rust" diff --git a/support/texlab/Cargo.toml b/support/texlab/Cargo.toml index dfa23f744a..59e182bf20 100644 --- a/support/texlab/Cargo.toml +++ b/support/texlab/Cargo.toml @@ -1,84 +1,14 @@ -[package] -name = "texlab" -description = "LaTeX Language Server" -version = "5.4.1" +[workspace] +members = ["crates/*"] + +[workspace.package] license = "GPL-3.0" -readme = "README.md" authors = [ - "Eric Förster <eric.foerster@outlook.com>", - "Patrick Förster <patrick.foerster@outlook.de>", + "Eric Förster <eric.foerster@outlook.com>", + "Patrick Förster <patrick.foerster@outlook.de>", ] edition = "2021" 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" -keywords = ["lsp", "server", "latex", "bibtex"] -categories = ["development-tools"] -exclude = [ - ".gitattributes", - ".gitignore", - ".github/**", - "tests/it/**", - "*.snap", - "texlab.1", - "texlab.pdf", - "texlab.tex", -] - -[[bin]] -name = "texlab" -test = false - -[lib] -doctest = false - -[dependencies] -anyhow = "1.0.69" -chrono = { version = "0.4.23", default-features = false, features = ["std"] } -clap = { version = "4.1.6", features = ["derive"] } -crossbeam-channel = "0.5.6" -dashmap = "5.4.0" -dirs = "4.0.0" -encoding_rs = "0.8.32" -encoding_rs_io = "0.1.7" -fern = "0.6.1" -flate2 = "1.0.25" -flume = "0.10.14" -fuzzy-matcher = { version = "0.3.7", features = ["compact"] } -human_name = { version = "2.0.1", default-features = false } -isocountry = "0.3.2" -itertools = "0.10.5" -log = "0.4.17" -logos = "0.12.1" -lsp-server = "0.7.0" -lsp-types = "0.94.0" -notify = "5.1.0" -once_cell = "1.17.1" -regex = "1.7.1" -rowan = "0.15.10" -rustc-hash = "1.1.0" -serde = "1.0.152" -serde_json = "1.0.93" -serde_regex = "1.1.0" -serde_repr = "0.1.10" -smol_str = { version = "0.1.24", features = ["serde"] } -strum = { version = "0.24.1", features = ["derive"] } -tempfile = "3.3.0" -thiserror = "1.0.38" -threadpool = "1.8.1" -titlecase = "2.2.1" -unicode-normalization = "0.1.22" - -[dependencies.salsa] -git = "https://github.com/salsa-rs/salsa" -rev = "ef7c0f12c8159e7025316e959c26f6278a576fa5" -package = "salsa-2022" - -[dev-dependencies] -assert_unordered = "0.3.5" -criterion = { version = "0.4.0" } -insta = { version = "1.28.0", features = ["glob", "redactions", "json"] } [profile.release] lto = "thin" @@ -87,8 +17,3 @@ incremental = true [profile.bench] lto = "thin" incremental = true - -[[bench]] -name = "bench_main" -path = "benches/bench_main.rs" -harness = false diff --git a/support/texlab/benches/bench_main.rs b/support/texlab/benches/bench_main.rs deleted file mode 100644 index 196afb1f43..0000000000 --- a/support/texlab/benches/bench_main.rs +++ /dev/null @@ -1,25 +0,0 @@ -use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use lsp_types::{Position, Url}; -use texlab::{ - db::{Language, Owner, Workspace}, - parser::parse_latex, - Database, -}; - -fn criterion_benchmark(c: &mut Criterion) { - c.bench_function("LaTeX/Parser", |b| { - b.iter(|| parse_latex(black_box(include_str!("../texlab.tex")))); - }); - - c.bench_function("LaTeX/Completion/Command", |b| { - let uri = Url::parse("http://example.com/texlab.tex").unwrap(); - let text = include_str!("../texlab.tex").to_string(); - let mut db = Database::default(); - Workspace::get(&db).open(&mut db, uri.clone(), text, Language::Tex, Owner::Client); - b.iter(|| texlab::features::completion::complete(&db, &uri, Position::new(0, 1))); - }); -} - -criterion_group!(benches, criterion_benchmark); - -criterion_main!(benches); diff --git a/support/texlab/crates/base-db/Cargo.toml b/support/texlab/crates/base-db/Cargo.toml new file mode 100644 index 0000000000..2c7efe9ac0 --- /dev/null +++ b/support/texlab/crates/base-db/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "base-db" +version = "0.0.0" +license.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] +dirs = "5.0.0" +distro = { path = "../distro" } +itertools = "0.10.5" +log = "0.4.17" +notify = "5.1.0" +once_cell = "1.17.1" +parser = { path = "../parser" } +regex = "1.7.3" +rowan = "0.15.11" +rustc-hash = "1.1.0" +syntax = { path = "../syntax" } +text-size = "1.1.0" +url = "2.3.1" + +[lib] +doctest = false diff --git a/support/texlab/src/config.rs b/support/texlab/crates/base-db/src/config.rs index 33cbacd3be..56ee5ee237 100644 --- a/support/texlab/src/config.rs +++ b/support/texlab/crates/base-db/src/config.rs @@ -159,57 +159,11 @@ impl Default for SymbolConfig { 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 math_environments = DEFAULT_MATH_ENVIRONMENTS + .iter() + .copied() + .map(String::from) + .collect(); let enum_environments = ["enumerate", "itemize", "description"] .into_iter() @@ -228,3 +182,52 @@ impl Default for SyntaxConfig { } } } + +static DEFAULT_MATH_ENVIRONMENTS: &[&str] = &[ + "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*", +]; diff --git a/support/texlab/crates/base-db/src/diagnostics.rs b/support/texlab/crates/base-db/src/diagnostics.rs new file mode 100644 index 0000000000..f5d13400a6 --- /dev/null +++ b/support/texlab/crates/base-db/src/diagnostics.rs @@ -0,0 +1,25 @@ +pub mod bib; +pub mod log; +pub mod tex; + +use rowan::TextRange; +use syntax::BuildError; + +#[derive(Debug, Clone)] +pub struct Diagnostic { + pub range: TextRange, + pub code: ErrorCode, +} + +#[derive(Debug, Clone)] +pub enum ErrorCode { + UnexpectedRCurly, + RCurlyInserted, + MismatchedEnvironment, + ExpectingLCurly, + ExpectingKey, + ExpectingRCurly, + ExpectingEq, + ExpectingFieldValue, + Build(BuildError), +} diff --git a/support/texlab/crates/base-db/src/diagnostics/bib.rs b/support/texlab/crates/base-db/src/diagnostics/bib.rs new file mode 100644 index 0000000000..f931a43c51 --- /dev/null +++ b/support/texlab/crates/base-db/src/diagnostics/bib.rs @@ -0,0 +1,69 @@ +use rowan::{ast::AstNode, TextRange}; +use syntax::bibtex::{self, HasDelims, HasEq, HasName, HasType, HasValue}; + +use crate::{Document, DocumentData}; + +use super::{Diagnostic, ErrorCode}; + +pub fn analyze(document: &mut Document) { + let DocumentData::Bib(data) = &document.data else { return }; + + for node in bibtex::SyntaxNode::new_root(data.green.clone()).descendants() { + if let Some(entry) = bibtex::Entry::cast(node.clone()) { + analyze_entry(document, entry); + } else if let Some(field) = bibtex::Field::cast(node.clone()) { + analyze_field(document, field); + } + } +} + +fn analyze_entry(document: &mut Document, entry: bibtex::Entry) { + if entry.left_delim_token().is_none() { + document.diagnostics.push(Diagnostic { + range: entry.type_token().unwrap().text_range(), + code: ErrorCode::ExpectingLCurly, + }); + + return; + } + + if entry.name_token().is_none() { + document.diagnostics.push(Diagnostic { + range: entry.left_delim_token().unwrap().text_range(), + code: ErrorCode::ExpectingKey, + }); + + return; + } + + if entry.right_delim_token().is_none() { + document.diagnostics.push(Diagnostic { + range: TextRange::empty(entry.syntax().text_range().end()), + code: ErrorCode::ExpectingRCurly, + }); + + return; + } +} + +fn analyze_field(document: &mut Document, field: bibtex::Field) { + if field.eq_token().is_none() { + let code = ErrorCode::ExpectingEq; + document.diagnostics.push(Diagnostic { + range: field.name_token().unwrap().text_range(), + code, + }); + + return; + } + + if field.value().is_none() { + let code = ErrorCode::ExpectingFieldValue; + document.diagnostics.push(Diagnostic { + range: field.name_token().unwrap().text_range(), + code, + }); + + return; + } +} diff --git a/support/texlab/crates/base-db/src/diagnostics/log.rs b/support/texlab/crates/base-db/src/diagnostics/log.rs new file mode 100644 index 0000000000..9e97a4e788 --- /dev/null +++ b/support/texlab/crates/base-db/src/diagnostics/log.rs @@ -0,0 +1,68 @@ +use rowan::{TextLen, TextRange, TextSize}; +use rustc_hash::FxHashMap; +use syntax::BuildError; +use url::Url; + +use crate::{Document, DocumentData, Workspace}; + +use super::{Diagnostic, ErrorCode}; + +pub fn analyze<'a>( + workspace: &'a Workspace, + log_document: &'a Document, +) -> FxHashMap<&'a Document, Vec<Diagnostic>> { + let mut results = FxHashMap::default(); + + let DocumentData::Log(data) = &log_document.data else { return results }; + + let parents = workspace.parents(log_document); + let Some(root_document) = parents.iter().next() else { return results }; + + let Some(base_path) = root_document.path + .as_deref() + .and_then(|path| path.parent()) else { return results }; + + for error in &data.errors { + let full_path = base_path.join(&error.relative_path); + let Ok(full_path_uri) = Url::from_file_path(&full_path) else { continue }; + let tex_document = workspace.lookup(&full_path_uri).unwrap_or(root_document); + + let range = find_range_of_hint(tex_document, error).unwrap_or_else(|| { + let line = error.line.unwrap_or(0); + let offset = *tex_document + .line_index + .newlines + .get(line as usize) + .unwrap_or(&TextSize::from(0)); + + TextRange::empty(offset) + }); + + let diagnostic = Diagnostic { + range, + code: ErrorCode::Build(error.clone()), + }; + + results.entry(tex_document).or_default().push(diagnostic); + } + + results +} + +fn find_range_of_hint(document: &Document, error: &BuildError) -> Option<TextRange> { + let line = error.line? as usize; + let hint = error.hint.as_deref()?; + let line_index = &document.line_index; + + let line_start = line_index.newlines.get(line).copied()?; + let line_end = line_index + .newlines + .get(line + 1) + .copied() + .unwrap_or((&document.text).text_len()); + + let line_text = &document.text[line_start.into()..line_end.into()]; + let hint_start = line_start + TextSize::try_from(line_text.find(hint)?).unwrap(); + let hint_end = hint_start + hint.text_len(); + Some(TextRange::new(hint_start, hint_end)) +} diff --git a/support/texlab/crates/base-db/src/diagnostics/tex.rs b/support/texlab/crates/base-db/src/diagnostics/tex.rs new file mode 100644 index 0000000000..81b6e4401a --- /dev/null +++ b/support/texlab/crates/base-db/src/diagnostics/tex.rs @@ -0,0 +1,116 @@ +use rowan::{ast::AstNode, NodeOrToken, TextRange}; +use syntax::latex; + +use crate::{Config, Document, DocumentData}; + +use super::{Diagnostic, ErrorCode}; + +pub fn analyze(document: &mut Document, config: &Config) { + if !document.uri.as_str().ends_with(".tex") { + return; + } + + let DocumentData::Tex(data) = &document.data else { return }; + + let mut traversal = latex::SyntaxNode::new_root(data.green.clone()).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| { + config + .syntax + .verbatim_environments + .contains(&name.to_string()) + }) + { + traversal.skip_subtree(); + continue; + } + } + + analyze_environment(document, node.clone()) + .or_else(|| analyze_curly_group(document, node.clone(), config)) + .or_else(|| analyze_curly_braces(document, node)); + } + rowan::WalkEvent::Leave(_) => { + continue; + } + }; + } +} + +fn analyze_environment(document: &mut Document, node: latex::SyntaxNode) -> Option<()> { + let environment = latex::Environment::cast(node)?; + let begin = environment.begin()?.name()?.key()?; + let end = environment.end()?.name()?.key()?; + if begin != end { + document.diagnostics.push(Diagnostic { + range: latex::small_range(&begin), + code: ErrorCode::MismatchedEnvironment, + }); + } + + Some(()) +} + +fn analyze_curly_group( + document: &mut Document, + node: latex::SyntaxNode, + config: &Config, +) -> Option<()> { + if !matches!( + node.kind(), + latex::CURLY_GROUP + | latex::CURLY_GROUP_COMMAND + | latex::CURLY_GROUP_KEY_VALUE + | latex::CURLY_GROUP_WORD + | latex::CURLY_GROUP_WORD_LIST + ) { + return None; + } + + let is_inside_verbatim_environment = node + .ancestors() + .filter_map(latex::Environment::cast) + .filter_map(|env| env.begin()) + .filter_map(|begin| begin.name()) + .filter_map(|name| name.key()) + .any(|name| { + config + .syntax + .verbatim_environments + .contains(&name.to_string()) + }); + + if !is_inside_verbatim_environment + && !node + .children_with_tokens() + .filter_map(NodeOrToken::into_token) + .any(|token| token.kind() == latex::R_CURLY) + { + document.diagnostics.push(Diagnostic { + range: TextRange::empty(node.text_range().end()), + code: ErrorCode::RCurlyInserted, + }); + } + + Some(()) +} + +fn analyze_curly_braces(document: &mut Document, node: latex::SyntaxNode) -> Option<()> { + if node.kind() == latex::ERROR && node.first_token()?.text() == "}" { + document.diagnostics.push(Diagnostic { + range: node.text_range(), + code: ErrorCode::UnexpectedRCurly, + }); + + Some(()) + } else { + None + } +} diff --git a/support/texlab/crates/base-db/src/document.rs b/support/texlab/crates/base-db/src/document.rs new file mode 100644 index 0000000000..39d9ec3cf7 --- /dev/null +++ b/support/texlab/crates/base-db/src/document.rs @@ -0,0 +1,196 @@ +use std::path::PathBuf; + +use distro::Language; +use rowan::TextSize; +use syntax::{bibtex, latex, BuildError}; +use url::Url; + +use crate::{ + diagnostics::{self, Diagnostic}, + line_index::LineIndex, + semantics, Config, +}; + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] +pub enum Owner { + Client, + Server, +} + +#[derive(Debug, Clone)] +pub struct Document { + pub uri: Url, + pub dir: Url, + pub path: Option<PathBuf>, + pub text: String, + pub line_index: LineIndex, + pub owner: Owner, + pub cursor: TextSize, + pub language: Language, + pub data: DocumentData, + pub diagnostics: Vec<Diagnostic>, +} + +impl Document { + pub fn parse( + uri: Url, + text: String, + language: Language, + owner: Owner, + cursor: TextSize, + config: &Config, + ) -> Self { + let dir = uri.join(".").unwrap(); + + let path = if uri.scheme() == "file" { + uri.to_file_path().ok() + } else { + None + }; + + let line_index = LineIndex::new(&text); + + let diagnostics = Vec::new(); + let data = match language { + Language::Tex => { + let green = parser::parse_latex(&text); + let mut semantics = semantics::tex::Semantics::default(); + semantics.process_root(&latex::SyntaxNode::new_root(green.clone())); + DocumentData::Tex(TexDocumentData { green, semantics }) + } + Language::Bib => { + let green = parser::parse_bibtex(&text); + DocumentData::Bib(BibDocumentData { green }) + } + Language::Aux => { + let green = parser::parse_latex(&text); + let mut semantics = semantics::auxiliary::Semantics::default(); + semantics.process_root(&latex::SyntaxNode::new_root(green.clone())); + DocumentData::Aux(AuxDocumentData { green, semantics }) + } + Language::Log => { + let errors = parser::parse_build_log(&text).errors; + DocumentData::Log(LogDocumentData { errors }) + } + Language::Root => DocumentData::Root, + Language::Tectonic => DocumentData::Tectonic, + }; + + let mut document = Self { + uri, + dir, + path, + text, + line_index, + owner, + cursor, + language, + data, + diagnostics, + }; + + match language { + Language::Tex => diagnostics::tex::analyze(&mut document, config), + Language::Bib => diagnostics::bib::analyze(&mut document), + Language::Aux | Language::Log | Language::Root | Language::Tectonic => (), + }; + + document + } +} + +impl std::borrow::Borrow<Url> for Document { + fn borrow(&self) -> &Url { + &self.uri + } +} + +impl std::borrow::Borrow<str> for Document { + fn borrow(&self) -> &str { + self.uri.as_str() + } +} + +impl PartialEq for Document { + fn eq(&self, other: &Self) -> bool { + self.uri == other.uri + } +} + +impl Eq for Document {} + +impl std::hash::Hash for Document { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.uri.hash(state) + } +} + +#[derive(Debug, Clone)] +pub enum DocumentData { + Tex(TexDocumentData), + Bib(BibDocumentData), + Aux(AuxDocumentData), + Log(LogDocumentData), + Root, + Tectonic, +} + +impl DocumentData { + pub fn as_tex(&self) -> Option<&TexDocumentData> { + if let DocumentData::Tex(data) = self { + Some(data) + } else { + None + } + } + + pub fn as_bib(&self) -> Option<&BibDocumentData> { + if let DocumentData::Bib(data) = self { + Some(data) + } else { + None + } + } + + pub fn as_aux(&self) -> Option<&AuxDocumentData> { + if let DocumentData::Aux(data) = self { + Some(data) + } else { + None + } + } +} + +#[derive(Debug, Clone)] +pub struct TexDocumentData { + pub green: rowan::GreenNode, + pub semantics: semantics::tex::Semantics, +} + +impl TexDocumentData { + pub fn root_node(&self) -> latex::SyntaxNode { + latex::SyntaxNode::new_root(self.green.clone()) + } +} + +#[derive(Debug, Clone)] +pub struct BibDocumentData { + pub green: rowan::GreenNode, +} + +impl BibDocumentData { + pub fn root_node(&self) -> bibtex::SyntaxNode { + bibtex::SyntaxNode::new_root(self.green.clone()) + } +} + +#[derive(Debug, Clone)] +pub struct LogDocumentData { + pub errors: Vec<BuildError>, +} + +#[derive(Debug, Clone)] +pub struct AuxDocumentData { + pub green: rowan::GreenNode, + pub semantics: semantics::auxiliary::Semantics, +} diff --git a/support/texlab/crates/base-db/src/graph.rs b/support/texlab/crates/base-db/src/graph.rs new file mode 100644 index 0000000000..2103aa8a73 --- /dev/null +++ b/support/texlab/crates/base-db/src/graph.rs @@ -0,0 +1,161 @@ +use std::{ffi::OsStr, path::PathBuf}; + +use distro::Language; +use itertools::Itertools; +use once_cell::sync::Lazy; +use rustc_hash::FxHashSet; +use url::Url; + +use crate::{semantics, Document, DocumentData, Workspace}; + +pub static HOME_DIR: Lazy<Option<PathBuf>> = Lazy::new(dirs::home_dir); + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub struct Edge<'a> { + pub source: &'a Document, + pub target: &'a Document, + pub weight: Option<EdgeWeight<'a>>, +} + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub struct EdgeWeight<'a> { + pub link: &'a semantics::tex::Link, + pub old_base_dir: Url, + pub new_base_dir: Url, +} + +#[derive(Debug)] +pub struct Graph<'a> { + pub workspace: &'a Workspace, + pub start: &'a Document, + pub edges: Vec<Edge<'a>>, + pub missing: Vec<Url>, +} + +impl<'a> Graph<'a> { + pub fn new(workspace: &'a Workspace, start: &'a Document) -> Self { + let mut graph = Self { + workspace, + start, + edges: Vec::new(), + missing: Vec::new(), + }; + + let base_dir = workspace.current_dir(&start.dir); + let mut stack = vec![(start, base_dir)]; + let mut visited = FxHashSet::default(); + + while let Some((source, base_dir)) = stack.pop() { + let index = graph.edges.len(); + graph.explicit_edges(source, &base_dir); + for edge in &graph.edges[index..] { + let Some(weight) = edge.weight.as_ref() else { continue }; + if visited.insert(&edge.target.uri) { + stack.push((edge.target, weight.new_base_dir.clone())); + } + } + + graph.implicit_edges(source, &base_dir); + } + + graph + } + + pub fn preorder(&self) -> impl DoubleEndedIterator<Item = &'a Document> + '_ { + std::iter::once(self.start) + .chain(self.edges.iter().map(|group| group.target)) + .unique_by(|document| &document.uri) + } + + fn explicit_edges(&mut self, source: &'a Document, base_dir: &Url) { + let DocumentData::Tex(data) = &source.data else { return }; + for link in &data.semantics.links { + self.explicit_edge(source, base_dir, link); + } + } + + fn explicit_edge( + &mut self, + source: &'a Document, + base_dir: &Url, + link: &'a semantics::tex::Link, + ) { + let home_dir = HOME_DIR.as_deref(); + + let stem = &link.path.text; + let mut file_names = vec![stem.clone()]; + link.kind + .extensions() + .iter() + .map(|ext| format!("{stem}.{ext}")) + .for_each(|name| file_names.push(name)); + + let file_name_db = &self.workspace.distro().file_name_db; + let distro_files = file_names + .iter() + .filter_map(|name| file_name_db.get(name)) + .filter(|path| home_dir.map_or(false, |dir| path.starts_with(dir))) + .flat_map(Url::from_file_path); + + for target_uri in file_names + .iter() + .flat_map(|file_name| base_dir.join(file_name)) + .chain(distro_files) + { + match self.workspace.lookup(&target_uri) { + Some(target) => { + let new_base_dir = link + .base_dir + .as_deref() + .and_then(|path| base_dir.join(&path).ok()) + .unwrap_or_else(|| base_dir.clone()); + + let weight = Some(EdgeWeight { + link, + old_base_dir: base_dir.clone(), + new_base_dir, + }); + + self.edges.push(Edge { + source, + target, + weight, + }); + } + None => { + self.missing.push(target_uri); + } + }; + } + } + + fn implicit_edges(&mut self, source: &'a Document, base_dir: &Url) { + let uri = source.uri.as_str(); + if source.language == Language::Tex && !uri.ends_with(".aux") { + self.implicit_edge(source, base_dir, "log"); + self.implicit_edge(source, base_dir, "aux"); + } + } + + fn implicit_edge(&mut self, source: &'a Document, base_dir: &Url, extension: &str) { + let Some(target_uri) = source.uri.to_file_path().ok().and_then(|mut path| { + path.set_extension(extension); + path.file_name() + .and_then(OsStr::to_str) + .and_then(|name| self.workspace.output_dir(base_dir).join(&name).ok()) + }) else { return }; + + match self.workspace.lookup(&target_uri) { + Some(target) => { + self.edges.push(Edge { + source, + target, + weight: None, + }); + } + None => { + self.missing.push(target_uri); + } + } + } +} diff --git a/support/texlab/crates/base-db/src/lib.rs b/support/texlab/crates/base-db/src/lib.rs new file mode 100644 index 0000000000..fae6ad5416 --- /dev/null +++ b/support/texlab/crates/base-db/src/lib.rs @@ -0,0 +1,9 @@ +mod config; +pub mod diagnostics; +mod document; +pub mod graph; +mod line_index; +pub mod semantics; +mod workspace; + +pub use self::{config::*, document::*, line_index::*, workspace::*}; diff --git a/support/texlab/src/util/line_index.rs b/support/texlab/crates/base-db/src/line_index.rs index 70e8f8128b..70e8f8128b 100644 --- a/support/texlab/src/util/line_index.rs +++ b/support/texlab/crates/base-db/src/line_index.rs diff --git a/support/texlab/crates/base-db/src/semantics.rs b/support/texlab/crates/base-db/src/semantics.rs new file mode 100644 index 0000000000..94a9c15973 --- /dev/null +++ b/support/texlab/crates/base-db/src/semantics.rs @@ -0,0 +1,17 @@ +pub mod auxiliary; +pub mod tex; + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub struct Span { + pub text: String, + pub range: rowan::TextRange, +} + +impl From<&syntax::latex::Key> for Span { + fn from(key: &syntax::latex::Key) -> Self { + Span { + text: key.to_string(), + range: syntax::latex::small_range(key), + } + } +} diff --git a/support/texlab/crates/base-db/src/semantics/auxiliary.rs b/support/texlab/crates/base-db/src/semantics/auxiliary.rs new file mode 100644 index 0000000000..719953974c --- /dev/null +++ b/support/texlab/crates/base-db/src/semantics/auxiliary.rs @@ -0,0 +1,39 @@ +use rowan::ast::AstNode; +use rustc_hash::FxHashMap; +use syntax::latex; + +#[derive(Debug, Clone, Default)] +pub struct Semantics { + pub label_numbers: FxHashMap<String, String>, +} + +impl Semantics { + pub fn process_root(&mut self, root: &latex::SyntaxNode) { + for node in root.descendants() { + self.process_node(&node); + } + } + + fn process_node(&mut self, node: &latex::SyntaxNode) { + if let Some(label_number) = latex::LabelNumber::cast(node.clone()) { + self.process_label_number(&label_number); + } + } + + fn process_label_number(&mut self, label_number: &latex::LabelNumber) { + let Some(name) = label_number + .name() + .and_then(|group| group.key()) + .map(|key| key.to_string()) else { return }; + + let Some(text) = label_number + .text() + .map(|node| node.syntax().descendants()) + .into_iter() + .flatten() + .find(|node| node.kind() == latex::TEXT || node.kind() == latex::MIXED_GROUP) + .map(|node| node.text().to_string()) else { return }; + + self.label_numbers.insert(name, text); + } +} diff --git a/support/texlab/crates/base-db/src/semantics/tex.rs b/support/texlab/crates/base-db/src/semantics/tex.rs new file mode 100644 index 0000000000..2b506ee878 --- /dev/null +++ b/support/texlab/crates/base-db/src/semantics/tex.rs @@ -0,0 +1,292 @@ +use rowan::{ast::AstNode, TextLen}; +use rustc_hash::FxHashSet; +use syntax::latex::{self, HasBrack, HasCurly}; +use text_size::TextRange; + +use super::Span; + +#[derive(Debug, Clone, Default)] +pub struct Semantics { + pub links: Vec<Link>, + pub labels: Vec<Label>, + pub commands: Vec<(TextRange, String)>, + pub environments: FxHashSet<String>, + pub theorem_definitions: Vec<TheoremDefinition>, + pub graphics_paths: FxHashSet<String>, + pub can_be_root: bool, + pub can_be_compiled: bool, +} + +impl Semantics { + pub fn process_root(&mut self, root: &latex::SyntaxNode) { + for node in root.descendants_with_tokens() { + match node { + latex::SyntaxElement::Node(node) => { + self.process_node(&node); + } + latex::SyntaxElement::Token(token) => { + if token.kind() == latex::COMMAND_NAME { + let range = token.text_range(); + let range = TextRange::new(range.start() + "\\".text_len(), range.end()); + let text = String::from(&token.text()[1..]); + self.commands.push((range, text)); + } + } + }; + } + + self.can_be_compiled = self.environments.contains("document"); + + self.can_be_root = self.can_be_compiled + && !self + .links + .iter() + .any(|link| link.kind == LinkKind::Cls && link.path.text == "subfiles"); + } + + fn process_node(&mut self, node: &latex::SyntaxNode) { + if let Some(include) = latex::Include::cast(node.clone()) { + self.process_include(include); + } else if let Some(import) = latex::Import::cast(node.clone()) { + self.process_import(import); + } else if let Some(label) = latex::LabelDefinition::cast(node.clone()) { + self.process_label_definition(label); + } else if let Some(label) = latex::LabelReference::cast(node.clone()) { + self.process_label_reference(label); + } else if let Some(label) = latex::LabelReferenceRange::cast(node.clone()) { + self.process_label_reference_range(label); + } else if let Some(environment) = latex::Environment::cast(node.clone()) { + self.process_environment(environment); + } else if let Some(theorem_def) = latex::TheoremDefinition::cast(node.clone()) { + self.process_theorem_definition(theorem_def); + } + } + + fn process_include(&mut self, include: latex::Include) { + let Some(list) = include.path_list() else { return }; + + for path in list.keys() { + let kind = match include.syntax().kind() { + latex::PACKAGE_INCLUDE => LinkKind::Sty, + latex::CLASS_INCLUDE => LinkKind::Cls, + latex::LATEX_INCLUDE => LinkKind::Tex, + latex::BIBLATEX_INCLUDE => LinkKind::Bib, + latex::BIBTEX_INCLUDE => LinkKind::Bib, + _ => continue, + }; + + self.links.push(Link { + kind, + path: Span::from(&path), + base_dir: None, + }); + } + } + + fn process_import(&mut self, import: latex::Import) { + let Some(mut base_dir) = import + .directory() + .and_then(|dir| dir.key()) + .map(|key| key.to_string()) else { return }; + + if !base_dir.ends_with('/') { + base_dir.push('/'); + } + + let Some(path) = import.file().and_then(|path| path.key()) else { return }; + + self.links.push(Link { + kind: LinkKind::Tex, + path: Span::from(&path), + base_dir: Some(base_dir), + }); + } + + fn process_label_definition(&mut self, label: latex::LabelDefinition) { + let Some(name) = label.name().and_then(|group| group.key()) else { return }; + + let mut objects = Vec::new(); + for node in label.syntax().ancestors() { + if let Some(section) = latex::Section::cast(node.clone()) { + let Some(text) = section.name().and_then(|group| group.content_text()) else { continue }; + let range = latex::small_range(§ion); + let prefix = String::from(match section.syntax().kind() { + latex::PART => "Part", + latex::CHAPTER => "Chapter", + latex::SECTION => "Section", + latex::SUBSECTION => "Subsection", + latex::SUBSUBSECTION => "Subsubsection", + latex::PARAGRAPH => "Paragraph", + latex::SUBPARAGRAPH => "Subparagraph", + _ => unreachable!(), + }); + + let kind = LabelObject::Section { prefix, text }; + objects.push(LabelTarget { + object: kind, + range, + }); + } else if let Some(environment) = latex::Environment::cast(node.clone()) { + let Some(name) = environment.begin() + .and_then(|begin| begin.name()) + .and_then(|group| group.key()) + .map(|key| key.to_string()) else { continue }; + + let caption = environment + .syntax() + .children() + .filter_map(latex::Caption::cast) + .find_map(|node| node.long()) + .and_then(|node| node.content_text()); + + let options = environment + .begin() + .and_then(|begin| begin.options()) + .and_then(|options| options.content_text()); + + let range = latex::small_range(&environment); + let kind = LabelObject::Environment { + name, + options, + caption, + }; + + objects.push(LabelTarget { + object: kind, + range, + }); + } else if let Some(enum_item) = latex::EnumItem::cast(node.clone()) { + let range = latex::small_range(&enum_item); + let kind = LabelObject::EnumItem; + objects.push(LabelTarget { + object: kind, + range, + }); + } + } + + self.labels.push(Label { + kind: LabelKind::Definition, + name: Span::from(&name), + targets: objects, + }); + } + + fn process_label_reference(&mut self, label: latex::LabelReference) { + let Some(name_list) = label.name_list() else { return }; + + for name in name_list.keys() { + self.labels.push(Label { + kind: LabelKind::Reference, + name: Span::from(&name), + targets: Vec::new(), + }); + } + } + + fn process_label_reference_range(&mut self, label: latex::LabelReferenceRange) { + if let Some(from) = label.from().and_then(|group| group.key()) { + self.labels.push(Label { + kind: LabelKind::ReferenceRange, + name: Span::from(&from), + targets: Vec::new(), + }); + } + + if let Some(to) = label.to().and_then(|group| group.key()) { + self.labels.push(Label { + kind: LabelKind::ReferenceRange, + name: Span::from(&to), + targets: Vec::new(), + }); + } + } + + fn process_environment(&mut self, environment: latex::Environment) { + let Some(name) = environment + .begin() + .and_then(|begin| begin.name()) + .and_then(|group| group.key()) else { return }; + + self.environments.insert(String::from(name.syntax().text())); + } + + fn process_theorem_definition(&mut self, theorem_def: latex::TheoremDefinition) { + let Some(name) = theorem_def.name().and_then(|name| name.key()) else { return }; + + let Some(description) = theorem_def + .description() + .and_then(|group| group.content_text()) else { return }; + + self.theorem_definitions.push(TheoremDefinition { + name: Span::from(&name), + description, + }); + } +} + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] +pub enum LinkKind { + Sty, + Cls, + Tex, + Bib, +} + +impl LinkKind { + pub fn extensions(self) -> &'static [&'static str] { + match self { + Self::Sty => &["sty"], + Self::Cls => &["cls"], + Self::Tex => &["tex"], + Self::Bib => &["bib"], + } + } +} + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub struct Link { + pub kind: LinkKind, + pub path: Span, + pub base_dir: Option<String>, +} + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] +pub enum LabelKind { + Definition, + Reference, + ReferenceRange, +} + +#[derive(Debug, Clone)] +pub struct Label { + pub kind: LabelKind, + pub name: Span, + pub targets: Vec<LabelTarget>, +} + +#[derive(Debug, Clone)] +pub struct LabelTarget { + pub object: LabelObject, + pub range: TextRange, +} + +#[derive(Debug, Clone)] +pub enum LabelObject { + Section { + prefix: String, + text: String, + }, + EnumItem, + Environment { + name: String, + options: Option<String>, + caption: Option<String>, + }, +} + +#[derive(Debug, Clone)] +pub struct TheoremDefinition { + pub name: Span, + pub description: String, +} diff --git a/support/texlab/crates/base-db/src/workspace.rs b/support/texlab/crates/base-db/src/workspace.rs new file mode 100644 index 0000000000..1872c33df1 --- /dev/null +++ b/support/texlab/crates/base-db/src/workspace.rs @@ -0,0 +1,302 @@ +use std::{ + borrow::{Borrow, Cow}, + path::{Path, PathBuf}, +}; + +use distro::{Distro, Language}; +use itertools::Itertools; +use rowan::{TextRange, TextSize}; +use rustc_hash::FxHashSet; +use url::Url; + +use crate::{graph, Config, Document, DocumentData, Owner}; + +#[derive(Debug, Default)] +pub struct Workspace { + documents: FxHashSet<Document>, + config: Config, + distro: Distro, + folders: Vec<PathBuf>, +} + +impl Workspace { + pub fn lookup<Q>(&self, key: &Q) -> Option<&Document> + where + Q: std::hash::Hash + Eq, + Document: Borrow<Q>, + { + self.documents.get(key) + } + + pub fn lookup_path(&self, path: &Path) -> Option<&Document> { + self.iter() + .find(|document| document.path.as_deref() == Some(path)) + } + + pub fn iter(&self) -> impl Iterator<Item = &Document> + '_ { + self.documents.iter() + } + + pub fn config(&self) -> &Config { + &self.config + } + + pub fn distro(&self) -> &Distro { + &self.distro + } + + pub fn open( + &mut self, + uri: Url, + text: String, + language: Language, + owner: Owner, + cursor: TextSize, + ) { + log::debug!("Opening document {uri}..."); + self.documents.remove(&uri); + self.documents.insert(Document::parse( + uri, + text, + language, + owner, + cursor, + &self.config, + )); + } + + pub fn load(&mut self, path: &Path, language: Language, owner: Owner) -> std::io::Result<()> { + log::debug!("Loading document {} from disk...", path.display()); + let uri = Url::from_file_path(path).unwrap(); + let data = std::fs::read(path)?; + let text = match String::from_utf8_lossy(&data) { + Cow::Borrowed(_) => unsafe { String::from_utf8_unchecked(data) }, + Cow::Owned(text) => text, + }; + + Ok(self.open(uri, text, language, owner, TextSize::default())) + } + + pub fn edit(&mut self, uri: &Url, delete: TextRange, insert: &str) -> Option<()> { + let document = self.lookup(uri)?; + let mut text = document.text.clone(); + text.replace_range(std::ops::Range::<usize>::from(delete), insert); + self.open( + document.uri.clone(), + text, + document.language, + Owner::Client, + delete.start(), + ); + + Some(()) + } + + pub fn watch( + &mut self, + watcher: &mut dyn notify::Watcher, + watched_dirs: &mut FxHashSet<PathBuf>, + ) { + self.iter() + .filter(|document| document.uri.scheme() == "file") + .flat_map(|document| { + let dir1 = self.output_dir(&self.current_dir(&document.dir)); + let dir2 = &document.dir; + [dir1.to_file_path(), dir2.to_file_path()] + }) + .flatten() + .for_each(|path| { + if !watched_dirs.contains(&path) { + let _ = watcher.watch(&path, notify::RecursiveMode::NonRecursive); + watched_dirs.insert(path); + } + }); + } + + pub fn current_dir(&self, base_dir: &Url) -> Url { + let root_dir = self.config.root_dir.as_deref(); + if let Some(dir) = root_dir.and_then(|path| base_dir.join(path).ok()) { + return dir; + } + + self.iter() + .filter(|document| matches!(document.data, DocumentData::Root | DocumentData::Tectonic)) + .flat_map(|document| document.uri.join(".")) + .find(|root_dir| base_dir.as_str().starts_with(root_dir.as_str())) + .unwrap_or_else(|| base_dir.clone()) + } + + pub fn output_dir(&self, base_dir: &Url) -> Url { + let mut path = self.config.build.output_dir.clone(); + if !path.ends_with('/') { + path.push('/'); + } + + base_dir.join(&path).unwrap_or_else(|_| base_dir.clone()) + } + + pub fn contains(&self, path: &Path) -> bool { + if self.folders.is_empty() { + return true; + } + + self.folders.iter().any(|dir| path.starts_with(dir)) + } + + pub fn project(&self, child: &Document) -> Project { + let mut documents = FxHashSet::default(); + for graph in self + .iter() + .map(|start| graph::Graph::new(self, start)) + .filter(|graph| graph.preorder().contains(&child)) + { + documents.extend(graph.preorder()); + } + + Project { documents } + } + + pub fn parents(&self, child: &Document) -> FxHashSet<&Document> { + self.iter() + .filter(|document| { + let DocumentData::Tex(data) = &document.data else { return false }; + data.semantics.can_be_root + }) + .filter(|parent| { + let graph = graph::Graph::new(self, parent); + let mut nodes = graph.preorder(); + nodes.contains(&child) + }) + .collect() + } + + pub fn set_config(&mut self, config: Config) { + self.config = config; + self.reload(); + } + + pub fn set_distro(&mut self, distro: Distro) { + self.distro = distro; + self.reload(); + } + + pub fn set_folders(&mut self, folders: Vec<PathBuf>) { + self.folders = folders; + } + + pub fn set_cursor(&mut self, uri: &Url, cursor: TextSize) -> Option<()> { + let mut document = self.lookup(uri)?.clone(); + document.cursor = cursor; + self.documents.insert(document); + Some(()) + } + + pub fn reload(&mut self) { + let uris = self + .documents + .iter() + .filter(|document| document.language == Language::Tex) + .map(|document| document.uri.clone()) + .collect::<Vec<Url>>(); + + for uri in uris { + let document = self.lookup(&uri).unwrap(); + self.open( + uri, + document.text.clone(), + document.language, + document.owner, + document.cursor, + ); + } + } + + pub fn remove(&mut self, uri: &Url) { + self.documents.remove(uri); + } + + pub fn close(&mut self, uri: &Url) -> Option<()> { + let mut document = self.lookup(uri)?.clone(); + document.owner = Owner::Server; + self.documents.insert(document); + Some(()) + } + + pub fn discover(&mut self) { + loop { + let mut changed = false; + changed |= self.discover_parents(); + changed |= self.discover_children(); + if !changed { + break; + } + } + } + + fn discover_parents(&mut self) -> bool { + let dirs = self + .iter() + .filter_map(|document| document.path.as_deref()) + .flat_map(|path| path.ancestors().skip(1)) + .filter(|path| self.contains(path)) + .map(|path| path.to_path_buf()) + .collect::<FxHashSet<_>>(); + + let mut changed = false; + for dir in dirs { + if self + .iter() + .filter(|document| matches!(document.language, Language::Root | Language::Tectonic)) + .filter_map(|document| document.path.as_deref()) + .filter_map(|path| path.parent()) + .any(|marker| dir.starts_with(marker)) + { + continue; + } + + let Ok(entries) = std::fs::read_dir(dir) else { continue }; + + for file in entries + .flatten() + .filter(|entry| entry.file_type().map_or(false, |type_| type_.is_file())) + .map(|entry| entry.path()) + { + let Some(lang) = Language::from_path(&file) else { continue }; + if !matches!(lang, Language::Tex | Language::Root | Language::Tectonic) { + continue; + } + + if self.lookup_path(&file).is_none() { + changed |= self.load(&file, lang, Owner::Server).is_ok(); + } + } + } + + changed + } + + fn discover_children(&mut self) -> bool { + let paths = self + .iter() + .map(|start| graph::Graph::new(self, start)) + .flat_map(|graph| graph.missing) + .filter(|uri| uri.scheme() == "file") + .flat_map(|uri| uri.to_file_path()) + .collect::<FxHashSet<_>>(); + + let mut changed = false; + for path in paths { + let language = Language::from_path(&path).unwrap_or(Language::Tex); + if self.lookup_path(&path).is_none() { + changed |= self.load(&path, language, Owner::Server).is_ok(); + } + } + + changed + } +} + +#[derive(Debug)] +pub struct Project<'a> { + pub documents: FxHashSet<&'a Document>, +} diff --git a/support/texlab/crates/citeproc/Cargo.toml b/support/texlab/crates/citeproc/Cargo.toml new file mode 100644 index 0000000000..353292c484 --- /dev/null +++ b/support/texlab/crates/citeproc/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "citeproc" +version = "0.0.0" +license.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] +chrono = { version = "0.4.24", default-features = false, features = ["std"] } +human_name = "2.0.1" +isocountry = "0.3.2" +itertools = "0.10.5" +rowan = "0.15.11" +rustc-hash = "1.1.0" +syntax = { path = "../syntax" } +titlecase = "2.2.1" +unicode-normalization = "0.1.22" +url = "2.3.1" + +[lib] +doctest = false + +[dev-dependencies] +insta = "1.29.0" +parser = { path = "../parser" } diff --git a/support/texlab/src/citation/driver.rs b/support/texlab/crates/citeproc/src/driver.rs index ab3fe6d80f..af09b9ed32 100644 --- a/support/texlab/src/citation/driver.rs +++ b/support/texlab/crates/citeproc/src/driver.rs @@ -1,9 +1,8 @@ use isocountry::CountryCode; use itertools::Itertools; -use lsp_types::Url; +use syntax::bibtex; use titlecase::titlecase; - -use crate::syntax::bibtex; +use url::Url; use super::{ entry::{EntryData, EntryKind}, diff --git a/support/texlab/src/citation/entry.rs b/support/texlab/crates/citeproc/src/entry.rs index 1fee032488..e29864e2c2 100644 --- a/support/texlab/src/citation/entry.rs +++ b/support/texlab/crates/citeproc/src/entry.rs @@ -1,9 +1,5 @@ -use std::str::FromStr; - use rustc_hash::FxHashMap; -use strum::EnumString; - -use crate::syntax::bibtex::{Entry, Field, HasName, HasType, HasValue, Value}; +use syntax::bibtex::{Entry, Field, HasName, HasType, HasValue, Value}; use super::field::{ author::{AuthorField, AuthorFieldData}, @@ -12,8 +8,7 @@ use super::field::{ text::{TextField, TextFieldData}, }; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, EnumString)] -#[strum(ascii_case_insensitive)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum EntryKind { Article, Book, @@ -52,6 +47,48 @@ pub enum EntryKind { Unknown, } +impl EntryKind { + pub fn parse(input: &str) -> Self { + match input.to_ascii_lowercase().as_str() { + "article" => Self::Article, + "book" => Self::Book, + "mvbook" => Self::MVBook, + "inbook" => Self::InBook, + "bookinbook" => Self::BookInBook, + "suppbook" => Self::SuppBook, + "booklet" => Self::Booklet, + "collection" => Self::Collection, + "mvcollection" => Self::MVCollection, + "incollection" => Self::InCollection, + "suppcollection" => Self::SuppCollection, + "dataset" => Self::DataSet, + "manual" => Self::Manual, + "misc" => Self::Misc, + "online" => Self::Online, + "electronic" => Self::Electronic, + "www" => Self::Www, + "patent" => Self::Patent, + "periodical" => Self::Periodical, + "suppperiodical" => Self::SuppPeriodical, + "proceedings" => Self::Proceedings, + "mvproceedings" => Self::MVProceedings, + "inproceedings" => Self::InProceedings, + "conference" => Self::Conference, + "reference" => Self::Reference, + "mvreference" => Self::MVReference, + "inreference" => Self::InReference, + "report" => Self::Report, + "set" => Self::Set, + "software" => Self::Software, + "thesis" => Self::Thesis, + "masterthesis" => Self::MasterThesis, + "phdthesis" => Self::PhdThesis, + "techreport" => Self::TechReport, + _ => Self::Unknown, + } + } +} + impl Default for EntryKind { fn default() -> Self { Self::Unknown @@ -70,10 +107,9 @@ pub struct EntryData { impl From<&Entry> for EntryData { fn from(entry: &Entry) -> Self { let mut data = EntryData { - kind: entry - .type_token() - .and_then(|token| EntryKind::from_str(&token.text()[1..]).ok()) - .unwrap_or(EntryKind::Unknown), + kind: entry.type_token().map_or(EntryKind::Unknown, |token| { + EntryKind::parse(&token.text()[1..]) + }), ..EntryData::default() }; diff --git a/support/texlab/src/citation/field.rs b/support/texlab/crates/citeproc/src/field.rs index d9f3adacab..d9f3adacab 100644 --- a/support/texlab/src/citation/field.rs +++ b/support/texlab/crates/citeproc/src/field.rs diff --git a/support/texlab/src/citation/field/author.rs b/support/texlab/crates/citeproc/src/field/author.rs index a0e4120559..d8576cbaa4 100644 --- a/support/texlab/src/citation/field/author.rs +++ b/support/texlab/crates/citeproc/src/field/author.rs @@ -1,15 +1,12 @@ -use std::{borrow::Cow, fmt, str::FromStr}; +use std::{borrow::Cow, fmt}; use human_name::Name; use itertools::Itertools; -use strum::EnumString; - -use crate::syntax::bibtex::Value; +use syntax::bibtex::Value; use super::text::TextFieldData; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, EnumString)] -#[strum(ascii_case_insensitive)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum AuthorField { Afterword, Annotator, @@ -26,7 +23,20 @@ pub enum AuthorField { impl AuthorField { pub fn parse(input: &str) -> Option<Self> { - Self::from_str(input).ok() + Some(match input.to_ascii_lowercase().as_str() { + "afterword" => Self::Afterword, + "annotator" => Self::Annotator, + "author" => Self::Author, + "commentator" => Self::Commentator, + "editor" => Self::Editor, + "editora" => Self::EditorA, + "editorb" => Self::EditorB, + "editorc" => Self::EditorC, + "foreword" => Self::Foreword, + "introduction" => Self::Introduction, + "translator" => Self::Translator, + _ => return None, + }) } } diff --git a/support/texlab/src/citation/field/date.rs b/support/texlab/crates/citeproc/src/field/date.rs index 4eba9cdea4..8e2c0b7d72 100644 --- a/support/texlab/src/citation/field/date.rs +++ b/support/texlab/crates/citeproc/src/field/date.rs @@ -1,14 +1,11 @@ use std::{fmt, ops::Add, str::FromStr}; use chrono::{Datelike, Month, NaiveDate}; -use strum::EnumString; - -use crate::syntax::bibtex::Value; +use syntax::bibtex::Value; use super::text::TextFieldData; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, EnumString)] -#[strum(ascii_case_insensitive)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum DateField { Date, EventDate, @@ -19,7 +16,14 @@ pub enum DateField { impl DateField { pub fn parse(input: &str) -> Option<Self> { - Self::from_str(input).ok() + Some(match input.to_ascii_lowercase().as_str() { + "date" => Self::Date, + "eventdate" => Self::EventDate, + "month" => Self::Month, + "urldate" => Self::UrlDate, + "year" => Self::Year, + _ => return None, + }) } } diff --git a/support/texlab/src/citation/field/number.rs b/support/texlab/crates/citeproc/src/field/number.rs index ad892c879f..227f3d5b75 100644 --- a/support/texlab/src/citation/field/number.rs +++ b/support/texlab/crates/citeproc/src/field/number.rs @@ -1,13 +1,10 @@ -use std::{fmt, str::FromStr}; +use std::fmt; -use strum::EnumString; - -use crate::syntax::bibtex::Value; +use syntax::bibtex::Value; use super::text::TextFieldData; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, EnumString)] -#[strum(ascii_case_insensitive)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum NumberField { Edition, Number, @@ -20,7 +17,16 @@ pub enum NumberField { impl NumberField { pub fn parse(input: &str) -> Option<Self> { - Self::from_str(input).ok() + Some(match input.to_ascii_lowercase().as_str() { + "edition" => Self::Edition, + "number" => Self::Number, + "pages" => Self::Pages, + "pagetotal" => Self::PageTotal, + "part" => Self::Part, + "volume" => Self::Volume, + "volumes" => Self::Volumes, + _ => return None, + }) } } diff --git a/support/texlab/src/citation/field/text.rs b/support/texlab/crates/citeproc/src/field/text.rs index 9b3a0b02b2..9689264779 100644 --- a/support/texlab/src/citation/field/text.rs +++ b/support/texlab/crates/citeproc/src/field/text.rs @@ -1,16 +1,12 @@ -use std::str::FromStr; - use rowan::{ast::AstNode, NodeOrToken}; use rustc_hash::FxHashSet; -use strum::EnumString; -use crate::syntax::bibtex::{ +use syntax::bibtex::{ Accent, Command, CurlyGroup, HasAccentName, HasCommandName, HasName, HasValue, HasWord, Join, Literal, QuoteGroup, Root, SyntaxKind::*, SyntaxToken, Value, }; -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, EnumString)] -#[strum(ascii_case_insensitive)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum TextField { Abstract, Addendum, @@ -63,7 +59,56 @@ pub enum TextField { impl TextField { pub fn parse(input: &str) -> Option<Self> { - Self::from_str(input).ok() + Some(match input.to_ascii_lowercase().as_str() { + "abstract" => Self::Abstract, + "addendum" => Self::Addendum, + "booksubtitle" => Self::BookSubtitle, + "booktitle" => Self::BookTitle, + "booktitleaddon" => Self::BookTitleAddon, + "chapter" => Self::Chapter, + "doi" => Self::Doi, + "editortype" => Self::EditorType, + "editortypea" => Self::EditorTypeA, + "editortypeb" => Self::EditorTypeB, + "editortypec" => Self::EditorTypeC, + "eid" => Self::Eid, + "eprint" => Self::Eprint, + "eprintclass" => Self::EprintClass, + "eprinttype" => Self::EprintType, + "eventtitle" => Self::EventTitle, + "eventtitleaddon" => Self::EventTitleAddon, + "holder" => Self::Holder, + "howpublished" => Self::HowPublished, + "isbn" => Self::Isbn, + "issn" => Self::Issn, + "issue" => Self::Issue, + "issuesubtitle" => Self::IssueSubtitle, + "issuetitle" => Self::IssueTitle, + "issuetitleaddon" => Self::IssueTitleAddon, + "journal" => Self::Journal, + "journalsubtitle" => Self::JournalSubtitle, + "journaltitle" => Self::JournalTitle, + "journaltitleaddon" => Self::JournalTitleAddon, + "language" => Self::Language, + "location" => Self::Location, + "maintitle" => Self::MainTitle, + "mainsubtitle" => Self::MainSubtitle, + "maintitleaddon" => Self::MainTitleAddon, + "note" => Self::Note, + "origlanguage" => Self::OrigLanguage, + "publisher" => Self::Publisher, + "pubstate" => Self::Pubstate, + "series" => Self::Series, + "subtitle" => Self::Subtitle, + "title" => Self::Title, + "titleaddon" => Self::TitleAddon, + "type" => Self::Type, + "unknown" => Self::Unknown, + "url" => Self::Url, + "venue" => Self::Venue, + "version" => Self::Version, + _ => return None, + }) } } diff --git a/support/texlab/src/citation.rs b/support/texlab/crates/citeproc/src/lib.rs index cb6c5c3623..1e0ac6b070 100644 --- a/support/texlab/src/citation.rs +++ b/support/texlab/crates/citeproc/src/lib.rs @@ -1,12 +1,11 @@ mod driver; mod entry; -pub(crate) mod field; +pub mod field; mod output; +use syntax::bibtex; use unicode_normalization::UnicodeNormalization; -use crate::syntax::bibtex; - use self::{driver::Driver, output::Inline}; #[must_use] diff --git a/support/texlab/src/citation/output.rs b/support/texlab/crates/citeproc/src/output.rs index 2fc8a02361..2fc8a02361 100644 --- a/support/texlab/src/citation/output.rs +++ b/support/texlab/crates/citeproc/src/output.rs diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_aksin_2006.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_aksin_2006.snap index 4598d47ed9..72c0c5e41a 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_aksin_2006.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_aksin_2006.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 64 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@string{jomch = {J.~Organomet. Chem.}}\n\n@article{aksin,\n author = {Aks{\\i}n, {\\\"O}zge and T{\\\"u}rkmen, Hayati and Artok, Levent\n and {\\c{C}}etinkaya, Bekir and Ni, Chaoying and\n B{\\\"u}y{\\\"u}kg{\\\"u}ng{\\\"o}r, Orhan and {\\\"O}zkal, Erhan},\n title = {Effect of immobilization on catalytic characteristics of\n saturated {Pd-N}-heterocyclic carbenes in {Mizoroki-Heck}\n reactions},\n journaltitle = jomch,\n date = 2006,\n volume = 691,\n number = 13,\n pages = {3027-3036},\n indextitle = {Effect of immobilization on catalytic characteristics},\n}\"#)" --- O. Aksın, H. Türkmen, L. Artok, B. Çetinkaya, C. Ni, O. Büyükgüngör, E. Özkal: "Effect of immobilization on catalytic characteristics of saturated Pd-N-heterocyclic carbenes in Mizoroki-Heck reactions". *J. Organomet. Chem.* 691.13 (2006): 3027-3036. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_betram_1996.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_betram_1996.snap index dd857419a5..1ae89dd711 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_betram_1996.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_betram_1996.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 87 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@string{jams = {J.~Amer. Math. Soc.}}\n\n@article{bertram,\n author = {Bertram, Aaron and Wentworth, Richard},\n title = {Gromov invariants for holomorphic maps on {Riemann} surfaces},\n journaltitle = jams,\n date = 1996,\n volume = 9,\n number = 2,\n pages = {529-571},\n langid = {english},\n langidopts = {variant=american},\n shorttitle = {Gromov invariants},\n annotation = {An \\texttt{article} entry with a \\texttt{volume} and a\n \\texttt{number} field},\n}\"#)" --- A. Bertram, R. Wentworth: "Gromov invariants for holomorphic maps on Riemann surfaces". *J. Amer. Math. Soc.* 9.2 (1996): 529-571. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_blom_2021.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_blom_2021.snap index 851b874fff..0e841a20a9 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_blom_2021.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_blom_2021.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 138 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@article{DBLP:journals/corr/abs-2107-11903,\n author = {Michelle L. Blom and\n Jurlind Budurushi and\n Ronald L. Rivest and\n Philip B. Stark and\n Peter J. Stuckey and\n Vanessa Teague and\n Damjan Vukcevic},\n title = {Assertion-based Approaches to Auditing Complex Elections, with application\n to party-list proportional elections},\n journal = {CoRR},\n volume = {abs/2107.11903},\n year = {2021},\n url = {https://arxiv.org/abs/2107.11903},\n eprinttype = {arXiv},\n eprint = {2107.11903},\n timestamp = {Thu, 29 Jul 2021 16:14:15 +0200},\n biburl = {https://dblp.org/rec/journals/corr/abs-2107-11903.bib},\n bibsource = {dblp computer science bibliography, https://dblp.org}\n}\"#)" --- M. Blom, J. Budurushi, R. Rivest, P. Stark, P. Stuckey, V. Teague, D. Vukcevic: "Assertion-based Approaches to Auditing Complex Elections, with application to party-list proportional elections". *CoRR* abs/2107.11903 (2021): arXiv: [2107.11903](https://arxiv.org/abs/2107.11903). URL: [https://arxiv.org/abs/2107.11903](https://arxiv.org/abs/2107.11903). diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_jain_1999.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_jain_1999.snap index 2eefc3a871..6ae38a25e5 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_jain_1999.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_jain_1999.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 39 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@article{10.1145/331499.331504,\n author = {Jain, A. K. and Murty, M. N. and Flynn, P. J.},\n title = {Data Clustering: A Review},\n year = {1999},\n issue_date = {Sept. 1999},\n publisher = {Association for Computing Machinery},\n address = {New York, NY, USA},\n volume = {31},\n number = {3},\n issn = {0360-0300},\n url = {https://doi.org/10.1145/331499.331504},\n doi = {10.1145/331499.331504},\n journal = {ACM Comput. Surv.},\n month = {sep},\n pages = {264-323},\n numpages = {60},\n keywords = {incremental clustering, clustering applications, exploratory data analysis, cluster analysis, similarity indices, unsupervised learning}\n}\"#)" --- A. Jain, M. Murty, P. Flynn: "Data Clustering: A Review". *ACM Comput. Surv.* 31.3 (Sep. 1999): 264-323. ISSN: 0360-0300. DOI: [10.1145/331499.331504](https://doi.org/10.1145/331499.331504). URL: [https://doi.org/10.1145/331499.331504](https://doi.org/10.1145/331499.331504). diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_kastenholz_2006.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_kastenholz_2006.snap index d1cae5db36..8abd770d8f 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_kastenholz_2006.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_kastenholz_2006.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 110 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@string{jchph = {J.~Chem. Phys.}}\n\n@article{kastenholz,\n author = {Kastenholz, M. A. and H{\\\"u}nenberger, Philippe H.},\n title = {Computation of methodology\\hyphen independent ionic solvation\n free energies from molecular simulations},\n journaltitle = jchph,\n date = 2006,\n subtitle = {{I}. {The} electrostatic potential in molecular liquids},\n volume = 124,\n eid = 124106,\n doi = {10.1063/1.2172593},\n langid = {english},\n langidopts = {variant=american},\n indextitle = {Computation of ionic solvation free energies},\n annotation = {An \\texttt{article} entry with an \\texttt{eid} and a\n \\texttt{doi} field. Note that the \\textsc{doi} is transformed\n into a clickable link if \\texttt{hyperref} support has been\n enabled},\n}\n \"#)" --- M. Kastenholz, P. Hünenberger: "Computation of methodology- independent ionic solvation free energies from molecular simulations. I. The electrostatic potential in molecular liquids". *J. Chem. Phys.* 124, 124106 (2006): DOI: [10.1063/1.2172593](https://doi.org/10.1063/1.2172593). diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_rivest_1978.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_rivest_1978.snap index 3dfcb2967c..64b9784479 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__article_rivest_1978.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__article_rivest_1978.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 15 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@article{10.1145/359340.359342,\n author = {Rivest, R. L. and Shamir, A. and Adleman, L.},\n title = {A Method for Obtaining Digital Signatures and Public-Key Cryptosystems},\n year = {1978},\n issue_date = {Feb. 1978},\n publisher = {Association for Computing Machinery},\n address = {New York, NY, USA},\n volume = {21},\n number = {2},\n issn = {0001-0782},\n url = {https://doi.org/10.1145/359340.359342},\n doi = {10.1145/359340.359342},\n journal = {Commun. ACM},\n month = {feb},\n pages = {120-126},\n numpages = {7},\n}\"#)" --- R. Rivest, A. Shamir, L. Adleman: "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems". *Commun. ACM* 21.2 (Feb. 1978): 120-126. ISSN: 0001-0782. DOI: [10.1145/359340.359342](https://doi.org/10.1145/359340.359342). URL: [https://doi.org/10.1145/359340.359342](https://doi.org/10.1145/359340.359342). diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__book_aho_2006.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_aho_2006.snap index 34c0aeda3b..b168edc665 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__book_aho_2006.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_aho_2006.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 165 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@book{10.5555/1177220,\n author = {Aho, Alfred V. and Lam, Monica S. and Sethi, Ravi and Ullman, Jeffrey D.},\n title = {Compilers: Principles, Techniques, and Tools (2nd Edition)},\n year = {2006},\n isbn = {0321486811},\n publisher = {Addison-Wesley Longman Publishing Co., Inc.},\n address = {USA}\n}\"#)" --- A. Aho, M. Lam, R. Sethi, J. Ullman: "Compilers: Principles, Techniques, and Tools (2nd Edition)". Addison-Wesley Longman Publishing Co., Inc., 2006. ISBN: 0321486811. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__book_averroes_1998.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_averroes_1998.snap index 32b8a6ca5f..e03caa723e 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__book_averroes_1998.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_averroes_1998.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 180 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@book{averroes/bland,\n author = {Averroes},\n title = {The Epistle on the Possibility of Conjunction with the Active\n Intellect by {Ibn Rushd} with the Commentary of {Moses Narboni}},\n date = 1982,\n editor = {Bland, Kalman P.},\n translator = {Bland, Kalman P.},\n series = {Moreshet: Studies in {Jewish} History, Literature and Thought},\n number = 7,\n publisher = {Jewish Theological Seminary of America},\n location = {New York},\n keywords = {primary},\n langid = {english},\n langidopts = {variant=american},\n indextitle = {Epistle on the Possibility of Conjunction, The},\n shorttitle = {Possibility of Conjunction},\n annotation = {A \\texttt{book} entry with a \\texttt{series} and a\n \\texttt{number}. Note the concatenation of the \\texttt{editor}\n and \\texttt{translator} fields as well as the\n \\texttt{indextitle} field},\n}\"#)" --- "The Epistle on the Possibility of Conjunction with the Active Intellect by Ibn Rushd with the Commentary of Moses Narboni". Ed. by K. Bland. Trans. by K. Bland. Moreshet: Studies in Jewish History, Literature and Thought 7. New York: Jewish Theological Seminary of America, 1982. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__book_knuth_1984.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_knuth_1984.snap index 0276be0589..a15a63167d 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__book_knuth_1984.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__book_knuth_1984.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 208 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@book{knuth:ct:a,\n author = {Knuth, Donald E.},\n title = {The {\\TeX book}},\n date = 1984,\n maintitle = {Computers \\& Typesetting},\n volume = {A},\n publisher = {Addison-Wesley},\n location = {Reading, Mass.},\n langid = {english},\n langidopts = {variant=american},\n sorttitle = {Computers & Typesetting A},\n indexsorttitle= {The TeXbook},\n indextitle = {\\protect\\TeX book, The},\n shorttitle = {\\TeX book},\n annotation = {The first volume of a five-volume book. Note the\n \\texttt{sorttitle} field. We want this\n volume to be listed after the entry referring to the entire\n five-volume set. Also note the \\texttt{indextitle} and\n \\texttt{indexsorttitle} fields. Indexing packages that don't\n generate robust index entries require some control sequences\n to be protected from expansion},\n}\n \"#)" --- D. Knuth: "The TeX book". *Computers & Typesetting*. Vol. A. Reading, Mass.: Addison-Wesley, 1984. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__collection_matuz_1990.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__collection_matuz_1990.snap index 9ea78c80cf..0112a28139 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__collection_matuz_1990.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__collection_matuz_1990.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 313 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@collection{matuz:doody,\n editor = {Matuz, Roger},\n title = {Contemporary Literary Criticism},\n year = 1990,\n volume = 61,\n publisher = {Gale},\n location = {Detroit},\n pages = {204-208},\n langid = {english},\n langidopts = {variant=american},\n annotation = {A \\texttt{collection} entry providing the excerpt information\n for the \\texttt{doody} entry. Note the format of the\n \\texttt{pages} field},\n}\"#)" --- "Contemporary Literary Criticism". Ed. by R. Matuz. Vol. 61. Detroit: Gale, 1990, 204-208. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__inproceedings_combi_2004.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__inproceedings_combi_2004.snap index 9baef38be7..e4d3959d92 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__inproceedings_combi_2004.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__inproceedings_combi_2004.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 290 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@inproceedings{10.1145/967900.968040,\n author = {Combi, Carlo and Pozzi, Giuseppe},\n title = {Architectures for a Temporal Workflow Management System},\n year = {2004},\n isbn = {1581138121},\n publisher = {Association for Computing Machinery},\n address = {New York, NY, USA},\n url = {https://doi.org/10.1145/967900.968040},\n doi = {10.1145/967900.968040},\n booktitle = {Proceedings of the 2004 ACM Symposium on Applied Computing},\n pages = {659-666},\n numpages = {8},\n keywords = {active DBMS, temporal DBMS, workflow management system - WfMS, temporal workflow management system},\n location = {Nicosia, Cyprus},\n series = {SAC '04}\n}\"#)" --- C. Combi, G. Pozzi: "Architectures for a Temporal Workflow Management System". *Proceedings of the 2004 ACM Symposium on Applied Computing*. SAC '04. Nicosia, Cyprus: Association for Computing Machinery, 2004, 659-666. ISBN: 1581138121. DOI: [10.1145/967900.968040](https://doi.org/10.1145/967900.968040). URL: [https://doi.org/10.1145/967900.968040](https://doi.org/10.1145/967900.968040). diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__inproceedings_erwin_2007.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__inproceedings_erwin_2007.snap index df9ab6569f..f544f35573 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__inproceedings_erwin_2007.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__inproceedings_erwin_2007.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 269 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@inproceedings{10.5555/1386993.1386994,\n author = {Erwin, Alva and Gopalan, Raj P. and Achuthan, N. R.},\n title = {A Bottom-up Projection Based Algorithm for Mining High Utility Itemsets},\n year = {2007},\n isbn = {9781920682651},\n publisher = {Australian Computer Society, Inc.},\n address = {AUS},\n booktitle = {Proceedings of the 2nd International Workshop on Integrating Artificial Intelligence and Data Mining - Volume 84},\n pages = {3-11},\n numpages = {9},\n keywords = {pattern growth, high utility itemset mining},\n location = {Gold Coast, Australia},\n series = {AIDM '07}\n}\"#)" --- A. Erwin, R. Gopalan, N. Achuthan: "A Bottom-up Projection Based Algorithm for Mining High Utility Itemsets". *Proceedings of the 2nd International Workshop on Integrating Artificial Intelligence and Data Mining - Volume 84*. AIDM '07. Gold Coast, Australia: Australian Computer Society, Inc., 2007, 3-11. ISBN: 9781920682651. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__mvbook_nietzsche_1988.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__mvbook_nietzsche_1988.snap index 5162b3114b..d86268cd90 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__mvbook_nietzsche_1988.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__mvbook_nietzsche_1988.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 238 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@string{dtv = {Deutscher Taschenbuch-Verlag}}\n\n@mvbook{nietzsche:ksa,\n author = {Nietzsche, Friedrich},\n title = {S{\\\"a}mtliche Werke},\n date = 1988,\n editor = {Colli, Giorgio and Montinari, Mazzino},\n edition = 2,\n volumes = 15,\n publisher = dtv # { and Walter de Gruyter},\n location = {M{\\\"u}nchen and Berlin and New York},\n langid = {german},\n sorttitle = {Werke-00-000},\n indexsorttitle= {Samtliche Werke},\n subtitle = {Kritische Studienausgabe},\n annotation = {The critical edition of Nietzsche's works. This is a\n \\texttt{mvbook} entry referring to a 15-volume work as a\n whole. Note the \\texttt{volumes} field and the format of the\n \\texttt{publisher} and \\texttt{location} fields in the\n database file. Also note the \\texttt{sorttitle} and\n field which is used to fine-tune the\n sorting order of the bibliography. We want this item listed\n first in the bibliography},\n}\"#)" --- F. Nietzsche: "Sämtliche Werke. Kritische Studienausgabe". Ed. by G. Colli, M. Montinari. 2nd. München and Berlin and New York: Deutscher Taschenbuch-Verlag and Walter de Gruyter, 1988. diff --git a/support/texlab/src/citation/snapshots/texlab__citation__tests__patent_almendro_1998.snap b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__patent_almendro_1998.snap index 6f8c17f059..6cf8b39462 100644 --- a/support/texlab/src/citation/snapshots/texlab__citation__tests__patent_almendro_1998.snap +++ b/support/texlab/crates/citeproc/src/snapshots/citeproc__tests__patent_almendro_1998.snap @@ -1,6 +1,5 @@ --- -source: src/citation/tests.rs -assertion_line: 334 +source: crates/citeproc/src/tests.rs expression: "render_entry(r#\"\n@patent{almendro,\n author = {Almendro, Jos{\\'e} L. and Mart{\\'i}n, Jacinto and S{\\'a}nchez,\n Alberto and Nozal, Fernando},\n title = {Elektromagnetisches Signalhorn},\n number = {EU-29702195U},\n date = 1998,\n location = {countryfr and countryuk and countryde},\n langid = {german},\n annotation = {This is a \\texttt{patent} entry with a \\texttt{location}\n field. The number is given in the \\texttt{number} field. Note\n the format of the \\texttt{location} field in the database\n file. Compare \\texttt{laufenberg}, \\texttt{sorace}, and\n \\texttt{kowalik}},\n}\"#)" --- J. Almendro, J. Martín, A. Sánchez, F. Nozal: "Elektromagnetisches Signalhorn". EU-29702195U (France and United Kingdom and Germany). 1998. diff --git a/support/texlab/src/citation/tests.rs b/support/texlab/crates/citeproc/src/tests.rs index 6caff1add0..a125afd695 100644 --- a/support/texlab/src/citation/tests.rs +++ b/support/texlab/crates/citeproc/src/tests.rs @@ -1,7 +1,7 @@ use insta::assert_snapshot; +use parser::parse_bibtex; use rowan::ast::AstNode; - -use crate::{parser::parse_bibtex, syntax::bibtex}; +use syntax::bibtex; fn render_entry(input: &str) -> String { let green = parse_bibtex(input); diff --git a/support/texlab/crates/distro/Cargo.toml b/support/texlab/crates/distro/Cargo.toml new file mode 100644 index 0000000000..b450aa2631 --- /dev/null +++ b/support/texlab/crates/distro/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "distro" +version = "0.0.0" +license.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] +anyhow = "1.0.70" +rustc-hash = "1.1.0" + +[lib] +doctest = false diff --git a/support/texlab/src/distro/file_name_db.rs b/support/texlab/crates/distro/src/file_name_db.rs index 9234d0a3f9..750ed11e68 100644 --- a/support/texlab/src/distro/file_name_db.rs +++ b/support/texlab/crates/distro/src/file_name_db.rs @@ -6,7 +6,7 @@ use std::{ use anyhow::Result; use rustc_hash::FxHashSet; -use crate::db::Language; +use crate::Language; #[derive(Debug)] pub struct DistroFile(PathBuf); diff --git a/support/texlab/src/distro/kpsewhich.rs b/support/texlab/crates/distro/src/kpsewhich.rs index 24f4a3531a..24f4a3531a 100644 --- a/support/texlab/src/distro/kpsewhich.rs +++ b/support/texlab/crates/distro/src/kpsewhich.rs diff --git a/support/texlab/crates/distro/src/language.rs b/support/texlab/crates/distro/src/language.rs new file mode 100644 index 0000000000..207b700581 --- /dev/null +++ b/support/texlab/crates/distro/src/language.rs @@ -0,0 +1,42 @@ +use std::path::Path; + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] +pub enum Language { + Tex, + Bib, + Aux, + Log, + Root, + Tectonic, +} + +impl Language { + pub fn from_path(path: &Path) -> Option<Self> { + let name = path.file_name()?; + if name.eq_ignore_ascii_case(".texlabroot") || name.eq_ignore_ascii_case("texlabroot") { + return Some(Self::Root); + } + + if name.eq_ignore_ascii_case("Tectonic.toml") { + return Some(Self::Tectonic); + } + + let extname = path.extension()?.to_str()?; + match extname.to_lowercase().as_str() { + "tex" | "sty" | "cls" | "def" | "lco" | "rnw" => Some(Self::Tex), + "bib" | "bibtex" => Some(Self::Bib), + "aux" => Some(Self::Aux), + "log" => Some(Self::Log), + _ => None, + } + } + + pub fn from_id(id: &str) -> Option<Self> { + match id { + "tex" | "latex" => Some(Self::Tex), + "bib" | "bibtex" => Some(Self::Bib), + "texlabroot" => Some(Self::Root), + _ => None, + } + } +} diff --git a/support/texlab/src/distro.rs b/support/texlab/crates/distro/src/lib.rs index 759374da81..5ad9a8529c 100644 --- a/support/texlab/src/distro.rs +++ b/support/texlab/crates/distro/src/lib.rs @@ -1,5 +1,6 @@ mod file_name_db; mod kpsewhich; +mod language; mod miktex; mod texlive; @@ -7,7 +8,7 @@ use std::process::{Command, Stdio}; use anyhow::Result; -pub use file_name_db::FileNameDB; +pub use self::{file_name_db::FileNameDB, language::Language}; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum DistroKind { diff --git a/support/texlab/src/distro/miktex.rs b/support/texlab/crates/distro/src/miktex.rs index 1dfe1b9522..1dfe1b9522 100644 --- a/support/texlab/src/distro/miktex.rs +++ b/support/texlab/crates/distro/src/miktex.rs diff --git a/support/texlab/src/distro/texlive.rs b/support/texlab/crates/distro/src/texlive.rs index 8013033e6d..8013033e6d 100644 --- a/support/texlab/src/distro/texlive.rs +++ b/support/texlab/crates/distro/src/texlive.rs diff --git a/support/texlab/crates/parser/Cargo.toml b/support/texlab/crates/parser/Cargo.toml new file mode 100644 index 0000000000..3f2efc0450 --- /dev/null +++ b/support/texlab/crates/parser/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "parser" +version = "0.0.0" +license.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] +logos = "0.13.0" +once_cell = "1.17.1" +regex = "1.7.3" +rowan = "0.15.11" +syntax = { path = "../syntax" } + +[dev-dependencies] +insta = { version = "1.29.0", features = ["glob", "redactions", "json"] } + +[lib] +doctest = false diff --git a/support/texlab/src/parser/bibtex.rs b/support/texlab/crates/parser/src/bibtex.rs index e03a39c9ae..193203016e 100644 --- a/support/texlab/src/parser/bibtex.rs +++ b/support/texlab/crates/parser/src/bibtex.rs @@ -1,7 +1,6 @@ use logos::Logos; use rowan::{GreenNode, GreenNodeBuilder}; - -use crate::syntax::bibtex::SyntaxKind::{self, *}; +use syntax::bibtex::SyntaxKind::{self, *}; pub fn parse_bibtex(input: &str) -> GreenNode { let mut ptr = TokenPtr { @@ -251,7 +250,7 @@ where fn peek(&mut self) -> Option<(T, &'a str)> { if self.token.is_none() { - let kind = self.lexer.next()?; + let kind = self.lexer.next()?.unwrap(); let text = self.lexer.slice(); self.token = Some((kind, text)); } @@ -275,7 +274,6 @@ enum RootToken { Entry, #[regex(r"[^@]+")] - #[error] Junk, } @@ -301,7 +299,7 @@ enum BodyToken { #[regex(r"[^\s\(\)\{\}@,=]+")] Name, - #[error] + #[token("@")] Error, } @@ -328,8 +326,7 @@ enum ValueToken { #[regex(r"\d+", priority = 2)] Integer, - #[regex(r#"[^\s"\{\},]+"#)] - #[error] + #[regex(r#"[^\s"\{\},#]+"#)] Name, } @@ -378,7 +375,6 @@ enum ContentToken { CommandName, #[regex(r#"[^\s"\{\}\\~,]+"#)] - #[error] Word, } @@ -439,7 +435,7 @@ impl From<ContentToken> for SyntaxKind { #[cfg(test)] mod tests { - use crate::syntax::bibtex; + use syntax::bibtex; use super::parse_bibtex; diff --git a/support/texlab/src/parser/build_log.rs b/support/texlab/crates/parser/src/build_log.rs index 635f9adfb4..27f3699a66 100644 --- a/support/texlab/src/parser/build_log.rs +++ b/support/texlab/crates/parser/src/build_log.rs @@ -2,8 +2,7 @@ use std::{cmp::Ordering, path::PathBuf}; use once_cell::sync::Lazy; use regex::{Match, Regex}; - -use crate::syntax::{BuildError, BuildErrorLevel, BuildLog}; +use syntax::{BuildError, BuildErrorLevel, BuildLog}; const MAX_LINE_LENGTH: usize = 79; diff --git a/support/texlab/src/parser/latex.rs b/support/texlab/crates/parser/src/latex.rs index 591d2a1583..52e164a349 100644 --- a/support/texlab/src/parser/latex.rs +++ b/support/texlab/crates/parser/src/latex.rs @@ -1,8 +1,7 @@ mod lexer; use rowan::{GreenNode, GreenNodeBuilder}; - -use crate::syntax::latex::SyntaxKind::{self, *}; +use syntax::latex::SyntaxKind::{self, *}; use self::lexer::{ types::{CommandName, SectionLevel, Token}, @@ -697,6 +696,8 @@ impl<'a> Parser<'a> { | Token::Eq | Token::LBrack | Token::RBrack + | Token::LParen + | Token::RParen | Token::CommandName(CommandName::Generic) => self.path(), Token::Whitespace | Token::LineBreak | Token::Comma => self.eat(), Token::LCurly => self.curly_group_path(), @@ -720,6 +721,8 @@ impl<'a> Parser<'a> { | Token::Eq | Token::LBrack | Token::RBrack + | Token::LParen + | Token::RParen | Token::CommandName(CommandName::Generic) => self.eat(), Token::LCurly => self.curly_group_path(), _ => break, @@ -1119,7 +1122,7 @@ pub fn parse_latex(text: &str) -> GreenNode { #[cfg(test)] mod tests { - use crate::syntax::latex; + use syntax::latex; use super::parse_latex; diff --git a/support/texlab/src/parser/latex/lexer.rs b/support/texlab/crates/parser/src/latex/lexer.rs index ee5b8dd328..c0129ed3ba 100644 --- a/support/texlab/src/parser/latex/lexer.rs +++ b/support/texlab/crates/parser/src/latex/lexer.rs @@ -2,8 +2,7 @@ mod commands; pub(super) mod types; use logos::Logos; - -use crate::syntax::latex::SyntaxKind; +use syntax::latex::SyntaxKind; use self::types::{CommandName, Token}; @@ -49,7 +48,7 @@ impl<'a> Lexer<'a> { fn tokenize(input: &str) -> Vec<(Token, &str)> { let mut lexer = Token::lexer(input); std::iter::from_fn(move || { - let kind = lexer.next()?; + let kind = lexer.next()?.unwrap(); let text = lexer.slice(); Some((kind, text)) }) diff --git a/support/texlab/src/parser/latex/lexer/commands.rs b/support/texlab/crates/parser/src/latex/lexer/commands.rs index ba609f5d7f..ba609f5d7f 100644 --- a/support/texlab/src/parser/latex/lexer/commands.rs +++ b/support/texlab/crates/parser/src/latex/lexer/commands.rs diff --git a/support/texlab/src/parser/latex/lexer/types.rs b/support/texlab/crates/parser/src/latex/lexer/types.rs index 4355c021c1..4e6c67ab1f 100644 --- a/support/texlab/src/parser/latex/lexer/types.rs +++ b/support/texlab/crates/parser/src/latex/lexer/types.rs @@ -36,7 +36,6 @@ pub enum Token { Eq, #[regex(r"[^\s\\%\{\},\$\[\]\(\)=]+")] - #[error] Word, #[regex(r"\$\$?")] diff --git a/support/texlab/src/parser.rs b/support/texlab/crates/parser/src/lib.rs index 51d56475cf..51d56475cf 100644 --- a/support/texlab/src/parser.rs +++ b/support/texlab/crates/parser/src/lib.rs diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@comment.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@comment.txt.snap index f2e1163eff..7c665e628a 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@comment.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@comment.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/comment.txt +input_file: crates/parser/src/test_data/bibtex/comment.txt --- ROOT@0..82 JUNK@0..16 "Some junk here\n\n" diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@issue_809.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@issue_809.txt.snap index 922e926cef..84c9f86ec0 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@issue_809.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@issue_809.txt.snap @@ -1,6 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root +input_file: crates/parser/src/test_data/bibtex/issue_809.txt --- ROOT@0..50 ENTRY@0..50 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@preamble.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@preamble.txt.snap index 26d8a919ba..b0d043b1a7 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@preamble.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@preamble.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/preamble.txt +input_file: crates/parser/src/test_data/bibtex/preamble.txt --- ROOT@0..25 PREAMBLE@0..25 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__aho_2006.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__aho_2006.txt.snap index d1d34942d8..36db1ebb4c 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__aho_2006.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__aho_2006.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/aho_2006.txt +input_file: crates/parser/src/test_data/bibtex/samples/aho_2006.txt --- ROOT@0..314 ENTRY@0..314 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__aksin_2006.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__aksin_2006.txt.snap index 72e354e3c0..6b273d63a2 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__aksin_2006.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__aksin_2006.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/aksin_2006.txt +input_file: crates/parser/src/test_data/bibtex/samples/aksin_2006.txt --- ROOT@0..679 STRING@0..40 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__almendro_1998.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__almendro_1998.txt.snap index cff0323cb4..280dd5a4cf 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__almendro_1998.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__almendro_1998.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/almendro_1998.txt +input_file: crates/parser/src/test_data/bibtex/samples/almendro_1998.txt --- ROOT@0..706 ENTRY@0..706 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__averroes_1998.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__averroes_1998.txt.snap index c02d61d272..8fb5a718d0 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__averroes_1998.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__averroes_1998.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/averroes_1998.txt +input_file: crates/parser/src/test_data/bibtex/samples/averroes_1998.txt --- ROOT@0..1008 ENTRY@0..1008 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__betram_1996.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__betram_1996.txt.snap index c2748c1661..417041cde4 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__betram_1996.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__betram_1996.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/betram_1996.txt +input_file: crates/parser/src/test_data/bibtex/samples/betram_1996.txt --- ROOT@0..556 STRING@0..40 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__blom_2021.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__blom_2021.txt.snap index 417bda4ec9..86ee736c2b 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__blom_2021.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__blom_2021.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/blom_2021.txt +input_file: crates/parser/src/test_data/bibtex/samples/blom_2021.txt --- ROOT@0..860 ENTRY@0..860 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__combi_2004.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__combi_2004.txt.snap index 82f58a700f..d633886ced 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__combi_2004.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__combi_2004.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/combi_2004.txt +input_file: crates/parser/src/test_data/bibtex/samples/combi_2004.txt --- ROOT@0..674 ENTRY@0..674 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__erwin_2007.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__erwin_2007.txt.snap index 58094d2f42..2275d58d08 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__erwin_2007.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__erwin_2007.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/erwin_2007.txt +input_file: crates/parser/src/test_data/bibtex/samples/erwin_2007.txt --- ROOT@0..615 ENTRY@0..615 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__jain_1999.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__jain_1999.txt.snap index d9f83b339a..d409435d09 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__jain_1999.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__jain_1999.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/jain_1999.txt +input_file: crates/parser/src/test_data/bibtex/samples/jain_1999.txt --- ROOT@0..674 ENTRY@0..674 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__kastenholz_2006.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__kastenholz_2006.txt.snap index 8d67f95096..e93f8ce6cb 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__kastenholz_2006.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__kastenholz_2006.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/kastenholz_2006.txt +input_file: crates/parser/src/test_data/bibtex/samples/kastenholz_2006.txt --- ROOT@0..898 STRING@0..35 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__knuth_1984.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__knuth_1984.txt.snap index 2be9233f95..59e678cbee 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__knuth_1984.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__knuth_1984.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/knuth_1984.txt +input_file: crates/parser/src/test_data/bibtex/samples/knuth_1984.txt --- ROOT@0..993 ENTRY@0..993 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__matuz_1990.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__matuz_1990.txt.snap index 1e2b67f36c..75f0293f23 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__matuz_1990.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__matuz_1990.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/matuz_1990.txt +input_file: crates/parser/src/test_data/bibtex/samples/matuz_1990.txt --- ROOT@0..517 ENTRY@0..517 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__nietzsche_1998.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__nietzsche_1998.txt.snap index 40d1f230af..97fe0cf087 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__nietzsche_1998.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__nietzsche_1998.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/nietzsche_1998.txt +input_file: crates/parser/src/test_data/bibtex/samples/nietzsche_1998.txt --- ROOT@0..1112 STRING@0..49 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__rivest_1978.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__rivest_1978.txt.snap index b296d9cd4b..11a8f38bac 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__bibtex__tests__parse@samples__rivest_1978.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__bibtex__tests__parse@samples__rivest_1978.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/bibtex.rs +source: crates/parser/src/bibtex.rs expression: root -input_file: src/parser/test_data/bibtex/samples/rivest_1978.txt +input_file: crates/parser/src/test_data/bibtex/samples/rivest_1978.txt --- ROOT@0..557 ENTRY@0..557 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@001.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@001.txt.snap index 1d91ff7fff..39808505c1 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@001.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@001.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) -input_file: src/parser/test_data/build_log/001.txt +input_file: crates/parser/src/test_data/build_log/001.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@002.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@002.txt.snap index 91fa71d636..6d4001e120 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@002.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@002.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) -input_file: src/parser/test_data/build_log/002.txt +input_file: crates/parser/src/test_data/build_log/002.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@003.txt.snap index 22d2ca86e5..bbc50a44c2 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@003.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@003.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) -input_file: src/parser/test_data/build_log/003.txt +input_file: crates/parser/src/test_data/build_log/003.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@004.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@004.txt.snap index 83219b5fff..c4f2ce5c72 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@004.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@004.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) -input_file: src/parser/test_data/build_log/004.txt +input_file: crates/parser/src/test_data/build_log/004.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@005.txt.snap index b77926323c..dafd6a4506 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@005.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@005.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) -input_file: src/parser/test_data/build_log/005.txt +input_file: crates/parser/src/test_data/build_log/005.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@006.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@006.txt.snap index 837aa9c295..ca9318c68d 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@006.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@006.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) -input_file: src/parser/test_data/build_log/006.txt +input_file: crates/parser/src/test_data/build_log/006.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@007.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@007.txt.snap index d509a01bd4..bf0c832fe2 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__build_log__tests__parse@007.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__build_log__tests__parse@007.txt.snap @@ -1,6 +1,7 @@ --- -source: src/parser/build_log.rs +source: crates/parser/src/build_log.rs expression: parse_build_log(&text) +input_file: crates/parser/src/test_data/build_log/007.txt --- BuildLog { errors: [ diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@block_comments.txt.snap index 1a12800267..b93689a3b9 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@block_comments.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@block_comments.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/block_comments.txt +input_file: crates/parser/src/test_data/latex/block_comments.txt --- ROOT@0..48 PREAMBLE@0..48 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_default.txt.snap index 8b314f42ad..bb82661568 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_default.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/caption/caption_default.txt +input_file: crates/parser/src/test_data/latex/caption/caption_default.txt --- ROOT@0..27 PREAMBLE@0..27 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_default_error.txt.snap index 9bbabd4b56..741d4ea0c4 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_default_error.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_default_error.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/caption/caption_default_error.txt +input_file: crates/parser/src/test_data/latex/caption/caption_default_error.txt --- ROOT@0..26 PREAMBLE@0..26 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_figure.txt.snap index 4e12380396..56735873f9 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_figure.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_figure.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/caption/caption_figure.txt +input_file: crates/parser/src/test_data/latex/caption/caption_figure.txt --- ROOT@0..39 PREAMBLE@0..39 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_minimal.txt.snap index 9e0769dd57..12ef5ffebb 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_minimal.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/caption/caption_minimal.txt +input_file: crates/parser/src/test_data/latex/caption/caption_minimal.txt --- ROOT@0..22 PREAMBLE@0..22 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_minimal_error.txt.snap index 845f1f3682..7bc85c0b20 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@caption__caption_minimal_error.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@caption__caption_minimal_error.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/caption/caption_minimal_error.txt +input_file: crates/parser/src/test_data/latex/caption/caption_minimal_error.txt --- ROOT@0..21 PREAMBLE@0..21 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_empty.txt.snap index c075d59f77..d35246b26c 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_empty.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_empty.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_empty.txt +input_file: crates/parser/src/test_data/latex/citation/citation_empty.txt --- ROOT@0..7 PREAMBLE@0..7 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_missing_brace.txt.snap index 1a2993bfeb..0855ea49ad 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_missing_brace.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_missing_brace.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_missing_brace.txt +input_file: crates/parser/src/test_data/latex/citation/citation_missing_brace.txt --- ROOT@0..9 PREAMBLE@0..9 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap index 92ad9815e4..e4d49e796e 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_multiple_keys.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_multiple_keys.txt +input_file: crates/parser/src/test_data/latex/citation/citation_multiple_keys.txt --- ROOT@0..15 PREAMBLE@0..15 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_prenote.txt.snap index a14278731f..654b97dfd9 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_prenote.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_prenote.txt +input_file: crates/parser/src/test_data/latex/citation/citation_prenote.txt --- ROOT@0..15 PREAMBLE@0..15 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap index 96c3996286..ca83218dfb 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_prenote_postnote.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_prenote_postnote.txt +input_file: crates/parser/src/test_data/latex/citation/citation_prenote_postnote.txt --- ROOT@0..20 PREAMBLE@0..20 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap index d97fad470c..015abf7011 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_redundant_comma.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_redundant_comma.txt +input_file: crates/parser/src/test_data/latex/citation/citation_redundant_comma.txt --- ROOT@0..12 PREAMBLE@0..12 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_simple.txt.snap index 3e2bb4cdf8..99cc891d2b 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_simple.txt +input_file: crates/parser/src/test_data/latex/citation/citation_simple.txt --- ROOT@0..10 PREAMBLE@0..10 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_star.txt.snap index 7ab875d747..4b66a7e7d9 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@citation__citation_star.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@citation__citation_star.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/citation/citation_star.txt +input_file: crates/parser/src/test_data/latex/citation/citation_star.txt --- ROOT@0..10 PREAMBLE@0..10 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_definition_simple.txt.snap index 92ec32991d..d38951b148 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_definition_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_definition_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_definition_simple.txt +input_file: crates/parser/src/test_data/latex/color/color_definition_simple.txt --- ROOT@0..33 PREAMBLE@0..33 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_reference_simple.txt.snap index 0033103085..dbf153dc18 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_reference_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_reference_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_reference_simple.txt +input_file: crates/parser/src/test_data/latex/color/color_reference_simple.txt --- ROOT@0..13 PREAMBLE@0..13 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error1.txt.snap index 017f8aef82..9e3317ac05 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error1.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error1.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_set_definition_error1.txt +input_file: crates/parser/src/test_data/latex/color/color_set_definition_error1.txt --- ROOT@0..39 PREAMBLE@0..39 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error2.txt.snap index 984dfcbabb..04b75973e5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error2.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error2.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_set_definition_error2.txt +input_file: crates/parser/src/test_data/latex/color/color_set_definition_error2.txt --- ROOT@0..30 PREAMBLE@0..30 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error3.txt.snap index 67fc1ed0bb..1133778fbf 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error3.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error3.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_set_definition_error3.txt +input_file: crates/parser/src/test_data/latex/color/color_set_definition_error3.txt --- ROOT@0..25 PREAMBLE@0..25 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error4.txt.snap index e939ab2230..11d175d732 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_error4.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_error4.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_set_definition_error4.txt +input_file: crates/parser/src/test_data/latex/color/color_set_definition_error4.txt --- ROOT@0..15 PREAMBLE@0..15 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_simple.txt.snap index b699543115..903a780989 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@color__color_set_definition_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@color__color_set_definition_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/color/color_set_definition_simple.txt +input_file: crates/parser/src/test_data/latex/color/color_set_definition_simple.txt --- ROOT@0..44 PREAMBLE@0..44 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap index fac8dcb1e0..c4d51b8248 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_argc.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/command_definition_no_argc.txt +input_file: crates/parser/src/test_data/latex/command_definition/command_definition_no_argc.txt --- ROOT@0..22 PREAMBLE@0..22 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap index 0096ebbe60..4170bbb233 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_impl.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/command_definition_no_impl.txt +input_file: crates/parser/src/test_data/latex/command_definition/command_definition_no_impl.txt --- ROOT@0..17 PREAMBLE@0..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/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap index 018824e5e2..8a3bd36895 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_no_impl_error.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/command_definition_no_impl_error.txt +input_file: crates/parser/src/test_data/latex/command_definition/command_definition_no_impl_error.txt --- ROOT@0..16 PREAMBLE@0..16 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap index 3435088461..ff11be61d4 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_optional.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/command_definition_optional.txt +input_file: crates/parser/src/test_data/latex/command_definition/command_definition_optional.txt --- ROOT@0..29 PREAMBLE@0..29 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap index 806a0e2081..1d5fb28686 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/command_definition_simple.txt +input_file: crates/parser/src/test_data/latex/command_definition/command_definition_simple.txt --- ROOT@0..23 PREAMBLE@0..23 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap index 2dfccb38dd..3e58111e6b 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__command_definition_with_begin.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/command_definition_with_begin.txt +input_file: crates/parser/src/test_data/latex/command_definition/command_definition_with_begin.txt --- ROOT@0..80 PREAMBLE@0..80 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap index 4cdcd846b6..ea401584af 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__math_operator_no_impl.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/math_operator_no_impl.txt +input_file: crates/parser/src/test_data/latex/command_definition/math_operator_no_impl.txt --- ROOT@0..26 PREAMBLE@0..26 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap index fe6beef40f..2833943059 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@command_definition__math_operator_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/command_definition/math_operator_simple.txt +input_file: crates/parser/src/test_data/latex/command_definition/math_operator_simple.txt --- ROOT@0..31 PREAMBLE@0..31 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_asymptote.txt.snap index a16c3a2563..48f11f6285 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_asymptote.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_asymptote.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/environment/environment_asymptote.txt +input_file: crates/parser/src/test_data/latex/environment/environment_asymptote.txt --- ROOT@0..50 PREAMBLE@0..50 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_definition.txt.snap index 4a99a3b175..2403d60ef1 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_definition.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/environment/environment_definition.txt +input_file: crates/parser/src/test_data/latex/environment/environment_definition.txt --- ROOT@0..47 PREAMBLE@0..47 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap index c9304ff387..ae0fbd931a 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_definition_optional_arg.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/environment/environment_definition_optional_arg.txt +input_file: crates/parser/src/test_data/latex/environment/environment_definition_optional_arg.txt --- ROOT@0..44 PREAMBLE@0..44 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_nested.txt.snap index 35b8155fd8..b4e1d6a458 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_nested.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/environment/environment_nested.txt +input_file: crates/parser/src/test_data/latex/environment/environment_nested.txt --- ROOT@0..43 PREAMBLE@0..43 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap index 88f9d3b3fd..5d67bfe665 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_nested_missing_braces.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/environment/environment_nested_missing_braces.txt +input_file: crates/parser/src/test_data/latex/environment/environment_nested_missing_braces.txt --- ROOT@0..52 PREAMBLE@0..52 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_simple.txt.snap index 996237cd42..f74b68fdf7 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@environment__environment_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@environment__environment_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/environment/environment_simple.txt +input_file: crates/parser/src/test_data/latex/environment/environment_simple.txt --- ROOT@0..33 PREAMBLE@0..33 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@equation.txt.snap index 55b92d4afb..71fff49984 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@equation.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/equation.txt +input_file: crates/parser/src/test_data/latex/equation.txt --- ROOT@0..13 PREAMBLE@0..13 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@equation_missing_begin.txt.snap index 57e520cf38..1590fbed73 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@equation_missing_begin.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@equation_missing_begin.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/equation_missing_begin.txt +input_file: crates/parser/src/test_data/latex/equation_missing_begin.txt --- ROOT@0..28 PREAMBLE@0..28 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_args.txt.snap index 0db73ad9aa..9057d8f024 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_args.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_args.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/generic_command_args.txt +input_file: crates/parser/src/test_data/latex/generic_command_args.txt --- ROOT@0..14 PREAMBLE@0..14 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_empty.txt.snap index 1886dedea7..ee8f593395 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_empty.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_empty.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/generic_command_empty.txt +input_file: crates/parser/src/test_data/latex/generic_command_empty.txt --- ROOT@0..4 PREAMBLE@0..4 diff --git a/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_escape.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_escape.txt.snap new file mode 100644 index 0000000000..f973be4b12 --- /dev/null +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@generic_command_escape.txt.snap @@ -0,0 +1,10 @@ +--- +source: crates/parser/src/latex.rs +expression: root +input_file: crates/parser/src/test_data/latex/generic_command_escape.txt +--- +ROOT@0..2 + PREAMBLE@0..2 + GENERIC_COMMAND@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/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_declaration.txt.snap index 279817a877..fb24afbf24 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_declaration.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_declaration.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/acronym_declaration.txt +input_file: crates/parser/src/test_data/latex/glossary/acronym_declaration.txt --- ROOT@0..64 PREAMBLE@0..64 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap index 90388ec5ee..8dd76abbf3 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_definition_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/acronym_definition_options.txt +input_file: crates/parser/src/test_data/latex/glossary/acronym_definition_options.txt --- ROOT@0..76 PREAMBLE@0..76 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap index eadfed4596..cf630440f8 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_definition_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/acronym_definition_simple.txt +input_file: crates/parser/src/test_data/latex/glossary/acronym_definition_simple.txt --- ROOT@0..44 PREAMBLE@0..44 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_package.txt.snap index 25c03edbad..721dfa5bf9 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_package.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_package.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/acronym_package.txt +input_file: crates/parser/src/test_data/latex/glossary/acronym_package.txt --- ROOT@0..35 PREAMBLE@0..35 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap index 1edbf986f8..6e470c3add 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_reference_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/acronym_reference_options.txt +input_file: crates/parser/src/test_data/latex/glossary/acronym_reference_options.txt --- ROOT@0..32 PREAMBLE@0..32 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap index 38e68a3a33..5b83135522 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__acronym_reference_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/acronym_reference_simple.txt +input_file: crates/parser/src/test_data/latex/glossary/acronym_reference_simple.txt --- ROOT@0..19 PREAMBLE@0..19 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap index 901d0bf8c2..52037c6bbf 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_definition_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/glossary_entry_definition_simple.txt +input_file: crates/parser/src/test_data/latex/glossary/glossary_entry_definition_simple.txt --- ROOT@0..39 PREAMBLE@0..39 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap index 263f4a7146..07d1d8cdfa 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_reference_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/glossary_entry_reference_options.txt +input_file: crates/parser/src/test_data/latex/glossary/glossary_entry_reference_options.txt --- ROOT@0..25 PREAMBLE@0..25 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap index 72713fee9a..db50fc3298 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@glossary__glossary_entry_reference_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/glossary/glossary_entry_reference_simple.txt +input_file: crates/parser/src/test_data/latex/glossary/glossary_entry_reference_simple.txt --- ROOT@0..9 PREAMBLE@0..9 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path.txt.snap index 392c6f3b6e..80bf58d783 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/graphics_path.txt +input_file: crates/parser/src/test_data/latex/graphics_path.txt --- ROOT@0..28 PREAMBLE@0..28 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path_command.txt.snap index 34d958314d..c8521d2de7 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_command.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path_command.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/graphics_path_command.txt +input_file: crates/parser/src/test_data/latex/graphics_path_command.txt --- ROOT@0..32 PREAMBLE@0..32 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path_options.txt.snap index 88b92c1a3b..4ca53d2fe2 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@graphics_path_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@graphics_path_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/graphics_path_options.txt +input_file: crates/parser/src/test_data/latex/graphics_path_options.txt --- ROOT@0..33 PREAMBLE@0..33 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__curly_group_missing_end.txt.snap index bc3e6e68ef..902cacfdd5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_missing_end.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__curly_group_missing_end.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/curly_group_missing_end.txt +input_file: crates/parser/src/test_data/latex/group/curly_group_missing_end.txt --- ROOT@0..12 PREAMBLE@0..12 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__curly_group_simple.txt.snap index 156ec2e0a2..4f1b8473be 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__curly_group_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__curly_group_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/curly_group_simple.txt +input_file: crates/parser/src/test_data/latex/group/curly_group_simple.txt --- ROOT@0..13 PREAMBLE@0..13 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__equation_missing_end.txt.snap index fad46a2c97..dfddb20f85 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__equation_missing_end.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__equation_missing_end.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/equation_missing_end.txt +input_file: crates/parser/src/test_data/latex/group/equation_missing_end.txt --- ROOT@0..28 PREAMBLE@0..28 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__escaped_brackets.txt.snap index 9046238457..d9e1636cf8 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__escaped_brackets.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__escaped_brackets.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/escaped_brackets.txt +input_file: crates/parser/src/test_data/latex/group/escaped_brackets.txt --- ROOT@0..6 PREAMBLE@0..6 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_braces.txt.snap index cb181c7fdb..922776c8c5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_braces.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_braces.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/unmatched_braces.txt +input_file: crates/parser/src/test_data/latex/group/unmatched_braces.txt --- ROOT@0..2 PREAMBLE@0..2 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_brackets.txt.snap index 8e8accd9fc..12e455b505 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_brackets.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/unmatched_brackets.txt +input_file: crates/parser/src/test_data/latex/group/unmatched_brackets.txt --- ROOT@0..2 PREAMBLE@0..2 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap index 82c14ec404..765c7e4a8d 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@group__unmatched_brackets_with_group.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/group/unmatched_brackets_with_group.txt +input_file: crates/parser/src/test_data/latex/group/unmatched_brackets_with_group.txt --- ROOT@0..4 PREAMBLE@0..4 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@hello_world.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@hello_world.txt.snap index 7c1ff02b81..27bca69893 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@hello_world.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@hello_world.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/hello_world.txt +input_file: crates/parser/src/test_data/latex/hello_world.txt --- ROOT@0..12 PREAMBLE@0..12 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__biblatex_include_options.txt.snap index 9e0c086956..e3e34a68f6 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__biblatex_include_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/biblatex_include_options.txt +input_file: crates/parser/src/test_data/latex/include/biblatex_include_options.txt --- ROOT@0..42 PREAMBLE@0..42 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__biblatex_include_simple.txt.snap index 80c0afdc78..b4b4193dba 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__biblatex_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__biblatex_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/biblatex_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/biblatex_include_simple.txt --- ROOT@0..28 PREAMBLE@0..28 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__bibtex_include_simple.txt.snap index 0273ad8d6b..c39c9e2c68 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__bibtex_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__bibtex_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/bibtex_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/bibtex_include_simple.txt --- ROOT@0..22 PREAMBLE@0..22 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_empty.txt.snap index 68b9f3c94e..a8d5a7077f 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_empty.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_empty.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/class_include_empty.txt +input_file: crates/parser/src/test_data/latex/include/class_include_empty.txt --- ROOT@0..16 PREAMBLE@0..16 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_options.txt.snap index e501b654c4..4cf4473cfa 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/class_include_options.txt +input_file: crates/parser/src/test_data/latex/include/class_include_options.txt --- ROOT@0..44 PREAMBLE@0..44 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_simple.txt.snap index 5b4f6114a6..a6be2ec496 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__class_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__class_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/class_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/class_include_simple.txt --- ROOT@0..23 PREAMBLE@0..23 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_command.txt.snap index ea3e96323d..6f9f736d1f 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_command.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_command.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/graphics_include_command.txt +input_file: crates/parser/src/test_data/latex/include/graphics_include_command.txt --- ROOT@0..52 PREAMBLE@0..52 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap index 3b60d765b8..4b422dcd64 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_complicated_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/graphics_include_complicated_options.txt +input_file: crates/parser/src/test_data/latex/include/graphics_include_complicated_options.txt --- ROOT@0..39 PREAMBLE@0..39 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_options.txt.snap index b0817db126..656d68c1ef 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/graphics_include_options.txt +input_file: crates/parser/src/test_data/latex/include/graphics_include_options.txt --- ROOT@0..39 PREAMBLE@0..39 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_simple.txt.snap index ef53c6faa5..39cb634ec2 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__graphics_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__graphics_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/graphics_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/graphics_include_simple.txt --- ROOT@0..29 PREAMBLE@0..29 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__import_incomplete.txt.snap index b4fc1b4244..645133e65c 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_incomplete.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__import_incomplete.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/import_incomplete.txt +input_file: crates/parser/src/test_data/latex/include/import_incomplete.txt --- ROOT@0..11 PREAMBLE@0..11 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__import_simple.txt.snap index d703c0b994..b383dc435e 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__import_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__import_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/import_simple.txt +input_file: crates/parser/src/test_data/latex/include/import_simple.txt --- ROOT@0..17 PREAMBLE@0..17 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__inkscape_include_options.txt.snap index 4594b959f3..2c2c176fdb 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__inkscape_include_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/inkscape_include_options.txt +input_file: crates/parser/src/test_data/latex/include/inkscape_include_options.txt --- ROOT@0..30 PREAMBLE@0..30 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__inkscape_include_simple.txt.snap index b74c855e53..62cb7486db 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__inkscape_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__inkscape_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/inkscape_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/inkscape_include_simple.txt --- ROOT@0..20 PREAMBLE@0..20 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap index f49d0ccea6..2fff7b1e8f 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_include_equality_sign.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/latex_include_equality_sign.txt +input_file: crates/parser/src/test_data/latex/include/latex_include_equality_sign.txt --- ROOT@0..17 PREAMBLE@0..17 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_include_simple.txt.snap index 1b853f4686..4841296f02 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/latex_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/latex_include_simple.txt --- ROOT@0..17 PREAMBLE@0..17 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap index dee2e19577..7f13f6b247 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__latex_input_path_brackets.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/latex_input_path_brackets.txt +input_file: crates/parser/src/test_data/latex/include/latex_input_path_brackets.txt --- ROOT@0..20 PREAMBLE@0..20 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_empty.txt.snap index c8746b66e5..086f2b0c75 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_empty.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_empty.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/package_include_empty.txt +input_file: crates/parser/src/test_data/latex/include/package_include_empty.txt --- ROOT@0..13 PREAMBLE@0..13 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_multiple.txt.snap index e6ca358d8b..d42a4a76fe 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_multiple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_multiple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/package_include_multiple.txt +input_file: crates/parser/src/test_data/latex/include/package_include_multiple.txt --- ROOT@0..28 PREAMBLE@0..28 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_options.txt.snap index a65948daf8..8ecffa39d5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/package_include_options.txt +input_file: crates/parser/src/test_data/latex/include/package_include_options.txt --- ROOT@0..41 PREAMBLE@0..41 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_simple.txt.snap index 5f91723920..99304a8108 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__package_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__package_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/package_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/package_include_simple.txt --- ROOT@0..20 PREAMBLE@0..20 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap index f20083a1bc..c55ce16744 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__pgf_library_import_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/pgf_library_import_simple.txt +input_file: crates/parser/src/test_data/latex/include/pgf_library_import_simple.txt --- ROOT@0..19 PREAMBLE@0..19 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__svg_include_options.txt.snap index 412e18691f..7e67683606 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_options.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__svg_include_options.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/svg_include_options.txt +input_file: crates/parser/src/test_data/latex/include/svg_include_options.txt --- ROOT@0..34 PREAMBLE@0..34 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__svg_include_simple.txt.snap index da3a9b4a6d..f776f9c2bc 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__svg_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__svg_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/svg_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/svg_include_simple.txt --- ROOT@0..24 PREAMBLE@0..24 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap index e44115196a..fff99d5ad1 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__tikz_library_import_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/tikz_library_import_simple.txt +input_file: crates/parser/src/test_data/latex/include/tikz_library_import_simple.txt --- ROOT@0..20 PREAMBLE@0..20 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__verbatim_include_simple.txt.snap index ffdc042047..28eda149c4 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@include__verbatim_include_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@include__verbatim_include_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/include/verbatim_include_simple.txt +input_file: crates/parser/src/test_data/latex/include/verbatim_include_simple.txt --- ROOT@0..27 PREAMBLE@0..27 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@inline.txt.snap index fa5e02f35d..b5696044a5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@inline.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/inline.txt +input_file: crates/parser/src/test_data/latex/inline.txt --- ROOT@0..19 PREAMBLE@0..19 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@inline_double_dollar.txt.snap index 692cd065a1..6d614db919 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@inline_double_dollar.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@inline_double_dollar.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/inline_double_dollar.txt +input_file: crates/parser/src/test_data/latex/inline_double_dollar.txt --- ROOT@0..21 PREAMBLE@0..21 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_745.txt.snap index 1d9f6db48b..4165481528 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_745.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_745.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/issue_745.txt +input_file: crates/parser/src/test_data/latex/issue_745.txt --- ROOT@0..271 PREAMBLE@0..271 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_789.txt.snap index 4756b13c49..9899e3c9ab 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_789.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_789.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/issue_789.txt +input_file: crates/parser/src/test_data/latex/issue_789.txt --- ROOT@0..19 PREAMBLE@0..19 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_853.txt.snap index 0069449097..dc8c3a3d2b 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_853.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_853.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/issue_853.txt +input_file: crates/parser/src/test_data/latex/issue_853.txt --- ROOT@0..135 PREAMBLE@0..135 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_857.txt.snap index 4ed4c71e59..b0edef17a8 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@issue_857.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_857.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/issue_857.txt +input_file: crates/parser/src/test_data/latex/issue_857.txt --- ROOT@0..55 PREAMBLE@0..55 diff --git a/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_874.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_874.txt.snap new file mode 100644 index 0000000000..8555f2bc48 --- /dev/null +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@issue_874.txt.snap @@ -0,0 +1,28 @@ +--- +source: crates/parser/src/latex.rs +expression: root +input_file: crates/parser/src/test_data/latex/issue_874.txt +--- +ROOT@0..37 + PREAMBLE@0..37 + GRAPHICS_INCLUDE@0..37 + COMMAND_NAME@0..16 "\\includegraphics" + BRACK_GROUP_KEY_VALUE@16..27 + L_BRACK@16..17 "[" + KEY_VALUE_BODY@17..26 + KEY_VALUE_PAIR@17..26 + KEY@17..22 + WORD@17..22 "scale" + EQUALITY_SIGN@22..23 "=" + VALUE@23..26 + TEXT@23..26 + WORD@23..26 "0.2" + R_BRACK@26..27 "]" + CURLY_GROUP_WORD_LIST@27..37 + L_CURLY@27..28 "{" + KEY@28..36 + WORD@28..31 "7.4" + R_PAREN@31..32 ")" + WORD@32..36 ".jpg" + R_CURLY@36..37 "}" + diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_definition_line_break.txt.snap index 57c3a3bf3a..5eaed87fee 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_line_break.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_definition_line_break.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_definition_line_break.txt +input_file: crates/parser/src/test_data/latex/label/label_definition_line_break.txt --- ROOT@0..19 PREAMBLE@0..19 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_definition_simple.txt.snap index 49c17d26eb..cb693002b5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_definition_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_definition_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_definition_simple.txt +input_file: crates/parser/src/test_data/latex/label/label_definition_simple.txt --- ROOT@0..11 PREAMBLE@0..11 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_number.txt.snap index cc5824ea16..6e9613313a 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_number.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_number.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_number.txt +input_file: crates/parser/src/test_data/latex/label/label_number.txt --- ROOT@0..21 PREAMBLE@0..21 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_equation.txt.snap index c44c7a2c5c..b631f40b60 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_equation.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_equation.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_equation.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_equation.txt --- ROOT@0..11 PREAMBLE@0..11 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_incomplete.txt.snap index c654786a3e..054da6d258 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_incomplete.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_incomplete.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_incomplete.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_incomplete.txt --- ROOT@0..47 PREAMBLE@0..47 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_multiple.txt.snap index 556a04766e..5a228e8972 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_multiple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_multiple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_multiple.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_multiple.txt --- ROOT@0..14 PREAMBLE@0..14 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_error.txt.snap index ff82c6f558..a4b25eeb09 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_error.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_error.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_range_error.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_range_error.txt --- ROOT@0..19 PREAMBLE@0..19 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap index 5a8910b8d2..e18cd6ed97 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_incomplete.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_range_incomplete.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_range_incomplete.txt --- ROOT@0..15 PREAMBLE@0..15 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_simple.txt.snap index a03632ff5b..335309607c 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_range_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_range_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_range_simple.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_range_simple.txt --- ROOT@0..20 PREAMBLE@0..20 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_simple.txt.snap index 3734ba74f9..ba3d08b472 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@label__label_reference_simple.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@label__label_reference_simple.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/label/label_reference_simple.txt +input_file: crates/parser/src/test_data/latex/label/label_reference_simple.txt --- ROOT@0..9 PREAMBLE@0..9 diff --git a/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter.txt.snap new file mode 100644 index 0000000000..aa038efb86 --- /dev/null +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter.txt.snap @@ -0,0 +1,10 @@ +--- +source: crates/parser/src/latex.rs +expression: root +input_file: crates/parser/src/test_data/latex/parameter.txt +--- +ROOT@0..2 + PREAMBLE@0..2 + TEXT@0..2 + WORD@0..2 "#1" + diff --git a/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter_error.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter_error.txt.snap new file mode 100644 index 0000000000..7f9a744622 --- /dev/null +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@parameter_error.txt.snap @@ -0,0 +1,10 @@ +--- +source: crates/parser/src/latex.rs +expression: root +input_file: crates/parser/src/test_data/latex/parameter_error.txt +--- +ROOT@0..1 + PREAMBLE@0..1 + TEXT@0..1 + WORD@0..1 "#" + diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_enum_item.txt.snap index 45bcb12842..6045bdce2b 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_enum_item.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_enum_item.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/structure/structure_enum_item.txt +input_file: crates/parser/src/test_data/latex/structure/structure_enum_item.txt --- ROOT@0..60 PREAMBLE@0..60 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap index 877d7e28d4..df715917df 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_invalid_nesting.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/structure/structure_invalid_nesting.txt +input_file: crates/parser/src/test_data/latex/structure/structure_invalid_nesting.txt --- ROOT@0..27 PREAMBLE@0..27 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_nested.txt.snap index e4a3cddc7b..d9dab436e7 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_nested.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_nested.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/structure/structure_nested.txt +input_file: crates/parser/src/test_data/latex/structure/structure_nested.txt --- ROOT@0..90 PREAMBLE@0..90 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_siblings.txt.snap index 4a925e7e44..66040952f0 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@structure__structure_siblings.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@structure__structure_siblings.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/structure/structure_siblings.txt +input_file: crates/parser/src/test_data/latex/structure/structure_siblings.txt --- ROOT@0..35 PREAMBLE@0..35 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap index 6aa441cbba..c21f26976e 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_full.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_full.txt +input_file: crates/parser/src/test_data/latex/theorem_definition/theorem_definition_full.txt --- ROOT@0..31 PREAMBLE@0..31 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/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap index d205e65183..d4c5d787b5 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_counter.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt +input_file: crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt --- ROOT@0..21 PREAMBLE@0..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/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap index 8d198b3940..b269ac10d0 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt +input_file: crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt --- ROOT@0..21 PREAMBLE@0..21 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/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap index ffa7d31541..230f1fac29 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/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_name_with_description_and_counter.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt +input_file: crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt --- ROOT@0..26 PREAMBLE@0..26 diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap index afad760dd2..b01de34857 100644 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap +++ b/support/texlab/crates/parser/src/snapshots/parser__latex__tests__parse@theorem_definition__theorem_definition_only_name.txt.snap @@ -1,7 +1,7 @@ --- -source: src/parser/latex.rs +source: crates/parser/src/latex.rs expression: root -input_file: src/parser/test_data/latex/theorem_definition/theorem_definition_only_name.txt +input_file: crates/parser/src/test_data/latex/theorem_definition/theorem_definition_only_name.txt --- ROOT@0..16 PREAMBLE@0..16 diff --git a/support/texlab/src/parser/test_data/bibtex/comment.txt b/support/texlab/crates/parser/src/test_data/bibtex/comment.txt index f2ff586ab7..f2ff586ab7 100644 --- a/support/texlab/src/parser/test_data/bibtex/comment.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/comment.txt diff --git a/support/texlab/src/parser/test_data/bibtex/issue_809.txt b/support/texlab/crates/parser/src/test_data/bibtex/issue_809.txt index c94b808fd5..c94b808fd5 100644 --- a/support/texlab/src/parser/test_data/bibtex/issue_809.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/issue_809.txt diff --git a/support/texlab/src/parser/test_data/bibtex/preamble.txt b/support/texlab/crates/parser/src/test_data/bibtex/preamble.txt index 266b5ce228..266b5ce228 100644 --- a/support/texlab/src/parser/test_data/bibtex/preamble.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/preamble.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/aho_2006.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/aho_2006.txt index ff829b40d1..ff829b40d1 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/aho_2006.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/aho_2006.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/aksin_2006.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/aksin_2006.txt index 88ea701c22..88ea701c22 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/aksin_2006.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/aksin_2006.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/almendro_1998.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/almendro_1998.txt index ed16d33c67..ed16d33c67 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/almendro_1998.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/almendro_1998.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/averroes_1998.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/averroes_1998.txt index 9f224353cc..9f224353cc 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/averroes_1998.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/averroes_1998.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/betram_1996.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/betram_1996.txt index b2d77e216f..b2d77e216f 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/betram_1996.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/betram_1996.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/blom_2021.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/blom_2021.txt index a502e53e03..a502e53e03 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/blom_2021.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/blom_2021.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/combi_2004.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/combi_2004.txt index 7d8545577d..7d8545577d 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/combi_2004.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/combi_2004.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/erwin_2007.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/erwin_2007.txt index 116f5e7098..116f5e7098 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/erwin_2007.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/erwin_2007.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/jain_1999.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/jain_1999.txt index c367ef12ee..c367ef12ee 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/jain_1999.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/jain_1999.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/kastenholz_2006.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/kastenholz_2006.txt index 457f871491..457f871491 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/kastenholz_2006.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/kastenholz_2006.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/knuth_1984.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/knuth_1984.txt index 98c595e35c..98c595e35c 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/knuth_1984.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/knuth_1984.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/matuz_1990.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/matuz_1990.txt index cb803aab51..cb803aab51 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/matuz_1990.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/matuz_1990.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/nietzsche_1998.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/nietzsche_1998.txt index e245be39bb..e245be39bb 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/nietzsche_1998.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/nietzsche_1998.txt diff --git a/support/texlab/src/parser/test_data/bibtex/samples/rivest_1978.txt b/support/texlab/crates/parser/src/test_data/bibtex/samples/rivest_1978.txt index e1076145ea..e1076145ea 100644 --- a/support/texlab/src/parser/test_data/bibtex/samples/rivest_1978.txt +++ b/support/texlab/crates/parser/src/test_data/bibtex/samples/rivest_1978.txt diff --git a/support/texlab/src/parser/test_data/build_log/001.txt b/support/texlab/crates/parser/src/test_data/build_log/001.txt index fc9968af0f..fc9968af0f 100644 --- a/support/texlab/src/parser/test_data/build_log/001.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/001.txt diff --git a/support/texlab/src/parser/test_data/build_log/002.txt b/support/texlab/crates/parser/src/test_data/build_log/002.txt index 8d438d1f12..8d438d1f12 100644 --- a/support/texlab/src/parser/test_data/build_log/002.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/002.txt diff --git a/support/texlab/src/parser/test_data/build_log/003.txt b/support/texlab/crates/parser/src/test_data/build_log/003.txt index 220614b91c..220614b91c 100644 --- a/support/texlab/src/parser/test_data/build_log/003.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/003.txt diff --git a/support/texlab/src/parser/test_data/build_log/004.txt b/support/texlab/crates/parser/src/test_data/build_log/004.txt index 4ab379cd53..4ab379cd53 100644 --- a/support/texlab/src/parser/test_data/build_log/004.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/004.txt diff --git a/support/texlab/src/parser/test_data/build_log/005.txt b/support/texlab/crates/parser/src/test_data/build_log/005.txt index 07c95bfc6b..07c95bfc6b 100644 --- a/support/texlab/src/parser/test_data/build_log/005.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/005.txt diff --git a/support/texlab/src/parser/test_data/build_log/006.txt b/support/texlab/crates/parser/src/test_data/build_log/006.txt index 3edb18b8c7..3edb18b8c7 100644 --- a/support/texlab/src/parser/test_data/build_log/006.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/006.txt diff --git a/support/texlab/src/parser/test_data/build_log/007.txt b/support/texlab/crates/parser/src/test_data/build_log/007.txt index 4c86405c0d..4c86405c0d 100644 --- a/support/texlab/src/parser/test_data/build_log/007.txt +++ b/support/texlab/crates/parser/src/test_data/build_log/007.txt diff --git a/support/texlab/src/parser/test_data/latex/block_comments.txt b/support/texlab/crates/parser/src/test_data/latex/block_comments.txt index d4e63ab1c8..d4e63ab1c8 100644 --- a/support/texlab/src/parser/test_data/latex/block_comments.txt +++ b/support/texlab/crates/parser/src/test_data/latex/block_comments.txt diff --git a/support/texlab/src/parser/test_data/latex/caption/caption_default.txt b/support/texlab/crates/parser/src/test_data/latex/caption/caption_default.txt index 9084f143bf..9084f143bf 100644 --- a/support/texlab/src/parser/test_data/latex/caption/caption_default.txt +++ b/support/texlab/crates/parser/src/test_data/latex/caption/caption_default.txt diff --git a/support/texlab/src/parser/test_data/latex/caption/caption_default_error.txt b/support/texlab/crates/parser/src/test_data/latex/caption/caption_default_error.txt index 62e5962816..62e5962816 100644 --- a/support/texlab/src/parser/test_data/latex/caption/caption_default_error.txt +++ b/support/texlab/crates/parser/src/test_data/latex/caption/caption_default_error.txt diff --git a/support/texlab/src/parser/test_data/latex/caption/caption_figure.txt b/support/texlab/crates/parser/src/test_data/latex/caption/caption_figure.txt index 8a1d3067d8..8a1d3067d8 100644 --- a/support/texlab/src/parser/test_data/latex/caption/caption_figure.txt +++ b/support/texlab/crates/parser/src/test_data/latex/caption/caption_figure.txt diff --git a/support/texlab/src/parser/test_data/latex/caption/caption_minimal.txt b/support/texlab/crates/parser/src/test_data/latex/caption/caption_minimal.txt index 07af0af8ca..07af0af8ca 100644 --- a/support/texlab/src/parser/test_data/latex/caption/caption_minimal.txt +++ b/support/texlab/crates/parser/src/test_data/latex/caption/caption_minimal.txt diff --git a/support/texlab/src/parser/test_data/latex/caption/caption_minimal_error.txt b/support/texlab/crates/parser/src/test_data/latex/caption/caption_minimal_error.txt index 747db731c1..747db731c1 100644 --- a/support/texlab/src/parser/test_data/latex/caption/caption_minimal_error.txt +++ b/support/texlab/crates/parser/src/test_data/latex/caption/caption_minimal_error.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_empty.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_empty.txt index 06704b89a4..06704b89a4 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_empty.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_empty.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_missing_brace.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_missing_brace.txt index 1f8e4c9310..1f8e4c9310 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_missing_brace.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_missing_brace.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_multiple_keys.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_multiple_keys.txt index be5da02c62..be5da02c62 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_multiple_keys.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_multiple_keys.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_prenote.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_prenote.txt index 5ae28c28ec..5ae28c28ec 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_prenote.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_prenote.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_prenote_postnote.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_prenote_postnote.txt index 23103b2476..23103b2476 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_prenote_postnote.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_prenote_postnote.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_redundant_comma.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_redundant_comma.txt index 68e3c2d36e..68e3c2d36e 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_redundant_comma.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_redundant_comma.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_simple.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_simple.txt index cd5809ef25..cd5809ef25 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/citation/citation_star.txt b/support/texlab/crates/parser/src/test_data/latex/citation/citation_star.txt index d1a2677021..d1a2677021 100644 --- a/support/texlab/src/parser/test_data/latex/citation/citation_star.txt +++ b/support/texlab/crates/parser/src/test_data/latex/citation/citation_star.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_definition_simple.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_definition_simple.txt index e8b58c8162..e8b58c8162 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_definition_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_definition_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_reference_simple.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_reference_simple.txt index 4fea2b24ec..4fea2b24ec 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_reference_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_reference_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error1.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error1.txt index f377ffcf2f..f377ffcf2f 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error1.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error1.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error2.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error2.txt index 0b5fa35868..0b5fa35868 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error2.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error2.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error3.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error3.txt index fb695b4530..fb695b4530 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error3.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error3.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error4.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error4.txt index 7c494133bf..7c494133bf 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_set_definition_error4.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_error4.txt diff --git a/support/texlab/src/parser/test_data/latex/color/color_set_definition_simple.txt b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_simple.txt index c812e61041..c812e61041 100644 --- a/support/texlab/src/parser/test_data/latex/color/color_set_definition_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/color/color_set_definition_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_argc.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_argc.txt index ef63ef62cb..ef63ef62cb 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_argc.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_argc.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_impl.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_impl.txt index 5ffc7e97c2..5ffc7e97c2 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_impl.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_impl.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_impl_error.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_impl_error.txt index 9323f5a313..9323f5a313 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_no_impl_error.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_no_impl_error.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_optional.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_optional.txt index c3fb7225f3..c3fb7225f3 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_optional.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_optional.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_simple.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_simple.txt index ffce86f21c..ffce86f21c 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_with_begin.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_with_begin.txt index e7ce7984cb..e7ce7984cb 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/command_definition_with_begin.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/command_definition_with_begin.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/math_operator_no_impl.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/math_operator_no_impl.txt index 685be22ce6..685be22ce6 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/math_operator_no_impl.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/math_operator_no_impl.txt diff --git a/support/texlab/src/parser/test_data/latex/command_definition/math_operator_simple.txt b/support/texlab/crates/parser/src/test_data/latex/command_definition/math_operator_simple.txt index ffbf671f74..ffbf671f74 100644 --- a/support/texlab/src/parser/test_data/latex/command_definition/math_operator_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/command_definition/math_operator_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/environment/environment_asymptote.txt b/support/texlab/crates/parser/src/test_data/latex/environment/environment_asymptote.txt index 76646075ea..76646075ea 100644 --- a/support/texlab/src/parser/test_data/latex/environment/environment_asymptote.txt +++ b/support/texlab/crates/parser/src/test_data/latex/environment/environment_asymptote.txt diff --git a/support/texlab/src/parser/test_data/latex/environment/environment_definition.txt b/support/texlab/crates/parser/src/test_data/latex/environment/environment_definition.txt index d3a5291dca..d3a5291dca 100644 --- a/support/texlab/src/parser/test_data/latex/environment/environment_definition.txt +++ b/support/texlab/crates/parser/src/test_data/latex/environment/environment_definition.txt diff --git a/support/texlab/src/parser/test_data/latex/environment/environment_definition_optional_arg.txt b/support/texlab/crates/parser/src/test_data/latex/environment/environment_definition_optional_arg.txt index bead3228a4..bead3228a4 100644 --- a/support/texlab/src/parser/test_data/latex/environment/environment_definition_optional_arg.txt +++ b/support/texlab/crates/parser/src/test_data/latex/environment/environment_definition_optional_arg.txt diff --git a/support/texlab/src/parser/test_data/latex/environment/environment_nested.txt b/support/texlab/crates/parser/src/test_data/latex/environment/environment_nested.txt index 8d84019ac7..8d84019ac7 100644 --- a/support/texlab/src/parser/test_data/latex/environment/environment_nested.txt +++ b/support/texlab/crates/parser/src/test_data/latex/environment/environment_nested.txt diff --git a/support/texlab/src/parser/test_data/latex/environment/environment_nested_missing_braces.txt b/support/texlab/crates/parser/src/test_data/latex/environment/environment_nested_missing_braces.txt index 35ce901a83..35ce901a83 100644 --- a/support/texlab/src/parser/test_data/latex/environment/environment_nested_missing_braces.txt +++ b/support/texlab/crates/parser/src/test_data/latex/environment/environment_nested_missing_braces.txt diff --git a/support/texlab/src/parser/test_data/latex/environment/environment_simple.txt b/support/texlab/crates/parser/src/test_data/latex/environment/environment_simple.txt index 309b559957..309b559957 100644 --- a/support/texlab/src/parser/test_data/latex/environment/environment_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/environment/environment_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/equation.txt b/support/texlab/crates/parser/src/test_data/latex/equation.txt index 7f85196961..7f85196961 100644 --- a/support/texlab/src/parser/test_data/latex/equation.txt +++ b/support/texlab/crates/parser/src/test_data/latex/equation.txt diff --git a/support/texlab/src/parser/test_data/latex/equation_missing_begin.txt b/support/texlab/crates/parser/src/test_data/latex/equation_missing_begin.txt index 9e5707b196..9e5707b196 100644 --- a/support/texlab/src/parser/test_data/latex/equation_missing_begin.txt +++ b/support/texlab/crates/parser/src/test_data/latex/equation_missing_begin.txt diff --git a/support/texlab/src/parser/test_data/latex/generic_command_args.txt b/support/texlab/crates/parser/src/test_data/latex/generic_command_args.txt index 2d62314c5c..2d62314c5c 100644 --- a/support/texlab/src/parser/test_data/latex/generic_command_args.txt +++ b/support/texlab/crates/parser/src/test_data/latex/generic_command_args.txt diff --git a/support/texlab/src/parser/test_data/latex/generic_command_empty.txt b/support/texlab/crates/parser/src/test_data/latex/generic_command_empty.txt index eeb4a48255..eeb4a48255 100644 --- a/support/texlab/src/parser/test_data/latex/generic_command_empty.txt +++ b/support/texlab/crates/parser/src/test_data/latex/generic_command_empty.txt diff --git a/support/texlab/src/parser/test_data/latex/generic_command_escape.txt b/support/texlab/crates/parser/src/test_data/latex/generic_command_escape.txt index 133d674d1e..133d674d1e 100644 --- a/support/texlab/src/parser/test_data/latex/generic_command_escape.txt +++ b/support/texlab/crates/parser/src/test_data/latex/generic_command_escape.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/acronym_declaration.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_declaration.txt index abf12b6cae..abf12b6cae 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/acronym_declaration.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_declaration.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/acronym_definition_options.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_definition_options.txt index 47a69067ca..47a69067ca 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/acronym_definition_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_definition_options.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/acronym_definition_simple.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_definition_simple.txt index 4fbf285927..4fbf285927 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/acronym_definition_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_definition_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/acronym_package.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_package.txt index 86e60c4584..86e60c4584 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/acronym_package.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_package.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/acronym_reference_options.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_reference_options.txt index 43fd03f12b..43fd03f12b 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/acronym_reference_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_reference_options.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/acronym_reference_simple.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_reference_simple.txt index d9fb5b9a25..d9fb5b9a25 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/acronym_reference_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/acronym_reference_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/glossary_entry_definition_simple.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_definition_simple.txt index fb1e12899a..fb1e12899a 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/glossary_entry_definition_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_definition_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/glossary_entry_reference_options.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_reference_options.txt index fbae075e1d..fbae075e1d 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/glossary_entry_reference_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_reference_options.txt diff --git a/support/texlab/src/parser/test_data/latex/glossary/glossary_entry_reference_simple.txt b/support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_reference_simple.txt index a603355f0f..a603355f0f 100644 --- a/support/texlab/src/parser/test_data/latex/glossary/glossary_entry_reference_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/glossary/glossary_entry_reference_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/graphics_path.txt b/support/texlab/crates/parser/src/test_data/latex/graphics_path.txt index 0e9f431c36..0e9f431c36 100644 --- a/support/texlab/src/parser/test_data/latex/graphics_path.txt +++ b/support/texlab/crates/parser/src/test_data/latex/graphics_path.txt diff --git a/support/texlab/src/parser/test_data/latex/graphics_path_command.txt b/support/texlab/crates/parser/src/test_data/latex/graphics_path_command.txt index 729ee51690..729ee51690 100644 --- a/support/texlab/src/parser/test_data/latex/graphics_path_command.txt +++ b/support/texlab/crates/parser/src/test_data/latex/graphics_path_command.txt diff --git a/support/texlab/src/parser/test_data/latex/graphics_path_options.txt b/support/texlab/crates/parser/src/test_data/latex/graphics_path_options.txt index ae8aa84d86..ae8aa84d86 100644 --- a/support/texlab/src/parser/test_data/latex/graphics_path_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/graphics_path_options.txt diff --git a/support/texlab/src/parser/test_data/latex/group/curly_group_missing_end.txt b/support/texlab/crates/parser/src/test_data/latex/group/curly_group_missing_end.txt index 6c7b76c0f8..6c7b76c0f8 100644 --- a/support/texlab/src/parser/test_data/latex/group/curly_group_missing_end.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/curly_group_missing_end.txt diff --git a/support/texlab/src/parser/test_data/latex/group/curly_group_simple.txt b/support/texlab/crates/parser/src/test_data/latex/group/curly_group_simple.txt index 5084aae70a..5084aae70a 100644 --- a/support/texlab/src/parser/test_data/latex/group/curly_group_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/curly_group_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/group/equation_missing_end.txt b/support/texlab/crates/parser/src/test_data/latex/group/equation_missing_end.txt index fcb715926a..fcb715926a 100644 --- a/support/texlab/src/parser/test_data/latex/group/equation_missing_end.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/equation_missing_end.txt diff --git a/support/texlab/src/parser/test_data/latex/group/escaped_brackets.txt b/support/texlab/crates/parser/src/test_data/latex/group/escaped_brackets.txt index 144a5fdd6d..144a5fdd6d 100644 --- a/support/texlab/src/parser/test_data/latex/group/escaped_brackets.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/escaped_brackets.txt diff --git a/support/texlab/src/parser/test_data/latex/group/unmatched_braces.txt b/support/texlab/crates/parser/src/test_data/latex/group/unmatched_braces.txt index 8f606b7dbe..8f606b7dbe 100644 --- a/support/texlab/src/parser/test_data/latex/group/unmatched_braces.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/unmatched_braces.txt diff --git a/support/texlab/src/parser/test_data/latex/group/unmatched_brackets.txt b/support/texlab/crates/parser/src/test_data/latex/group/unmatched_brackets.txt index 94ea4d5c96..94ea4d5c96 100644 --- a/support/texlab/src/parser/test_data/latex/group/unmatched_brackets.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/unmatched_brackets.txt diff --git a/support/texlab/src/parser/test_data/latex/group/unmatched_brackets_with_group.txt b/support/texlab/crates/parser/src/test_data/latex/group/unmatched_brackets_with_group.txt index ebf6229429..ebf6229429 100644 --- a/support/texlab/src/parser/test_data/latex/group/unmatched_brackets_with_group.txt +++ b/support/texlab/crates/parser/src/test_data/latex/group/unmatched_brackets_with_group.txt diff --git a/support/texlab/src/parser/test_data/latex/hello_world.txt b/support/texlab/crates/parser/src/test_data/latex/hello_world.txt index c57eff55eb..c57eff55eb 100644 --- a/support/texlab/src/parser/test_data/latex/hello_world.txt +++ b/support/texlab/crates/parser/src/test_data/latex/hello_world.txt diff --git a/support/texlab/src/parser/test_data/latex/include/biblatex_include_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/biblatex_include_options.txt index 216e7ea165..216e7ea165 100644 --- a/support/texlab/src/parser/test_data/latex/include/biblatex_include_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/biblatex_include_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/biblatex_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/biblatex_include_simple.txt index fe10ce257d..fe10ce257d 100644 --- a/support/texlab/src/parser/test_data/latex/include/biblatex_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/biblatex_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/bibtex_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/bibtex_include_simple.txt index 955353f690..955353f690 100644 --- a/support/texlab/src/parser/test_data/latex/include/bibtex_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/bibtex_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/class_include_empty.txt b/support/texlab/crates/parser/src/test_data/latex/include/class_include_empty.txt index 144b418175..144b418175 100644 --- a/support/texlab/src/parser/test_data/latex/include/class_include_empty.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/class_include_empty.txt diff --git a/support/texlab/src/parser/test_data/latex/include/class_include_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/class_include_options.txt index 32dc4279d7..32dc4279d7 100644 --- a/support/texlab/src/parser/test_data/latex/include/class_include_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/class_include_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/class_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/class_include_simple.txt index 15f3d6ea0a..15f3d6ea0a 100644 --- a/support/texlab/src/parser/test_data/latex/include/class_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/class_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/graphics_include_command.txt b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_command.txt index 14a4a96216..14a4a96216 100644 --- a/support/texlab/src/parser/test_data/latex/include/graphics_include_command.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_command.txt diff --git a/support/texlab/src/parser/test_data/latex/include/graphics_include_complicated_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_complicated_options.txt index d6b6910c14..d6b6910c14 100644 --- a/support/texlab/src/parser/test_data/latex/include/graphics_include_complicated_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_complicated_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/graphics_include_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_options.txt index 8d3c45f2a5..8d3c45f2a5 100644 --- a/support/texlab/src/parser/test_data/latex/include/graphics_include_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/graphics_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_simple.txt index 629cf3e8a9..629cf3e8a9 100644 --- a/support/texlab/src/parser/test_data/latex/include/graphics_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/graphics_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/import_incomplete.txt b/support/texlab/crates/parser/src/test_data/latex/include/import_incomplete.txt index 3d6bc5f043..3d6bc5f043 100644 --- a/support/texlab/src/parser/test_data/latex/include/import_incomplete.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/import_incomplete.txt diff --git a/support/texlab/src/parser/test_data/latex/include/import_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/import_simple.txt index f38059d6c1..f38059d6c1 100644 --- a/support/texlab/src/parser/test_data/latex/include/import_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/import_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/inkscape_include_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/inkscape_include_options.txt index e6dd431c7c..e6dd431c7c 100644 --- a/support/texlab/src/parser/test_data/latex/include/inkscape_include_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/inkscape_include_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/inkscape_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/inkscape_include_simple.txt index 4e3a4ea9ba..4e3a4ea9ba 100644 --- a/support/texlab/src/parser/test_data/latex/include/inkscape_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/inkscape_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/latex_include_equality_sign.txt b/support/texlab/crates/parser/src/test_data/latex/include/latex_include_equality_sign.txt index 5a763b4e29..5a763b4e29 100644 --- a/support/texlab/src/parser/test_data/latex/include/latex_include_equality_sign.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/latex_include_equality_sign.txt diff --git a/support/texlab/src/parser/test_data/latex/include/latex_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/latex_include_simple.txt index c0d3d390df..c0d3d390df 100644 --- a/support/texlab/src/parser/test_data/latex/include/latex_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/latex_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/latex_input_path_brackets.txt b/support/texlab/crates/parser/src/test_data/latex/include/latex_input_path_brackets.txt index 6585f50d52..6585f50d52 100644 --- a/support/texlab/src/parser/test_data/latex/include/latex_input_path_brackets.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/latex_input_path_brackets.txt diff --git a/support/texlab/src/parser/test_data/latex/include/package_include_empty.txt b/support/texlab/crates/parser/src/test_data/latex/include/package_include_empty.txt index 09e02cc1cc..09e02cc1cc 100644 --- a/support/texlab/src/parser/test_data/latex/include/package_include_empty.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/package_include_empty.txt diff --git a/support/texlab/src/parser/test_data/latex/include/package_include_multiple.txt b/support/texlab/crates/parser/src/test_data/latex/include/package_include_multiple.txt index c1080aaf66..c1080aaf66 100644 --- a/support/texlab/src/parser/test_data/latex/include/package_include_multiple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/package_include_multiple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/package_include_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/package_include_options.txt index 83a50c12cf..83a50c12cf 100644 --- a/support/texlab/src/parser/test_data/latex/include/package_include_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/package_include_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/package_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/package_include_simple.txt index 3cf1b4edc0..3cf1b4edc0 100644 --- a/support/texlab/src/parser/test_data/latex/include/package_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/package_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/pgf_library_import_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/pgf_library_import_simple.txt index 25a2b24720..25a2b24720 100644 --- a/support/texlab/src/parser/test_data/latex/include/pgf_library_import_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/pgf_library_import_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/svg_include_options.txt b/support/texlab/crates/parser/src/test_data/latex/include/svg_include_options.txt index 3eb90568ab..3eb90568ab 100644 --- a/support/texlab/src/parser/test_data/latex/include/svg_include_options.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/svg_include_options.txt diff --git a/support/texlab/src/parser/test_data/latex/include/svg_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/svg_include_simple.txt index 964a3adcd6..964a3adcd6 100644 --- a/support/texlab/src/parser/test_data/latex/include/svg_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/svg_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/tikz_library_import_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/tikz_library_import_simple.txt index ff616ebd11..ff616ebd11 100644 --- a/support/texlab/src/parser/test_data/latex/include/tikz_library_import_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/tikz_library_import_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/include/verbatim_include_simple.txt b/support/texlab/crates/parser/src/test_data/latex/include/verbatim_include_simple.txt index a0b3fec843..a0b3fec843 100644 --- a/support/texlab/src/parser/test_data/latex/include/verbatim_include_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/include/verbatim_include_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/inline.txt b/support/texlab/crates/parser/src/test_data/latex/inline.txt index 81a429dc26..81a429dc26 100644 --- a/support/texlab/src/parser/test_data/latex/inline.txt +++ b/support/texlab/crates/parser/src/test_data/latex/inline.txt diff --git a/support/texlab/src/parser/test_data/latex/inline_double_dollar.txt b/support/texlab/crates/parser/src/test_data/latex/inline_double_dollar.txt index c3a7fee9f6..c3a7fee9f6 100644 --- a/support/texlab/src/parser/test_data/latex/inline_double_dollar.txt +++ b/support/texlab/crates/parser/src/test_data/latex/inline_double_dollar.txt diff --git a/support/texlab/src/parser/test_data/latex/issue_745.txt b/support/texlab/crates/parser/src/test_data/latex/issue_745.txt index 4cbebeb2d8..4cbebeb2d8 100644 --- a/support/texlab/src/parser/test_data/latex/issue_745.txt +++ b/support/texlab/crates/parser/src/test_data/latex/issue_745.txt diff --git a/support/texlab/src/parser/test_data/latex/issue_789.txt b/support/texlab/crates/parser/src/test_data/latex/issue_789.txt index 612c6de786..612c6de786 100644 --- a/support/texlab/src/parser/test_data/latex/issue_789.txt +++ b/support/texlab/crates/parser/src/test_data/latex/issue_789.txt diff --git a/support/texlab/src/parser/test_data/latex/issue_853.txt b/support/texlab/crates/parser/src/test_data/latex/issue_853.txt index 312889717c..312889717c 100644 --- a/support/texlab/src/parser/test_data/latex/issue_853.txt +++ b/support/texlab/crates/parser/src/test_data/latex/issue_853.txt diff --git a/support/texlab/src/parser/test_data/latex/issue_857.txt b/support/texlab/crates/parser/src/test_data/latex/issue_857.txt index 0640263c84..0640263c84 100644 --- a/support/texlab/src/parser/test_data/latex/issue_857.txt +++ b/support/texlab/crates/parser/src/test_data/latex/issue_857.txt diff --git a/support/texlab/crates/parser/src/test_data/latex/issue_874.txt b/support/texlab/crates/parser/src/test_data/latex/issue_874.txt new file mode 100644 index 0000000000..adb3e438a2 --- /dev/null +++ b/support/texlab/crates/parser/src/test_data/latex/issue_874.txt @@ -0,0 +1 @@ +\includegraphics[scale=0.2]{7.4).jpg}
\ No newline at end of file diff --git a/support/texlab/src/parser/test_data/latex/label/label_definition_line_break.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_definition_line_break.txt index d567c6d25a..d567c6d25a 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_definition_line_break.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_definition_line_break.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_definition_simple.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_definition_simple.txt index 43ebaf1cec..43ebaf1cec 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_definition_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_definition_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_number.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_number.txt index 6e994af500..6e994af500 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_number.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_number.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_equation.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_equation.txt index ab386645df..ab386645df 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_equation.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_equation.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_incomplete.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_incomplete.txt index 1d0f79ec8e..1d0f79ec8e 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_incomplete.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_incomplete.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_multiple.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_multiple.txt index e8bb38ee9e..e8bb38ee9e 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_multiple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_multiple.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_range_error.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_error.txt index 9213da0460..9213da0460 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_range_error.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_error.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_range_incomplete.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_incomplete.txt index 841133d73a..841133d73a 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_range_incomplete.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_incomplete.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_range_simple.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_simple.txt index a0e985ea88..a0e985ea88 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_range_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_range_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/label/label_reference_simple.txt b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_simple.txt index dde4f444f4..dde4f444f4 100644 --- a/support/texlab/src/parser/test_data/latex/label/label_reference_simple.txt +++ b/support/texlab/crates/parser/src/test_data/latex/label/label_reference_simple.txt diff --git a/support/texlab/src/parser/test_data/latex/parameter.txt b/support/texlab/crates/parser/src/test_data/latex/parameter.txt index d44ac7b947..d44ac7b947 100644 --- a/support/texlab/src/parser/test_data/latex/parameter.txt +++ b/support/texlab/crates/parser/src/test_data/latex/parameter.txt diff --git a/support/texlab/src/parser/test_data/latex/parameter_error.txt b/support/texlab/crates/parser/src/test_data/latex/parameter_error.txt index 4287ca8617..4287ca8617 100644 --- a/support/texlab/src/parser/test_data/latex/parameter_error.txt +++ b/support/texlab/crates/parser/src/test_data/latex/parameter_error.txt diff --git a/support/texlab/src/parser/test_data/latex/structure/structure_enum_item.txt b/support/texlab/crates/parser/src/test_data/latex/structure/structure_enum_item.txt index 3288ec259b..3288ec259b 100644 --- a/support/texlab/src/parser/test_data/latex/structure/structure_enum_item.txt +++ b/support/texlab/crates/parser/src/test_data/latex/structure/structure_enum_item.txt diff --git a/support/texlab/src/parser/test_data/latex/structure/structure_invalid_nesting.txt b/support/texlab/crates/parser/src/test_data/latex/structure/structure_invalid_nesting.txt index 7203dd2d24..7203dd2d24 100644 --- a/support/texlab/src/parser/test_data/latex/structure/structure_invalid_nesting.txt +++ b/support/texlab/crates/parser/src/test_data/latex/structure/structure_invalid_nesting.txt diff --git a/support/texlab/src/parser/test_data/latex/structure/structure_nested.txt b/support/texlab/crates/parser/src/test_data/latex/structure/structure_nested.txt index 082f10765b..082f10765b 100644 --- a/support/texlab/src/parser/test_data/latex/structure/structure_nested.txt +++ b/support/texlab/crates/parser/src/test_data/latex/structure/structure_nested.txt diff --git a/support/texlab/src/parser/test_data/latex/structure/structure_siblings.txt b/support/texlab/crates/parser/src/test_data/latex/structure/structure_siblings.txt index d8e347c429..d8e347c429 100644 --- a/support/texlab/src/parser/test_data/latex/structure/structure_siblings.txt +++ b/support/texlab/crates/parser/src/test_data/latex/structure/structure_siblings.txt diff --git a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_full.txt b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_full.txt index 286d111ad1..286d111ad1 100644 --- a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_full.txt +++ b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_full.txt diff --git a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt index af1b6903a5..af1b6903a5 100644 --- a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt +++ b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_counter.txt diff --git a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt index e5d6551666..e5d6551666 100644 --- a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt +++ b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description.txt diff --git a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt index 89c37d9497..89c37d9497 100644 --- a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt +++ b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_name_with_description_and_counter.txt diff --git a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_only_name.txt b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_only_name.txt index 62adb2c4b9..62adb2c4b9 100644 --- a/support/texlab/src/parser/test_data/latex/theorem_definition/theorem_definition_only_name.txt +++ b/support/texlab/crates/parser/src/test_data/latex/theorem_definition/theorem_definition_only_name.txt diff --git a/support/texlab/crates/syntax/Cargo.toml b/support/texlab/crates/syntax/Cargo.toml new file mode 100644 index 0000000000..92c334c7f2 --- /dev/null +++ b/support/texlab/crates/syntax/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "syntax" +version = "0.0.0" +license.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] +itertools = "0.10.5" +rowan = "0.15.11" + +[lib] +doctest = false diff --git a/support/texlab/src/syntax/bibtex.rs b/support/texlab/crates/syntax/src/bibtex.rs index 9b4b1ab77e..9b4b1ab77e 100644 --- a/support/texlab/src/syntax/bibtex.rs +++ b/support/texlab/crates/syntax/src/bibtex.rs diff --git a/support/texlab/src/syntax/latex.rs b/support/texlab/crates/syntax/src/latex.rs index ce1ca125fd..ce1ca125fd 100644 --- a/support/texlab/src/syntax/latex.rs +++ b/support/texlab/crates/syntax/src/latex.rs diff --git a/support/texlab/src/syntax/latex/cst.rs b/support/texlab/crates/syntax/src/latex/cst.rs index 767aa50ecc..767aa50ecc 100644 --- a/support/texlab/src/syntax/latex/cst.rs +++ b/support/texlab/crates/syntax/src/latex/cst.rs diff --git a/support/texlab/src/syntax/latex/kind.rs b/support/texlab/crates/syntax/src/latex/kind.rs index 3eadc90b48..3eadc90b48 100644 --- a/support/texlab/src/syntax/latex/kind.rs +++ b/support/texlab/crates/syntax/src/latex/kind.rs diff --git a/support/texlab/src/syntax.rs b/support/texlab/crates/syntax/src/lib.rs index dc8761b73d..c2c0552652 100644 --- a/support/texlab/src/syntax.rs +++ b/support/texlab/crates/syntax/src/lib.rs @@ -20,3 +20,16 @@ pub struct BuildError { pub struct BuildLog { pub errors: Vec<BuildError>, } + +#[macro_export] +macro_rules! match_ast { + (match $node:ident { $($tt:tt)* }) => { $crate::match_ast!(match ($node) { $($tt)* }) }; + + (match ($node:expr) { + $( $( $path:ident )::+ ($it:pat) => $res:expr, )* + _ => $catch_all:expr $(,)? + }) => {{ + $( if let Some($it) = $($path::)+cast($node.clone()) { $res } else )* + { $catch_all } + }}; +} diff --git a/support/texlab/crates/texlab/Cargo.toml b/support/texlab/crates/texlab/Cargo.toml new file mode 100644 index 0000000000..09fff5f6db --- /dev/null +++ b/support/texlab/crates/texlab/Cargo.toml @@ -0,0 +1,78 @@ +[package] +name = "texlab" +description = "LaTeX Language Server" +version = "5.4.2" +license.workspace = true +readme = "README.md" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +homepage = "https://github.com/latex-lsp/texlab" +repository = "https://github.com/latex-lsp/texlab" +documentation = "https://github.com/latex-lsp/texlab" +keywords = ["lsp", "server", "latex", "bibtex"] +categories = ["development-tools"] +exclude = [ + ".gitattributes", + ".gitignore", + ".github/**", + "tests/it/**", + "*.snap", + "texlab.1", + "texlab.pdf", + "texlab.tex", +] + +[[bin]] +name = "texlab" +test = false + +[lib] +doctest = false + +[dependencies] +anyhow = "1.0.70" +base-db = { path = "../base-db" } +citeproc = { path = "../citeproc" } +clap = { version = "4.2.1", features = ["derive"] } +crossbeam-channel = "0.5.8" +dashmap = "5.4.0" +dirs = "5.0.0" +distro = { path = "../distro" } +encoding_rs = "0.8.32" +encoding_rs_io = "0.1.7" +fern = "0.6.2" +flate2 = "1.0.25" +fuzzy-matcher = { version = "0.3.7", features = ["compact"] } +human_name = { version = "2.0.1", default-features = false } +itertools = "0.10.5" +log = "0.4.17" +lsp-server = "0.7.0" +lsp-types = "0.94.0" +notify = "5.1.0" +once_cell = "1.17.1" +parking_lot = "0.12.1" +parser = { path = "../parser" } +regex = "1.7.3" +rowan = "0.15.11" +rustc-hash = "1.1.0" +serde = "1.0.159" +serde_json = "1.0.95" +serde_regex = "1.1.0" +serde_repr = "0.1.12" +smol_str = { version = "0.1.24", features = ["serde"] } +syntax = { path = "../syntax" } +tempfile = "3.5.0" +thiserror = "1.0.40" +threadpool = "1.8.1" +titlecase = "2.2.1" + +[dev-dependencies] +assert_unordered = "0.3.5" +criterion = { version = "0.4.0" } +insta = { version = "1.28.0", features = ["glob", "redactions", "json"] } + +[[bench]] +name = "bench_main" +path = "benches/bench_main.rs" +harness = false diff --git a/support/texlab/crates/texlab/benches/bench_main.rs b/support/texlab/crates/texlab/benches/bench_main.rs new file mode 100644 index 0000000000..d9e4937dbd --- /dev/null +++ b/support/texlab/crates/texlab/benches/bench_main.rs @@ -0,0 +1,43 @@ +use base_db::{Owner, Workspace}; +use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use distro::Language; +use lsp_types::{ClientCapabilities, Position, Url}; +use parser::parse_latex; +use rowan::TextSize; + +const CODE: &str = include_str!("../../../texlab.tex"); + +fn criterion_benchmark(c: &mut Criterion) { + c.bench_function("LaTeX/Parser", |b| { + b.iter(|| parse_latex(black_box(CODE))); + }); + + c.bench_function("LaTeX/Completion/Command", |b| { + let uri = Url::parse("http://example.com/texlab.tex").unwrap(); + let text = CODE.to_string(); + let mut workspace = Workspace::default(); + workspace.open( + uri.clone(), + text, + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + let client_capabilities = ClientCapabilities::default(); + + b.iter(|| { + texlab::features::completion::complete( + &workspace, + &uri, + Position::new(0, 1), + &client_capabilities, + None, + ) + }); + }); +} + +criterion_group!(benches, criterion_benchmark); + +criterion_main!(benches); diff --git a/support/texlab/data/components.json.gz b/support/texlab/crates/texlab/data/components.json.gz Binary files differindex b355f616ec..b355f616ec 100644 --- a/support/texlab/data/components.json.gz +++ b/support/texlab/crates/texlab/data/components.json.gz diff --git a/support/texlab/data/lang_data.json b/support/texlab/crates/texlab/data/lang_data.json index 3e22e41320..3e22e41320 100644 --- a/support/texlab/data/lang_data.json +++ b/support/texlab/crates/texlab/data/lang_data.json diff --git a/support/texlab/src/client.rs b/support/texlab/crates/texlab/src/client.rs index 0439445092..0439445092 100644 --- a/support/texlab/src/client.rs +++ b/support/texlab/crates/texlab/src/client.rs diff --git a/support/texlab/src/features.rs b/support/texlab/crates/texlab/src/features.rs index 0d82bcb4f4..0d82bcb4f4 100644 --- a/support/texlab/src/features.rs +++ b/support/texlab/crates/texlab/src/features.rs diff --git a/support/texlab/src/features/build.rs b/support/texlab/crates/texlab/src/features/build.rs index 83a1d4cb32..a37fe65bf8 100644 --- a/support/texlab/src/features/build.rs +++ b/support/texlab/crates/texlab/src/features/build.rs @@ -7,12 +7,15 @@ use std::{ thread::{self, JoinHandle}, }; +use base_db::Workspace; use encoding_rs_io::DecodeReaderBytesBuilder; -use lsp_types::{notification::LogMessage, LogMessageParams, TextDocumentIdentifier, Url}; +use lsp_types::{ + notification::LogMessage, ClientCapabilities, LogMessageParams, TextDocumentIdentifier, Url, +}; use serde::{Deserialize, Serialize}; use serde_repr::{Deserialize_repr, Serialize_repr}; -use crate::{client::LspClient, db::Workspace, util::capabilities::ClientCapabilitiesExt, Db}; +use crate::{client::LspClient, util::capabilities::ClientCapabilitiesExt}; #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -46,42 +49,34 @@ pub struct Command { } impl Command { - pub fn new(db: &dyn Db, uri: Url, client: LspClient) -> Option<Self> { - let workspace = Workspace::get(db); - let document = match workspace.lookup_uri(db, &uri) { - Some(child) => workspace - .parents(db, child) - .iter() - .next() - .copied() - .unwrap_or(child), - None => return None, - }; - - if document.location(db).path(db).is_none() { + pub fn new( + workspace: &Workspace, + uri: Url, + client: LspClient, + client_capabilities: &ClientCapabilities, + ) -> Option<Self> { + let Some(document) = workspace + .lookup(&uri) + .map(|child| workspace.parents(child).into_iter().next().unwrap_or(child)) else { return None }; + + let Some(path) = document.path.as_deref() else { log::warn!("Document {uri} cannot be compiled; skipping..."); return None; - } + }; - let config = &db.config().build; + let config = &workspace.config().build; let program = config.program.clone(); - let path = document.location(db).path(db).as_deref().unwrap(); let args = config .args .iter() .map(|arg| replace_placeholder(arg, path)) .collect(); - let working_dir = workspace - .working_dir(db, document.directory(db)) - .path(db) - .clone()?; + let working_dir = workspace.current_dir(&document.dir).to_file_path().ok()?; Some(Self { - uri: document.location(db).uri(db).clone(), - progress: workspace - .client_capabilities(db) - .has_work_done_progress_support(), + uri: document.uri.clone(), + progress: client_capabilities.has_work_done_progress_support(), program, args, working_dir, @@ -118,30 +113,16 @@ impl Command { } }; - let (line_sender, line_receiver) = flume::unbounded(); - let (exit_sender, exit_receiver) = flume::unbounded(); - track_output(process.stderr.take().unwrap(), line_sender.clone()); - track_output(process.stdout.take().unwrap(), line_sender); + let (sender, receiver) = crossbeam_channel::unbounded(); + track_output(process.stderr.take().unwrap(), sender.clone()); + track_output(process.stdout.take().unwrap(), sender.clone()); let client = self.client.clone(); let handle = std::thread::spawn(move || { let typ = lsp_types::MessageType::LOG; - loop { - let done = flume::Selector::new() - .recv(&line_receiver, |line| match line { - Ok(message) => { - let params = LogMessageParams { message, typ }; - let _ = client.send_notification::<LogMessage>(params); - false - } - Err(_) => true, - }) - .recv(&exit_receiver, |_| true) - .wait(); - - if done { - break; - } + while let Ok(Some(message)) = receiver.recv() { + let params = LogMessageParams { message, typ }; + let _ = client.send_notification::<LogMessage>(params); } }); @@ -153,7 +134,7 @@ impl Command { } }); - let _ = exit_sender.send(()); + let _ = sender.send(None); handle.join().unwrap(); drop(reporter); @@ -163,7 +144,7 @@ impl Command { fn track_output( output: impl Read + Send + 'static, - sender: flume::Sender<String>, + sender: crossbeam_channel::Sender<Option<String>>, ) -> JoinHandle<()> { let reader = BufReader::new( DecodeReaderBytesBuilder::new() @@ -177,7 +158,7 @@ fn track_output( let _ = reader .lines() .flatten() - .try_for_each(|line| sender.send(line)); + .try_for_each(|line| sender.send(Some(line))); }) } diff --git a/support/texlab/src/features/build/progress.rs b/support/texlab/crates/texlab/src/features/build/progress.rs index 6f235bebd6..6f235bebd6 100644 --- a/support/texlab/src/features/build/progress.rs +++ b/support/texlab/crates/texlab/src/features/build/progress.rs diff --git a/support/texlab/src/features/completion.rs b/support/texlab/crates/texlab/src/features/completion.rs index 949b5552e5..61528057a5 100644 --- a/support/texlab/src/features/completion.rs +++ b/support/texlab/crates/texlab/src/features/completion.rs @@ -18,15 +18,22 @@ mod tikz_library; mod user_command; mod user_environment; -use lsp_types::{CompletionList, Position, Url}; +use base_db::Workspace; +use lsp_types::{ClientCapabilities, ClientInfo, CompletionList, Position, Url}; -use crate::{features::completion::builder::CompletionBuilder, util::cursor::CursorContext, Db}; +use crate::{features::completion::builder::CompletionBuilder, util::cursor::CursorContext}; pub const COMPLETION_LIMIT: usize = 50; -pub fn complete(db: &dyn Db, uri: &Url, position: Position) -> Option<CompletionList> { - let context = CursorContext::new(db, uri, position, ())?; - let mut builder = CompletionBuilder::new(&context); +pub fn complete( + workspace: &Workspace, + uri: &Url, + position: Position, + client_capabilities: &ClientCapabilities, + client_info: Option<&ClientInfo>, +) -> Option<CompletionList> { + let context = CursorContext::new(workspace, uri, position, ())?; + let mut builder = CompletionBuilder::new(&context, client_capabilities, client_info); log::debug!("[Completion] Cursor: {:?}", context.cursor); entry_type::complete(&context, &mut builder); field::complete(&context, &mut builder); diff --git a/support/texlab/crates/texlab/src/features/completion/acronym_ref.rs b/support/texlab/crates/texlab/src/features/completion/acronym_ref.rs new file mode 100644 index 0000000000..3337ed542e --- /dev/null +++ b/support/texlab/crates/texlab/src/features/completion/acronym_ref.rs @@ -0,0 +1,31 @@ +use base_db::DocumentData; +use rowan::ast::AstNode; +use syntax::latex; + +use crate::util::cursor::CursorContext; + +use super::builder::CompletionBuilder; + +pub fn complete<'db>( + context: &'db CursorContext, + builder: &mut CompletionBuilder<'db>, +) -> Option<()> { + let (_, range, group) = context.find_curly_group_word()?; + latex::AcronymReference::cast(group.syntax().parent()?)?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + for name in data + .root_node() + .descendants() + .filter_map(latex::AcronymDefinition::cast) + .filter_map(|node| node.name()) + .filter_map(|name| name.key()) + { + builder.glossary_entry(range, name.to_string()); + } + } + + Some(()) +} diff --git a/support/texlab/src/features/completion/argument.rs b/support/texlab/crates/texlab/src/features/completion/argument.rs index 10b377cb0e..ae4cb98471 100644 --- a/support/texlab/src/features/completion/argument.rs +++ b/support/texlab/crates/texlab/src/features/completion/argument.rs @@ -1,16 +1,11 @@ use rowan::{ast::AstNode, TextRange}; +use syntax::latex; -use crate::{ - syntax::latex, - util::{components::COMPONENT_DATABASE, cursor::CursorContext}, -}; +use crate::util::{components::COMPONENT_DATABASE, cursor::CursorContext}; use super::builder::CompletionBuilder; -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { +pub fn complete<'a>(context: &'a CursorContext, builder: &mut CompletionBuilder<'a>) -> Option<()> { let token = context.cursor.as_tex()?; let range = if token.kind() == latex::WORD { @@ -39,7 +34,7 @@ pub fn complete<'db>( let command_name = command.name()?; let command_name = &command_name.text()[1..]; - for component in COMPONENT_DATABASE.linked_components(context.db, context.document) { + for component in COMPONENT_DATABASE.linked_components(&context.project) { for component_command in component .commands .iter() diff --git a/support/texlab/src/features/completion/begin_snippet.rs b/support/texlab/crates/texlab/src/features/completion/begin_snippet.rs index 06be4faf13..06be4faf13 100644 --- a/support/texlab/src/features/completion/begin_snippet.rs +++ b/support/texlab/crates/texlab/src/features/completion/begin_snippet.rs diff --git a/support/texlab/src/features/completion/builder.rs b/support/texlab/crates/texlab/src/features/completion/builder.rs index 0373587a06..a503fc6e1c 100644 --- a/support/texlab/src/features/completion/builder.rs +++ b/support/texlab/crates/texlab/src/features/completion/builder.rs @@ -1,46 +1,49 @@ +use base_db::Document; use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher}; use itertools::Itertools; use lsp_types::{ - CompletionItem, CompletionItemKind, CompletionList, CompletionTextEdit, Documentation, - InsertTextFormat, MarkupContent, MarkupKind, TextEdit, Url, + ClientCapabilities, ClientInfo, CompletionItem, CompletionItemKind, CompletionList, + CompletionTextEdit, Documentation, InsertTextFormat, MarkupContent, MarkupKind, TextEdit, Url, }; use once_cell::sync::Lazy; use regex::Regex; use rowan::{ast::AstNode, TextRange, TextSize}; use serde::{Deserialize, Serialize}; use smol_str::SmolStr; +use syntax::{ + bibtex::{self, HasName, HasType}, + latex, +}; -use crate::{ - db::{Document, ServerContext, Workspace}, - syntax::{ - bibtex::{self, HasName, HasType}, - latex, - }, - util::{ - capabilities::ClientCapabilitiesExt, - cursor::{Cursor, CursorContext}, - lang_data::{BibtexEntryTypeCategory, BibtexEntryTypeDoc, BibtexFieldDoc, LANGUAGE_DATA}, - line_index_ext::LineIndexExt, - lsp_enums::Structure, - }, +use crate::util::{ + capabilities::ClientCapabilitiesExt, + cursor::{Cursor, CursorContext}, + lang_data::{BibtexEntryTypeCategory, BibtexEntryTypeDoc, BibtexFieldDoc, LANGUAGE_DATA}, + line_index_ext::LineIndexExt, + lsp_enums::Structure, }; use super::COMPLETION_LIMIT; -pub struct CompletionBuilder<'db> { - context: &'db CursorContext<'db>, - items: Vec<Item<'db>>, +pub struct CompletionBuilder<'a> { + context: &'a CursorContext<'a>, + items: Vec<Item<'a>>, matcher: SkimMatcherV2, text_pattern: String, file_pattern: String, preselect: Option<String>, snippets: bool, markdown: bool, - item_kinds: &'db [CompletionItemKind], + item_kinds: &'a [CompletionItemKind], + always_incomplete: bool, } -impl<'db> CompletionBuilder<'db> { - pub fn new(context: &'db CursorContext) -> Self { +impl<'a> CompletionBuilder<'a> { + pub fn new( + context: &'a CursorContext, + client_capabilities: &'a ClientCapabilities, + client_info: Option<&'a ClientInfo>, + ) -> Self { let items = Vec::new(); let matcher = SkimMatcherV2::default().ignore_case(); let text_pattern = match &context.cursor { @@ -94,7 +97,6 @@ impl<'db> CompletionBuilder<'db> { .and_then(|name| name.key()) .map(|name| name.to_string()); - let client_capabilities = context.workspace.client_capabilities(context.db); let snippets = client_capabilities.has_snippet_support(); let markdown = client_capabilities.has_completion_markdown_support(); let item_kinds = client_capabilities @@ -105,6 +107,8 @@ impl<'db> CompletionBuilder<'db> { .and_then(|cap| cap.value_set.as_deref()) .unwrap_or_default(); + let always_incomplete = client_info.map_or(false, |info| info.name == "Visual Studio Code"); + Self { context, items, @@ -115,6 +119,7 @@ impl<'db> CompletionBuilder<'db> { snippets, markdown, item_kinds, + always_incomplete, } } @@ -133,8 +138,8 @@ impl<'db> CompletionBuilder<'db> { pub fn generic_argument( &mut self, range: TextRange, - name: &'db str, - image: Option<&'db str>, + name: &'a str, + image: Option<&'a str>, ) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { @@ -148,8 +153,7 @@ impl<'db> CompletionBuilder<'db> { } pub fn begin_snippet(&mut self, range: TextRange) -> Option<()> { - let capabilities = Workspace::get(self.context.db).client_capabilities(self.context.db); - if capabilities.has_snippet_support() { + if self.snippets { let score = self.matcher.fuzzy_match("begin", &self.text_pattern[1..])?; self.items.push(Item { range, @@ -165,7 +169,7 @@ impl<'db> CompletionBuilder<'db> { pub fn citation( &mut self, range: TextRange, - document: Document, + document: &'a Document, entry: &bibtex::Entry, ) -> Option<()> { let key = entry.name_token()?.to_string(); @@ -202,7 +206,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn color_model(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn color_model(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { range, @@ -214,7 +218,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn color(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn color(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { range, @@ -229,10 +233,10 @@ impl<'db> CompletionBuilder<'db> { pub fn component_command( &mut self, range: TextRange, - name: &'db str, - image: Option<&'db str>, - glyph: Option<&'db str>, - file_names: &'db [SmolStr], + name: &'a str, + image: Option<&'a str>, + glyph: Option<&'a str>, + file_names: &'a [SmolStr], ) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern[1..])?; let data = Data::ComponentCommand { @@ -255,8 +259,8 @@ impl<'db> CompletionBuilder<'db> { pub fn component_environment( &mut self, range: TextRange, - name: &'db str, - file_names: &'db [SmolStr], + name: &'a str, + file_names: &'a [SmolStr], ) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { @@ -272,7 +276,7 @@ impl<'db> CompletionBuilder<'db> { pub fn entry_type( &mut self, range: TextRange, - entry_type: &'db BibtexEntryTypeDoc, + entry_type: &'a BibtexEntryTypeDoc, ) -> Option<()> { let score = self .matcher @@ -288,7 +292,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn field(&mut self, range: TextRange, field: &'db BibtexFieldDoc) -> Option<()> { + pub fn field(&mut self, range: TextRange, field: &'a BibtexFieldDoc) -> Option<()> { let score = self.matcher.fuzzy_match(&field.name, &self.text_pattern)?; self.items.push(Item { range, @@ -300,7 +304,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn class(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn class(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { range, @@ -312,7 +316,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn package(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn package(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { range, @@ -351,10 +355,10 @@ impl<'db> CompletionBuilder<'db> { pub fn label( &mut self, range: TextRange, - name: &'db str, + name: &'a str, kind: Structure, header: Option<String>, - footer: Option<String>, + footer: Option<&'a str>, text: String, ) -> Option<()> { let score = self.matcher.fuzzy_match(&text, &self.text_pattern)?; @@ -374,7 +378,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn tikz_library(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn tikz_library(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { range, @@ -386,7 +390,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn user_command(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn user_command(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern[1..])?; self.items.push(Item { range, @@ -398,7 +402,7 @@ impl<'db> CompletionBuilder<'db> { Some(()) } - pub fn user_environment(&mut self, range: TextRange, name: &'db str) -> Option<()> { + pub fn user_environment(&mut self, range: TextRange, name: &'a str) -> Option<()> { let score = self.matcher.fuzzy_match(name, &self.text_pattern)?; self.items.push(Item { range, @@ -426,14 +430,17 @@ impl<'db> CompletionBuilder<'db> { .map(|(i, item)| self.convert_item(item, i)) .collect(); - 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.is_incomplete = self.always_incomplete || list.items.len() >= COMPLETION_LIMIT; list } fn convert_item(&self, item: Item, index: usize) -> CompletionItem { - let range = self.context.line_index.line_col_lsp_range(item.range); + let range = self + .context + .document + .line_index + .line_col_lsp_range(item.range); + let preselect = item.preselect; let mut item = match item.data { Data::EntryType { entry_type } => CompletionItem { @@ -496,10 +503,7 @@ impl<'db> CompletionBuilder<'db> { sort_text: Some(filter_text), data: Some( serde_json::to_value(CompletionItemData::Citation { - uri: document - .location(self.context.db) - .uri(self.context.db) - .clone(), + uri: document.uri.clone(), key: key.clone(), }) .unwrap(), @@ -582,7 +586,7 @@ impl<'db> CompletionBuilder<'db> { label: name.into(), kind: Some(kind.completion_kind()), detail: header, - documentation: footer.map(Documentation::String), + documentation: footer.map(|footer| Documentation::String(footer.into())), sort_text: Some(text.clone()), filter_text: Some(text), text_edit: Some(TextEdit::new(range, name.into()).into()), @@ -590,7 +594,6 @@ impl<'db> CompletionBuilder<'db> { }, Data::UserCommand { name } => { let detail = "user-defined".into(); - let name = &name[1..]; CompletionItem { kind: Some(Structure::Command.completion_kind()), text_edit: Some(TextEdit::new(range, name.into()).into()), @@ -656,53 +659,53 @@ impl<'db> CompletionBuilder<'db> { } #[derive(Debug, Clone)] -struct Item<'db> { +struct Item<'a> { range: TextRange, - data: Data<'db>, + data: Data<'a>, preselect: bool, score: i32, } #[derive(Debug, Clone)] -enum Data<'db> { +enum Data<'a> { EntryType { - entry_type: &'db BibtexEntryTypeDoc, + entry_type: &'a BibtexEntryTypeDoc, }, Field { - field: &'db BibtexFieldDoc, + field: &'a BibtexFieldDoc, }, Argument { - name: &'db str, - image: Option<&'db str>, + name: &'a str, + image: Option<&'a str>, }, BeginSnippet, Citation { - document: Document, + document: &'a Document, key: String, filter_text: String, category: BibtexEntryTypeCategory, }, ComponentCommand { - name: &'db str, - image: Option<&'db str>, - glyph: Option<&'db str>, - file_names: &'db [SmolStr], + name: &'a str, + image: Option<&'a str>, + glyph: Option<&'a str>, + file_names: &'a [SmolStr], }, ComponentEnvironment { - name: &'db str, - file_names: &'db [SmolStr], + name: &'a str, + file_names: &'a [SmolStr], }, Class { - name: &'db str, + name: &'a str, }, Package { - name: &'db str, + name: &'a str, }, Color { - name: &'db str, + name: &'a str, }, ColorModel { - name: &'db str, + name: &'a str, }, GlossaryEntry { name: String, @@ -714,20 +717,20 @@ enum Data<'db> { name: String, }, Label { - name: &'db str, + name: &'a str, kind: Structure, header: Option<String>, - footer: Option<String>, + footer: Option<&'a str>, text: String, }, UserCommand { - name: &'db str, + name: &'a str, }, UserEnvironment { - name: &'db str, + name: &'a str, }, TikzLibrary { - name: &'db str, + name: &'a str, }, } diff --git a/support/texlab/src/features/completion/citation.rs b/support/texlab/crates/texlab/src/features/completion/citation.rs index 68d72717a7..01afa5c28e 100644 --- a/support/texlab/src/features/completion/citation.rs +++ b/support/texlab/crates/texlab/src/features/completion/citation.rs @@ -1,9 +1,8 @@ +use base_db::DocumentData; use rowan::{ast::AstNode, TextRange}; +use syntax::{bibtex, latex}; -use crate::{ - syntax::{bibtex, latex}, - util::cursor::CursorContext, -}; +use crate::util::cursor::CursorContext; use super::builder::CompletionBuilder; @@ -27,15 +26,11 @@ pub fn complete<'db>( }; check_citation(context).or_else(|| check_acronym(context))?; - for document in context.related() { - if let Some(data) = document.parse(context.db).as_bib() { - for entry in data - .root(context.db) - .children() - .filter_map(bibtex::Entry::cast) - { - builder.citation(range, document, &entry); - } + for document in &context.project.documents { + let DocumentData::Bib(data) = &document.data else { continue }; + + for entry in data.root_node().children().filter_map(bibtex::Entry::cast) { + builder.citation(range, document, &entry); } } diff --git a/support/texlab/src/features/completion/color.rs b/support/texlab/crates/texlab/src/features/completion/color.rs index cce6517cb4..6a636cc687 100644 --- a/support/texlab/src/features/completion/color.rs +++ b/support/texlab/crates/texlab/src/features/completion/color.rs @@ -1,9 +1,7 @@ use rowan::ast::AstNode; +use syntax::latex; -use crate::{ - syntax::latex, - util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}, -}; +use crate::util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}; use super::builder::CompletionBuilder; diff --git a/support/texlab/src/features/completion/color_model.rs b/support/texlab/crates/texlab/src/features/completion/color_model.rs index af700a96fb..107cb95b19 100644 --- a/support/texlab/src/features/completion/color_model.rs +++ b/support/texlab/crates/texlab/src/features/completion/color_model.rs @@ -1,6 +1,7 @@ use rowan::{ast::AstNode, TextRange}; +use syntax::latex; -use crate::{syntax::latex, util::cursor::CursorContext}; +use crate::util::cursor::CursorContext; use super::builder::CompletionBuilder; diff --git a/support/texlab/src/features/completion/component_command.rs b/support/texlab/crates/texlab/src/features/completion/component_command.rs index 20cef73848..ca1a1354ec 100644 --- a/support/texlab/src/features/completion/component_command.rs +++ b/support/texlab/crates/texlab/src/features/completion/component_command.rs @@ -8,7 +8,7 @@ pub fn complete<'db>( ) -> Option<()> { let range = context.cursor.command_range(context.offset)?; - for component in COMPONENT_DATABASE.linked_components(context.db, context.document) { + for component in COMPONENT_DATABASE.linked_components(&context.project) { for command in &component.commands { builder.component_command( range, diff --git a/support/texlab/src/features/completion/component_environment.rs b/support/texlab/crates/texlab/src/features/completion/component_environment.rs index e58e319a46..496fb7ed85 100644 --- a/support/texlab/src/features/completion/component_environment.rs +++ b/support/texlab/crates/texlab/src/features/completion/component_environment.rs @@ -8,7 +8,7 @@ pub fn complete<'db>( ) -> Option<()> { let (_, range) = context.find_environment_name()?; - for component in COMPONENT_DATABASE.linked_components(context.db, context.document) { + for component in COMPONENT_DATABASE.linked_components(&context.project) { for name in &component.environments { builder.component_environment(range, name, &component.file_names); } diff --git a/support/texlab/src/features/completion/entry_type.rs b/support/texlab/crates/texlab/src/features/completion/entry_type.rs index 38bc0e3f3a..73a93a5a40 100644 --- a/support/texlab/src/features/completion/entry_type.rs +++ b/support/texlab/crates/texlab/src/features/completion/entry_type.rs @@ -1,9 +1,7 @@ use rowan::{TextRange, TextSize}; +use syntax::bibtex; -use crate::{ - syntax::bibtex, - util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}, -}; +use crate::util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}; use super::builder::CompletionBuilder; diff --git a/support/texlab/src/features/completion/field.rs b/support/texlab/crates/texlab/src/features/completion/field.rs index ff6e54a562..d1f6a5e856 100644 --- a/support/texlab/src/features/completion/field.rs +++ b/support/texlab/crates/texlab/src/features/completion/field.rs @@ -1,9 +1,7 @@ use rowan::{ast::AstNode, TextRange}; +use syntax::bibtex::{self, HasName}; -use crate::{ - syntax::bibtex::{self, HasName}, - util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}, -}; +use crate::util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}; use super::builder::CompletionBuilder; diff --git a/support/texlab/crates/texlab/src/features/completion/glossary_ref.rs b/support/texlab/crates/texlab/src/features/completion/glossary_ref.rs new file mode 100644 index 0000000000..0d218a1b03 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/completion/glossary_ref.rs @@ -0,0 +1,37 @@ +use base_db::DocumentData; +use rowan::ast::AstNode; +use syntax::latex; + +use crate::util::cursor::CursorContext; + +use super::builder::CompletionBuilder; + +pub fn complete<'db>( + context: &'db CursorContext, + builder: &mut CompletionBuilder<'db>, +) -> Option<()> { + let (_, range, group) = context.find_curly_group_word()?; + latex::GlossaryEntryReference::cast(group.syntax().parent()?)?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + for node in data.root_node().descendants() { + if let Some(name) = latex::GlossaryEntryDefinition::cast(node.clone()) + .and_then(|entry| entry.name()) + .and_then(|name| name.key()) + .map(|name| name.to_string()) + { + builder.glossary_entry(range, name); + } else if let Some(name) = latex::AcronymDefinition::cast(node) + .and_then(|entry| entry.name()) + .and_then(|name| name.key()) + .map(|name| name.to_string()) + { + builder.glossary_entry(range, name); + } + } + } + + Some(()) +} diff --git a/support/texlab/src/features/completion/import.rs b/support/texlab/crates/texlab/src/features/completion/import.rs index bf6da78a43..826408368e 100644 --- a/support/texlab/src/features/completion/import.rs +++ b/support/texlab/crates/texlab/src/features/completion/import.rs @@ -1,10 +1,8 @@ use rowan::ast::AstNode; use rustc_hash::FxHashSet; +use syntax::latex; -use crate::{ - syntax::latex, - util::{components::COMPONENT_DATABASE, cursor::CursorContext}, -}; +use crate::util::{components::COMPONENT_DATABASE, cursor::CursorContext}; use super::builder::CompletionBuilder; @@ -37,7 +35,7 @@ pub fn complete<'db>( } } - let file_name_db = context.workspace.file_name_db(context.db); + let file_name_db = &context.workspace.distro().file_name_db; for file_name in file_name_db .iter() .map(|(file_name, _)| file_name) diff --git a/support/texlab/src/features/completion/include.rs b/support/texlab/crates/texlab/src/features/completion/include.rs index 5d7654a208..1cc1a0972b 100644 --- a/support/texlab/src/features/completion/include.rs +++ b/support/texlab/crates/texlab/src/features/completion/include.rs @@ -4,9 +4,11 @@ use std::{ path::{Path, PathBuf}, }; +use base_db::DocumentData; use rowan::{ast::AstNode, TextRange, TextSize}; +use syntax::latex; -use crate::{syntax::latex, util::cursor::CursorContext}; +use crate::util::cursor::CursorContext; use super::builder::CompletionBuilder; @@ -14,12 +16,7 @@ pub fn complete<'db>( context: &'db CursorContext, builder: &mut CompletionBuilder<'db>, ) -> Option<()> { - if context - .document - .location(context.db) - .path(context.db) - .is_none() - { + if context.document.path.is_none() { return None; } @@ -55,16 +52,10 @@ pub fn complete<'db>( let mut dirs = vec![current_dir(context, &path_text, None)]; if include.kind() == latex::GRAPHICS_INCLUDE { - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - for path in data - .analyze(context.db) - .graphics_paths(context.db) - .iter() - .map(|node| node.path(context.db)) - { - dirs.push(current_dir(context, &path_text, Some(path))); - } + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + for graphics_path in &data.semantics.graphics_paths { + dirs.push(current_dir(context, &path_text, Some(graphics_path))); } } } @@ -102,16 +93,16 @@ fn current_dir( ) -> Option<PathBuf> { let parent = context .workspace - .parents(context.db, context.document) + .parents(context.document) .iter() .next() .map_or(context.document, Clone::clone); let path = context .workspace - .working_dir(context.db, parent.directory(context.db)) - .path(context.db) - .as_deref()?; + .current_dir(&parent.dir) + .to_file_path() + .ok()?; let mut path = PathBuf::from(path.to_str()?.replace('\\', "/")); if !path_text.is_empty() { diff --git a/support/texlab/crates/texlab/src/features/completion/label.rs b/support/texlab/crates/texlab/src/features/completion/label.rs new file mode 100644 index 0000000000..c85093b748 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/completion/label.rs @@ -0,0 +1,72 @@ +use base_db::{semantics::tex::LabelKind, DocumentData}; +use rowan::{ast::AstNode, TextRange}; +use syntax::latex; + +use crate::util::{self, cursor::CursorContext, label::LabeledObject, lsp_enums::Structure}; + +use super::builder::CompletionBuilder; + +pub fn complete<'db>( + context: &'db CursorContext, + builder: &mut CompletionBuilder<'db>, +) -> Option<()> { + let (range, is_math) = find_reference(context).or_else(|| find_reference_range(context))?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + for label in data + .semantics + .labels + .iter() + .filter(|label| label.kind == LabelKind::Definition) + { + match util::label::render(context.workspace, &context.project, label) { + Some(rendered_label) => { + let kind = match &rendered_label.object { + LabeledObject::Section { .. } => Structure::Section, + LabeledObject::Float { .. } => Structure::Float, + LabeledObject::Theorem { .. } => Structure::Theorem, + LabeledObject::Equation => Structure::Equation, + LabeledObject::EnumItem => Structure::Item, + }; + + if is_math && kind != Structure::Equation { + continue; + } + + let header = rendered_label.detail(); + let footer = match &rendered_label.object { + LabeledObject::Float { caption, .. } => Some(caption.clone()), + _ => None, + }; + + let text = format!("{} {}", label.name.text, rendered_label.reference()); + + builder.label(range, &label.name.text, kind, header, footer, text); + } + None => { + let kind = Structure::Label; + let header = None; + let footer = None; + let text = label.name.text.clone(); + builder.label(range, &label.name.text, kind, header, footer, text); + } + } + } + } + + Some(()) +} + +fn find_reference(context: &CursorContext) -> Option<(TextRange, bool)> { + let (_, range, group) = context.find_curly_group_word_list()?; + let reference = latex::LabelReference::cast(group.syntax().parent()?)?; + let is_math = reference.command()?.text() == "\\eqref"; + Some((range, is_math)) +} + +fn find_reference_range(context: &CursorContext) -> Option<(TextRange, bool)> { + let (_, range, group) = context.find_curly_group_word()?; + latex::LabelReferenceRange::cast(group.syntax().parent()?)?; + Some((range, false)) +} diff --git a/support/texlab/crates/texlab/src/features/completion/theorem.rs b/support/texlab/crates/texlab/src/features/completion/theorem.rs new file mode 100644 index 0000000000..1ac904234c --- /dev/null +++ b/support/texlab/crates/texlab/src/features/completion/theorem.rs @@ -0,0 +1,21 @@ +use base_db::DocumentData; + +use crate::util::cursor::CursorContext; + +use super::builder::CompletionBuilder; + +pub fn complete<'db>( + context: &'db CursorContext, + builder: &mut CompletionBuilder<'db>, +) -> Option<()> { + let (_, range) = context.find_environment_name()?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + for theorem in &data.semantics.theorem_definitions { + builder.user_environment(range, &theorem.name.text); + } + } + + Some(()) +} diff --git a/support/texlab/src/features/completion/tikz_library.rs b/support/texlab/crates/texlab/src/features/completion/tikz_library.rs index 7ea26d50c2..5f09142cfd 100644 --- a/support/texlab/src/features/completion/tikz_library.rs +++ b/support/texlab/crates/texlab/src/features/completion/tikz_library.rs @@ -1,9 +1,7 @@ use rowan::ast::AstNode; +use syntax::latex; -use crate::{ - syntax::latex, - util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}, -}; +use crate::util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}; use super::builder::CompletionBuilder; diff --git a/support/texlab/crates/texlab/src/features/completion/user_command.rs b/support/texlab/crates/texlab/src/features/completion/user_command.rs new file mode 100644 index 0000000000..26708e69ec --- /dev/null +++ b/support/texlab/crates/texlab/src/features/completion/user_command.rs @@ -0,0 +1,21 @@ +use base_db::DocumentData; + +use crate::util::cursor::CursorContext; + +use super::builder::CompletionBuilder; + +pub fn complete<'db>( + context: &'db CursorContext, + builder: &mut CompletionBuilder<'db>, +) -> Option<()> { + let range = context.cursor.command_range(context.offset)?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + for (_, name) in data.semantics.commands.iter().filter(|(r, _)| *r != range) { + builder.user_command(range, name); + } + } + + Some(()) +} diff --git a/support/texlab/crates/texlab/src/features/completion/user_environment.rs b/support/texlab/crates/texlab/src/features/completion/user_environment.rs new file mode 100644 index 0000000000..4e06eac6da --- /dev/null +++ b/support/texlab/crates/texlab/src/features/completion/user_environment.rs @@ -0,0 +1,26 @@ +use base_db::DocumentData; + +use crate::util::cursor::CursorContext; + +use super::builder::CompletionBuilder; + +pub fn complete<'db>( + context: &'db CursorContext, + builder: &mut CompletionBuilder<'db>, +) -> Option<()> { + let (name, range) = context.find_environment_name()?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + for name in data + .semantics + .environments + .iter() + .filter(|n| n.as_str() != name) + { + builder.user_environment(range, name); + } + } + + Some(()) +} diff --git a/support/texlab/src/features/definition.rs b/support/texlab/crates/texlab/src/features/definition.rs index 5843882bd0..c1a5f5162b 100644 --- a/support/texlab/src/features/definition.rs +++ b/support/texlab/crates/texlab/src/features/definition.rs @@ -4,21 +4,18 @@ mod entry; mod label; mod string; +use base_db::{Document, Workspace}; use lsp_types::{GotoDefinitionResponse, LocationLink, Position, Url}; use rowan::TextRange; -use crate::{ - db::Document, - util::{cursor::CursorContext, line_index_ext::LineIndexExt}, - Db, -}; +use crate::util::{cursor::CursorContext, line_index_ext::LineIndexExt}; pub fn goto_definition( - db: &dyn Db, + workspace: &Workspace, uri: &Url, position: Position, ) -> Option<GotoDefinitionResponse> { - let context = CursorContext::new(db, uri, position, ())?; + let context = CursorContext::new(workspace, uri, position, ())?; log::debug!("[Definition] Cursor: {:?}", context.cursor); let links: Vec<_> = command::goto_definition(&context) @@ -31,12 +28,12 @@ pub fn goto_definition( let origin_selection_range = Some( context .document - .line_index(db) + .line_index .line_col_lsp_range(result.origin_selection_range), ); - let target_line_index = result.target.line_index(db); - let target_uri = result.target.location(context.db).uri(context.db).clone(); + let target_line_index = &result.target.line_index; + let target_uri = result.target.uri.clone(); let target_range = target_line_index.line_col_lsp_range(result.target_range); let target_selection_range = @@ -55,9 +52,9 @@ pub fn goto_definition( } #[derive(Debug, Clone)] -struct DefinitionResult { +struct DefinitionResult<'a> { origin_selection_range: TextRange, - target: Document, + target: &'a Document, target_range: TextRange, target_selection_range: TextRange, } diff --git a/support/texlab/crates/texlab/src/features/definition/command.rs b/support/texlab/crates/texlab/src/features/definition/command.rs new file mode 100644 index 0000000000..9707247019 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/definition/command.rs @@ -0,0 +1,45 @@ +use base_db::DocumentData; +use rowan::ast::AstNode; +use syntax::latex; + +use crate::util::cursor::CursorContext; + +use super::DefinitionResult; + +pub(super) fn goto_definition<'a>( + context: &CursorContext<'a>, +) -> Option<Vec<DefinitionResult<'a>>> { + let name = context + .cursor + .as_tex() + .filter(|token| token.kind() == latex::COMMAND_NAME)?; + + let origin_selection_range = name.text_range(); + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + let root = data.root_node(); + if let Some(result) = root + .descendants() + .filter_map(latex::CommandDefinition::cast) + .filter(|def| { + def.name() + .and_then(|name| name.command()) + .map_or(false, |node| node.text() == name.text()) + }) + .find_map(|def| { + Some(DefinitionResult { + origin_selection_range, + target: document, + target_range: latex::small_range(&def), + target_selection_range: def.name()?.command()?.text_range(), + }) + }) + { + return Some(vec![result]); + } + } + + None +} diff --git a/support/texlab/src/features/definition/document.rs b/support/texlab/crates/texlab/src/features/definition/document.rs index 40cfdf1d38..a035eec718 100644 --- a/support/texlab/src/features/definition/document.rs +++ b/support/texlab/crates/texlab/src/features/definition/document.rs @@ -1,21 +1,22 @@ use rowan::TextRange; -use crate::{db::dependency_graph, util::cursor::CursorContext}; +use crate::util::cursor::CursorContext; use super::DefinitionResult; -pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionResult>> { - let db = context.db; +pub(super) fn goto_definition<'a>( + context: &CursorContext<'a>, +) -> Option<Vec<DefinitionResult<'a>>> { context .workspace - .parents(db, context.document) + .parents(context.document) .iter() .copied() .chain(std::iter::once(context.document)) - .flat_map(|parent| dependency_graph(db, parent).edges.iter()) + .flat_map(|parent| base_db::graph::Graph::new(context.workspace, parent).edges) .filter(|edge| edge.source == context.document) .find_map(|edge| { - let range = edge.origin?.link.range(db); + let range = edge.weight?.link.path.range; if range.contains_inclusive(context.offset) { Some(vec![DefinitionResult { origin_selection_range: range, diff --git a/support/texlab/crates/texlab/src/features/definition/entry.rs b/support/texlab/crates/texlab/src/features/definition/entry.rs new file mode 100644 index 0000000000..9cced101ff --- /dev/null +++ b/support/texlab/crates/texlab/src/features/definition/entry.rs @@ -0,0 +1,42 @@ +use base_db::DocumentData; +use rowan::ast::AstNode; +use syntax::{ + bibtex::{self, HasName}, + latex, +}; + +use crate::util::cursor::CursorContext; + +use super::DefinitionResult; + +pub(super) fn goto_definition<'a>( + context: &CursorContext<'a>, +) -> Option<Vec<DefinitionResult<'a>>> { + let word = context + .cursor + .as_tex() + .filter(|token| token.kind() == latex::WORD)?; + + let key = latex::Key::cast(word.parent()?)?; + + latex::Citation::cast(key.syntax().parent()?.parent()?)?; + + let origin_selection_range = latex::small_range(&key); + + for document in &context.project.documents { + let DocumentData::Bib(data) = &document.data else { continue }; + + for entry in data.root_node().children().filter_map(bibtex::Entry::cast) { + if let Some(key) = entry.name_token().filter(|k| k.text() == word.text()) { + return Some(vec![DefinitionResult { + origin_selection_range, + target: document, + target_selection_range: key.text_range(), + target_range: entry.syntax().text_range(), + }]); + } + } + } + + None +} diff --git a/support/texlab/crates/texlab/src/features/definition/label.rs b/support/texlab/crates/texlab/src/features/definition/label.rs new file mode 100644 index 0000000000..84f17b5704 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/definition/label.rs @@ -0,0 +1,37 @@ +use base_db::{semantics::tex::LabelKind, DocumentData}; + +use crate::util::{self, cursor::CursorContext}; + +use super::DefinitionResult; + +pub(super) fn goto_definition<'a>( + context: &CursorContext<'a>, +) -> Option<Vec<DefinitionResult<'a>>> { + let (name_text, origin_selection_range) = context + .find_label_name_key() + .or_else(|| context.find_label_name_command())?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + let Some(label) = data + .semantics + .labels + .iter() + .filter(|label| label.kind == LabelKind::Definition) + .find(|label| label.name.text == name_text) else { continue }; + + let target_selection_range = label.name.range; + let target_range = util::label::render(context.workspace, &context.project, label) + .map_or(target_selection_range, |label| label.range); + + return Some(vec![DefinitionResult { + origin_selection_range, + target: document, + target_range, + target_selection_range, + }]); + } + + None +} diff --git a/support/texlab/src/features/definition/string.rs b/support/texlab/crates/texlab/src/features/definition/string.rs index 44ea1e9094..420d2818ea 100644 --- a/support/texlab/src/features/definition/string.rs +++ b/support/texlab/crates/texlab/src/features/definition/string.rs @@ -1,15 +1,16 @@ +use base_db::DocumentData; use rowan::ast::AstNode; +use syntax::bibtex::{self, HasName}; -use crate::{ - syntax::bibtex::{self, HasName}, - util::cursor::CursorContext, -}; +use crate::util::cursor::CursorContext; use super::DefinitionResult; -pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionResult>> { - let db = context.db; - let data = context.document.parse(db).as_bib()?; +pub(super) fn goto_definition<'a>( + context: &CursorContext<'a>, +) -> Option<Vec<DefinitionResult<'a>>> { + let DocumentData::Bib(data) = &context.document.data else { return None }; + let key = context .cursor .as_bib() @@ -19,7 +20,7 @@ pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionR let origin_selection_range = key.text_range(); - data.root(db) + data.root_node() .children() .filter_map(bibtex::StringDef::cast) .find_map(|string| { diff --git a/support/texlab/src/features/folding.rs b/support/texlab/crates/texlab/src/features/folding.rs index 44ddc0c4fd..5d98736176 100644 --- a/support/texlab/src/features/folding.rs +++ b/support/texlab/crates/texlab/src/features/folding.rs @@ -1,21 +1,17 @@ +use base_db::{DocumentData, Workspace}; use lsp_types::{FoldingRange, FoldingRangeKind, Range, Url}; use rowan::ast::AstNode; +use syntax::{bibtex, latex}; -use crate::{ - db::{parse::DocumentData, Workspace}, - syntax::{bibtex, latex}, - util::line_index_ext::LineIndexExt, - Db, -}; +use crate::util::line_index_ext::LineIndexExt; -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.line_index(db); - let foldings = match document.parse(db) { +pub fn find_all(workspace: &Workspace, uri: &Url) -> Option<Vec<FoldingRange>> { + let document = workspace.lookup(uri)?; + let line_index = &document.line_index; + let foldings = match &document.data { DocumentData::Tex(data) => { let mut results = Vec::new(); - let root = data.root(db); - for node in root.descendants() { + for node in data.root_node().descendants() { if let Some(folding) = latex::Environment::cast(node.clone()) .map(|node| latex::small_range(&node)) .or_else(|| { @@ -32,7 +28,7 @@ pub fn find_all(db: &dyn Db, uri: &Url) -> Option<Vec<FoldingRange>> { results } DocumentData::Bib(data) => { - let root = data.root(db); + let root = data.root_node(); root.descendants() .filter(|node| { matches!( @@ -43,7 +39,10 @@ pub fn find_all(db: &dyn Db, uri: &Url) -> Option<Vec<FoldingRange>> { .map(|node| create_range(line_index.line_col_lsp_range(node.text_range()))) .collect() } - DocumentData::Log(_) | DocumentData::TexlabRoot(_) | DocumentData::Tectonic(_) => { + DocumentData::Aux(_) + | DocumentData::Log(_) + | DocumentData::Root + | DocumentData::Tectonic => { return None; } }; diff --git a/support/texlab/crates/texlab/src/features/formatting.rs b/support/texlab/crates/texlab/src/features/formatting.rs new file mode 100644 index 0000000000..f16ee8e243 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/formatting.rs @@ -0,0 +1,29 @@ +mod bibtex_internal; +mod latexindent; + +use base_db::{Formatter, Workspace}; +use distro::Language; +use lsp_types::{FormattingOptions, TextEdit, Url}; + +use self::{bibtex_internal::format_bibtex_internal, latexindent::format_with_latexindent}; + +pub fn format_source_code( + workspace: &Workspace, + uri: &Url, + options: &FormattingOptions, +) -> Option<Vec<TextEdit>> { + let document = workspace.lookup(uri)?; + match document.language { + Language::Tex => match workspace.config().formatting.tex_formatter { + Formatter::Null => None, + Formatter::Server => None, + Formatter::LatexIndent => format_with_latexindent(workspace, document), + }, + Language::Bib => match workspace.config().formatting.bib_formatter { + Formatter::Null => None, + Formatter::Server => format_bibtex_internal(workspace, document, options), + Formatter::LatexIndent => format_with_latexindent(workspace, document), + }, + Language::Aux | Language::Log | Language::Root | Language::Tectonic => None, + } +} diff --git a/support/texlab/src/features/formatting/bibtex_internal.rs b/support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs index 5026c512f2..7ffca6e840 100644 --- a/support/texlab/src/features/formatting/bibtex_internal.rs +++ b/support/texlab/crates/texlab/src/features/formatting/bibtex_internal.rs @@ -1,16 +1,13 @@ +use base_db::{Document, LineIndex, Workspace}; use lsp_types::{FormattingOptions, TextEdit}; use rowan::{ast::AstNode, NodeOrToken}; +use syntax::bibtex::{self, HasName, HasType, HasValue}; -use crate::{ - db::Document, - syntax::bibtex::{self, HasName, HasType, HasValue}, - util::{line_index::LineIndex, line_index_ext::LineIndexExt}, - Db, -}; +use crate::util::line_index_ext::LineIndexExt; pub fn format_bibtex_internal( - db: &dyn Db, - document: Document, + workspace: &Workspace, + document: &Document, options: &FormattingOptions, ) -> Option<Vec<TextEdit>> { let mut indent = String::new(); @@ -23,13 +20,14 @@ pub fn format_bibtex_internal( indent.push('\t'); } - let line_length = db.config().formatting.line_length; + let line_length = workspace.config().formatting.line_length; - let line_index = document.line_index(db); - let data = document.parse(db).as_bib()?; + let line_index = &document.line_index; + + let data = document.data.as_bib()?; let mut edits = Vec::new(); - for node in data.root(db).children().filter(|node| { + for node in data.root_node().children().filter(|node| { matches!( node.kind(), bibtex::PREAMBLE | bibtex::STRING | bibtex::ENTRY diff --git a/support/texlab/src/features/formatting/latexindent.rs b/support/texlab/crates/texlab/src/features/formatting/latexindent.rs index 087b8f0941..c269550b74 100644 --- a/support/texlab/src/features/formatting/latexindent.rs +++ b/support/texlab/crates/texlab/src/features/formatting/latexindent.rs @@ -3,33 +3,30 @@ use std::{ process::{Command, Stdio}, }; +use base_db::{Document, LatexIndentConfig, Workspace}; +use distro::Language; use lsp_types::TextEdit; use rowan::{TextLen, TextRange}; use tempfile::tempdir; -use crate::{ - db::{Document, Language, Workspace}, - util::line_index_ext::LineIndexExt, - Db, LatexIndentConfig, -}; +use crate::util::line_index_ext::LineIndexExt; -pub fn format_with_latexindent(db: &dyn Db, document: Document) -> Option<Vec<TextEdit>> { - let workspace = Workspace::get(db); - let config = db.config(); +pub fn format_with_latexindent( + workspace: &Workspace, + document: &Document, +) -> Option<Vec<TextEdit>> { + let config = workspace.config(); let target_dir = tempdir().ok()?; - let source_dir = workspace - .working_dir(db, document.directory(db)) - .path(db) - .as_deref()?; + let source_dir = workspace.current_dir(&document.dir).to_file_path().ok()?; let target_file = target_dir .path() - .join(if document.language(db) == Language::Bib { + .join(if document.language == Language::Bib { "file.bib" } else { "file.tex" }); - std::fs::write(&target_file, document.text(db)).ok()?; + std::fs::write(&target_file, &document.text).ok()?; let args = build_arguments(&config.formatting.latex_indent, &target_file); @@ -48,12 +45,12 @@ pub fn format_with_latexindent(db: &dyn Db, document: Document) -> Option<Vec<Te .output() .ok()?; - let old_text = document.text(db); + let old_text = &document.text; let new_text = String::from_utf8_lossy(&output.stdout).into_owned(); if new_text.is_empty() { None } else { - let line_index = document.line_index(db); + let line_index = &document.line_index; Some(vec![TextEdit { range: line_index.line_col_lsp_range(TextRange::new(0.into(), old_text.text_len())), new_text, diff --git a/support/texlab/src/features/forward_search.rs b/support/texlab/crates/texlab/src/features/forward_search.rs index 350fdd02b9..019c08022e 100644 --- a/support/texlab/src/features/forward_search.rs +++ b/support/texlab/crates/texlab/src/features/forward_search.rs @@ -4,11 +4,12 @@ use std::{ process::Stdio, }; +use base_db::Workspace; use log::error; use lsp_types::{Position, Url}; use thiserror::Error; -use crate::{db::Workspace, util::line_index_ext::LineIndexExt, Db}; +use crate::util::line_index_ext::LineIndexExt; #[derive(Debug, Error)] pub enum Error { @@ -37,49 +38,48 @@ pub struct Command { } impl Command { - pub fn configure(db: &dyn Db, uri: &Url, position: Option<Position>) -> Result<Self, Error> { - let workspace = Workspace::get(db); + pub fn configure( + workspace: &Workspace, + uri: &Url, + position: Option<Position>, + ) -> Result<Self, Error> { let child = workspace - .lookup_uri(db, uri) + .lookup(uri) .ok_or_else(|| Error::TexNotFound(uri.clone()))?; - let parent = workspace - .parents(db, child) - .iter() - .copied() - .next() - .unwrap_or(child); + let parent = *workspace.parents(child).iter().next().unwrap_or(&child); + if parent.uri.scheme() != "file" { + return Err(Error::NoLocalFile(parent.uri.clone())); + } let output_dir = workspace - .output_dir(db, workspace.working_dir(db, parent.directory(db))) - .path(db) - .as_deref() - .ok_or_else(|| Error::NoLocalFile(uri.clone()))?; + .output_dir(&workspace.current_dir(&parent.dir)) + .to_file_path() + .unwrap(); let tex_path = child - .location(db) - .path(db) + .path .as_deref() .ok_or_else(|| Error::NoLocalFile(uri.clone()))?; - let pdf_path = match parent.location(db).stem(db) { - Some(stem) => { - let pdf_name = format!("{}.pdf", stem); - output_dir.join(pdf_name) - } - None => { - return Err(Error::InvalidTexFile(uri.clone())); - } + let pdf_path = match parent + .path + .as_deref() + .unwrap() + .file_stem() + .and_then(|stem| stem.to_str()) + { + Some(stem) => output_dir.join(format!("{}.pdf", stem)), + None => return Err(Error::InvalidTexFile(uri.clone())), }; if !pdf_path.exists() { return Err(Error::PdfNotFound(pdf_path)); } - let position = - position.unwrap_or_else(|| child.line_index(db).line_col_lsp(child.cursor(db))); + let position = position.unwrap_or_else(|| child.line_index.line_col_lsp(child.cursor)); - let Some(config) = &db.config().synctex else { + let Some(config) = &workspace.config().synctex else { return Err(Error::Unconfigured); }; diff --git a/support/texlab/crates/texlab/src/features/highlight.rs b/support/texlab/crates/texlab/src/features/highlight.rs new file mode 100644 index 0000000000..c2f5337aec --- /dev/null +++ b/support/texlab/crates/texlab/src/features/highlight.rs @@ -0,0 +1,15 @@ +mod label; + +use base_db::Workspace; +use lsp_types::{DocumentHighlight, Position, Url}; + +use crate::util::cursor::CursorContext; + +pub fn find_all( + workspace: &Workspace, + uri: &Url, + position: Position, +) -> Option<Vec<DocumentHighlight>> { + let context = CursorContext::new(workspace, uri, position, ())?; + label::find_highlights(&context) +} diff --git a/support/texlab/crates/texlab/src/features/highlight/label.rs b/support/texlab/crates/texlab/src/features/highlight/label.rs new file mode 100644 index 0000000000..171b5e4301 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/highlight/label.rs @@ -0,0 +1,30 @@ +use base_db::{semantics::tex::LabelKind, DocumentData}; +use lsp_types::{DocumentHighlight, DocumentHighlightKind}; + +use crate::util::{cursor::CursorContext, line_index_ext::LineIndexExt}; + +pub fn find_highlights(context: &CursorContext) -> Option<Vec<DocumentHighlight>> { + let (name_text, _) = context.find_label_name_key()?; + + let DocumentData::Tex(data) = &context.document.data else { return None }; + + let mut highlights = Vec::new(); + let line_index = &context.document.line_index; + for label in data + .semantics + .labels + .iter() + .filter(|label| label.name.text == name_text) + { + let range = line_index.line_col_lsp_range(label.name.range); + let kind = Some(match label.kind { + LabelKind::Definition => DocumentHighlightKind::WRITE, + LabelKind::Reference => DocumentHighlightKind::READ, + LabelKind::ReferenceRange => DocumentHighlightKind::READ, + }); + + highlights.push(DocumentHighlight { range, kind }); + } + + Some(highlights) +} diff --git a/support/texlab/src/features/hover.rs b/support/texlab/crates/texlab/src/features/hover.rs index 6baeab8ad6..0c70c48099 100644 --- a/support/texlab/src/features/hover.rs +++ b/support/texlab/crates/texlab/src/features/hover.rs @@ -5,16 +5,14 @@ mod field; mod label; mod string_ref; +use base_db::Workspace; use lsp_types::{Hover, HoverContents, MarkupContent, MarkupKind, Position, Url}; use rowan::TextRange; -use crate::{ - util::{cursor::CursorContext, line_index_ext::LineIndexExt}, - Db, -}; +use crate::util::{cursor::CursorContext, line_index_ext::LineIndexExt}; -pub fn find(db: &dyn Db, uri: &Url, position: Position) -> Option<Hover> { - let context = CursorContext::new(db, uri, position, ())?; +pub fn find(workspace: &Workspace, uri: &Url, position: Position) -> Option<Hover> { + let context = CursorContext::new(workspace, uri, position, ())?; log::debug!("[Hover] Cursor: {:?}", context.cursor); let result = label::find_hover(&context) @@ -24,13 +22,12 @@ 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.line_index(db); Some(Hover { contents: HoverContents::Markup(MarkupContent { kind: result.value_kind, value: result.value, }), - range: Some(line_index.line_col_lsp_range(result.range)), + range: Some(context.document.line_index.line_col_lsp_range(result.range)), }) } diff --git a/support/texlab/src/features/hover/citation.rs b/support/texlab/crates/texlab/src/features/hover/citation.rs index e0e17176d5..1f76404871 100644 --- a/support/texlab/src/features/hover/citation.rs +++ b/support/texlab/crates/texlab/src/features/hover/citation.rs @@ -1,7 +1,8 @@ use lsp_types::MarkupKind; use rowan::ast::AstNode; +use syntax::bibtex; -use crate::{citation, syntax::bibtex, util::cursor::CursorContext}; +use crate::util::cursor::CursorContext; use super::HoverResult; @@ -11,12 +12,11 @@ pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { .or_else(|| context.find_citation_key_command()) .or_else(|| context.find_entry_key())?; - let value = context.related().find_map(|document| { - let data = document.parse(context.db).as_bib()?; - let root = data.root(context.db); - let root = bibtex::Root::cast(root)?; + let value = context.project.documents.iter().find_map(|document| { + let data = document.data.as_bib()?; + let root = bibtex::Root::cast(data.root_node())?; let entry = root.find_entry(&key)?; - citation::render(&entry) + citeproc::render(&entry) })?; Some(HoverResult { diff --git a/support/texlab/crates/texlab/src/features/hover/component.rs b/support/texlab/crates/texlab/src/features/hover/component.rs new file mode 100644 index 0000000000..89954ebf0f --- /dev/null +++ b/support/texlab/crates/texlab/src/features/hover/component.rs @@ -0,0 +1,23 @@ +use base_db::{semantics::tex::LinkKind, DocumentData}; +use lsp_types::MarkupKind; + +use crate::util::{components::COMPONENT_DATABASE, cursor::CursorContext}; + +use super::HoverResult; + +pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { + let DocumentData::Tex(data) = &context.document.data else { return None }; + data.semantics + .links + .iter() + .filter(|link| matches!(link.kind, LinkKind::Sty | LinkKind::Cls)) + .filter(|link| link.path.range.contains_inclusive(context.offset)) + .find_map(|link| { + let value = COMPONENT_DATABASE.documentation(&link.path.text)?.value; + Some(HoverResult { + value, + value_kind: MarkupKind::PlainText, + range: link.path.range, + }) + }) +} diff --git a/support/texlab/src/features/hover/entry_type.rs b/support/texlab/crates/texlab/src/features/hover/entry_type.rs index 0f4ccbdb72..8875b30b2e 100644 --- a/support/texlab/src/features/hover/entry_type.rs +++ b/support/texlab/crates/texlab/src/features/hover/entry_type.rs @@ -1,9 +1,7 @@ use lsp_types::MarkupKind; +use syntax::bibtex; -use crate::{ - syntax::bibtex, - util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}, -}; +use crate::util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}; use super::HoverResult; diff --git a/support/texlab/src/features/hover/field.rs b/support/texlab/crates/texlab/src/features/hover/field.rs index 48193997d6..8787a45c09 100644 --- a/support/texlab/src/features/hover/field.rs +++ b/support/texlab/crates/texlab/src/features/hover/field.rs @@ -1,10 +1,8 @@ use lsp_types::MarkupKind; use rowan::ast::AstNode; +use syntax::bibtex; -use crate::{ - syntax::bibtex, - util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}, -}; +use crate::util::{cursor::CursorContext, lang_data::LANGUAGE_DATA}; use super::HoverResult; diff --git a/support/texlab/crates/texlab/src/features/hover/label.rs b/support/texlab/crates/texlab/src/features/hover/label.rs new file mode 100644 index 0000000000..5ed7ce5121 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/hover/label.rs @@ -0,0 +1,26 @@ +use base_db::semantics::tex::LabelKind; +use lsp_types::MarkupKind; + +use crate::util::{self, cursor::CursorContext}; + +use super::HoverResult; + +pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { + let (name_text, range) = context + .find_label_name_key() + .or_else(|| context.find_label_name_command())?; + + context + .project + .documents + .iter() + .filter_map(|document| document.data.as_tex()) + .flat_map(|data| data.semantics.labels.iter()) + .find(|label| label.kind == LabelKind::Definition && label.name.text == name_text) + .and_then(|label| util::label::render(context.workspace, &context.project, label)) + .map(|label| HoverResult { + range, + value: label.reference(), + value_kind: MarkupKind::PlainText, + }) +} diff --git a/support/texlab/src/features/hover/string_ref.rs b/support/texlab/crates/texlab/src/features/hover/string_ref.rs index 41c4c5bddb..52310ad68e 100644 --- a/support/texlab/src/features/hover/string_ref.rs +++ b/support/texlab/crates/texlab/src/features/hover/string_ref.rs @@ -1,16 +1,15 @@ +use base_db::DocumentData; +use citeproc::field::text::TextFieldData; use lsp_types::MarkupKind; use rowan::ast::AstNode; +use syntax::bibtex::{self, HasName, HasValue}; -use crate::{ - citation::field::text::TextFieldData, - syntax::bibtex::{self, HasName, HasValue}, - util::cursor::CursorContext, -}; +use crate::util::cursor::CursorContext; use super::HoverResult; pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { - let data = context.document.parse(context.db).as_bib()?; + let DocumentData::Bib(data) = &context.document.data else { return None }; let name = context .cursor @@ -22,7 +21,7 @@ pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { })?; for string in data - .root(context.db) + .root_node() .children() .filter_map(bibtex::StringDef::cast) { diff --git a/support/texlab/crates/texlab/src/features/inlay_hint.rs b/support/texlab/crates/texlab/src/features/inlay_hint.rs new file mode 100644 index 0000000000..40e2984ab8 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/inlay_hint.rs @@ -0,0 +1,48 @@ +mod label; + +use base_db::{Document, Project, Workspace}; +use lsp_types::{InlayHint, InlayHintLabel, Range, Url}; +use rowan::{TextRange, TextSize}; + +use crate::util::line_index_ext::LineIndexExt; + +pub fn find_all(workspace: &Workspace, uri: &Url, range: Range) -> Option<Vec<InlayHint>> { + let document = workspace.lookup(uri)?; + let range = document.line_index.offset_lsp_range(range); + let project = workspace.project(document); + + let mut builder = InlayHintBuilder { + workspace, + document, + project, + range, + hints: Vec::new(), + }; + + label::find_hints(&mut builder); + Some(builder.hints) +} + +struct InlayHintBuilder<'a> { + workspace: &'a Workspace, + document: &'a Document, + project: Project<'a>, + range: TextRange, + hints: Vec<InlayHint>, +} + +impl<'db> InlayHintBuilder<'db> { + pub fn push(&mut self, offset: TextSize, text: String) { + let position = self.document.line_index.line_col_lsp(offset); + self.hints.push(InlayHint { + position, + label: InlayHintLabel::String(text), + kind: None, + text_edits: None, + tooltip: None, + padding_left: Some(true), + padding_right: None, + data: None, + }); + } +} diff --git a/support/texlab/crates/texlab/src/features/inlay_hint/label.rs b/support/texlab/crates/texlab/src/features/inlay_hint/label.rs new file mode 100644 index 0000000000..5269b5742d --- /dev/null +++ b/support/texlab/crates/texlab/src/features/inlay_hint/label.rs @@ -0,0 +1,39 @@ +use base_db::{semantics::tex::LabelKind, DocumentData}; + +use crate::util::{self, label::LabeledObject}; + +use super::InlayHintBuilder; + +pub(super) fn find_hints(builder: &mut InlayHintBuilder) -> Option<()> { + let DocumentData::Tex(data) = &builder.document.data else { return None }; + + let range = builder.range; + for label in data + .semantics + .labels + .iter() + .filter(|label| label.kind == LabelKind::Definition) + .filter(|label| label.name.range.intersect(range).is_some()) + { + let Some(rendered) = util::label::render(builder.workspace, &builder.project, label) else { continue }; + let Some(number) = &rendered.number else { continue }; + + let text = match &rendered.object { + LabeledObject::Section { prefix, .. } => { + format!("{} {}", prefix, number) + } + LabeledObject::Float { kind, .. } => { + format!("{} {}", kind.as_str(), number) + } + LabeledObject::Theorem { kind, .. } => { + format!("{} {}", kind, number) + } + LabeledObject::Equation => format!("Equation ({})", number), + LabeledObject::EnumItem => format!("Item {}", number), + }; + + builder.push(label.name.range.end(), text); + } + + Some(()) +} diff --git a/support/texlab/crates/texlab/src/features/link.rs b/support/texlab/crates/texlab/src/features/link.rs new file mode 100644 index 0000000000..9fb70d8b65 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/link.rs @@ -0,0 +1,38 @@ +mod include; + +use base_db::{Document, Workspace}; +use lsp_types::{DocumentLink, Url}; +use rowan::TextRange; + +use crate::util::line_index_ext::LineIndexExt; + +pub fn find_all(workspace: &Workspace, uri: &Url) -> Option<Vec<DocumentLink>> { + let document = workspace.lookup(uri)?; + let mut builder = LinkBuilder { + workspace, + document, + links: Vec::new(), + }; + + include::find_links(&mut builder); + Some(builder.links) +} + +struct LinkBuilder<'a> { + workspace: &'a Workspace, + document: &'a Document, + links: Vec<DocumentLink>, +} + +impl<'a> LinkBuilder<'a> { + pub fn push(&mut self, range: TextRange, target: &Document) { + let range = self.document.line_index.line_col_lsp_range(range); + let target = Some(target.uri.clone()); + self.links.push(DocumentLink { + range, + target, + tooltip: None, + data: None, + }); + } +} diff --git a/support/texlab/crates/texlab/src/features/link/include.rs b/support/texlab/crates/texlab/src/features/link/include.rs new file mode 100644 index 0000000000..eef47514af --- /dev/null +++ b/support/texlab/crates/texlab/src/features/link/include.rs @@ -0,0 +1,22 @@ +use super::LinkBuilder; + +pub(super) fn find_links(builder: &mut LinkBuilder) -> Option<()> { + let parent = *builder + .workspace + .parents(builder.document) + .iter() + .next() + .unwrap_or(&builder.document); + + let graph = base_db::graph::Graph::new(builder.workspace, parent); + + for edge in &graph.edges { + if edge.source == builder.document { + if let Some(weight) = &edge.weight { + builder.push(weight.link.path.range, edge.target); + } + } + } + + Some(()) +} diff --git a/support/texlab/src/features/reference.rs b/support/texlab/crates/texlab/src/features/reference.rs index 3815accc2f..21243e0b6c 100644 --- a/support/texlab/src/features/reference.rs +++ b/support/texlab/crates/texlab/src/features/reference.rs @@ -2,23 +2,20 @@ mod entry; mod label; mod string; +use base_db::{Document, Workspace}; use lsp_types::{Location, Position, ReferenceContext, Url}; use rowan::TextRange; -use crate::{ - db::Document, - util::{cursor::CursorContext, line_index_ext::LineIndexExt}, - Db, -}; +use crate::util::{cursor::CursorContext, line_index_ext::LineIndexExt}; pub fn find_all( - db: &dyn Db, + workspace: &Workspace, uri: &Url, position: Position, params: &ReferenceContext, ) -> Option<Vec<Location>> { let mut results = Vec::new(); - let context = CursorContext::new(db, uri, position, params)?; + let context = CursorContext::new(workspace, uri, position, params)?; log::debug!("[References] Cursor: {:?}", context.cursor); label::find_all_references(&context, &mut results); entry::find_all_references(&context, &mut results); @@ -27,19 +24,16 @@ pub fn find_all( let locations = results .into_iter() .map(|result| Location { - uri: result.document.location(db).uri(db).clone(), - range: result - .document - .line_index(db) - .line_col_lsp_range(result.range), + uri: result.document.uri.clone(), + range: result.document.line_index.line_col_lsp_range(result.range), }) .collect(); Some(locations) } -#[derive(Debug, Clone)] -struct ReferenceResult { - document: Document, +#[derive(Debug)] +struct ReferenceResult<'a> { + document: &'a Document, range: TextRange, } diff --git a/support/texlab/src/features/reference/entry.rs b/support/texlab/crates/texlab/src/features/reference/entry.rs index 0c8f374cb7..d84e7fa4cb 100644 --- a/support/texlab/src/features/reference/entry.rs +++ b/support/texlab/crates/texlab/src/features/reference/entry.rs @@ -1,31 +1,28 @@ +use base_db::DocumentData; use lsp_types::ReferenceContext; use rowan::ast::AstNode; - -use crate::{ - db::parse::DocumentData, - syntax::{ - bibtex::{self, HasName}, - latex, - }, - util::cursor::CursorContext, +use syntax::{ + bibtex::{self, HasName}, + latex, }; +use crate::util::cursor::CursorContext; + use super::ReferenceResult; -pub(super) fn find_all_references( - context: &CursorContext<&ReferenceContext>, - results: &mut Vec<ReferenceResult>, +pub(super) fn find_all_references<'a>( + context: &CursorContext<'a, &ReferenceContext>, + results: &mut Vec<ReferenceResult<'a>>, ) -> Option<()> { - let db = context.db; let (key_text, _) = context .find_citation_key_word() .or_else(|| context.find_citation_key_command()) .or_else(|| context.find_entry_key())?; - for document in context.related() { - match document.parse(db) { + for document in &context.project.documents { + match &document.data { DocumentData::Tex(data) => { - data.root(db) + data.root_node() .descendants() .filter_map(latex::Citation::cast) .filter_map(|citation| citation.key_list()) @@ -37,7 +34,7 @@ pub(super) fn find_all_references( }); } DocumentData::Bib(data) if context.params.include_declaration => { - data.root(db) + data.root_node() .children() .filter_map(bibtex::Entry::cast) .filter_map(|entry| entry.name_token()) @@ -48,9 +45,10 @@ pub(super) fn find_all_references( }); } DocumentData::Bib(_) + | DocumentData::Aux(_) | DocumentData::Log(_) - | DocumentData::TexlabRoot(_) - | DocumentData::Tectonic(_) => {} + | DocumentData::Root + | DocumentData::Tectonic => {} }; } diff --git a/support/texlab/crates/texlab/src/features/reference/label.rs b/support/texlab/crates/texlab/src/features/reference/label.rs new file mode 100644 index 0000000000..3f0433e0f9 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/reference/label.rs @@ -0,0 +1,36 @@ +use base_db::{semantics::tex::LabelKind, DocumentData}; +use lsp_types::ReferenceContext; + +use crate::util::cursor::CursorContext; + +use super::ReferenceResult; + +pub(super) fn find_all_references<'a>( + context: &CursorContext<'a, &ReferenceContext>, + results: &mut Vec<ReferenceResult<'a>>, +) -> Option<()> { + let (name_text, _) = context + .find_label_name_key() + .or_else(|| context.find_label_name_command())?; + + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + for label in data + .semantics + .labels + .iter() + .filter(|label| label.name.text == name_text) + .filter(|label| { + label.kind != LabelKind::Definition || context.params.include_declaration + }) + { + results.push(ReferenceResult { + document, + range: label.name.range, + }); + } + } + + Some(()) +} diff --git a/support/texlab/src/features/reference/string.rs b/support/texlab/crates/texlab/src/features/reference/string.rs index c4bc6ded3d..eca592309c 100644 --- a/support/texlab/src/features/reference/string.rs +++ b/support/texlab/crates/texlab/src/features/reference/string.rs @@ -1,18 +1,16 @@ +use base_db::DocumentData; use lsp_types::ReferenceContext; use rowan::ast::AstNode; +use syntax::bibtex::{self, HasName}; -use crate::{ - syntax::bibtex::{self, HasName}, - util::cursor::CursorContext, -}; +use crate::util::cursor::CursorContext; use super::ReferenceResult; -pub(super) fn find_all_references( - context: &CursorContext<&ReferenceContext>, - results: &mut Vec<ReferenceResult>, +pub(super) fn find_all_references<'a>( + context: &CursorContext<'a, &ReferenceContext>, + results: &mut Vec<ReferenceResult<'a>>, ) -> Option<()> { - let db = context.db; let name_text = context .cursor .as_bib() @@ -23,8 +21,9 @@ pub(super) fn find_all_references( })? .text(); - let data = context.document.parse(db).as_bib()?; - for node in data.root(db).descendants() { + let DocumentData::Bib(data) = &context.document.data else { return None }; + + for node in data.root_node().descendants() { if let Some(name) = bibtex::StringDef::cast(node.clone()) .and_then(|string| string.name_token()) .filter(|name| context.params.include_declaration && name.text() == name_text) diff --git a/support/texlab/src/features/rename.rs b/support/texlab/crates/texlab/src/features/rename.rs index 51781517b6..3746b9ca44 100644 --- a/support/texlab/src/features/rename.rs +++ b/support/texlab/crates/texlab/src/features/rename.rs @@ -2,33 +2,29 @@ mod command; mod entry; mod label; +use base_db::{Document, Workspace}; use lsp_types::{Position, Range, TextEdit, Url, WorkspaceEdit}; use rowan::TextRange; use rustc_hash::FxHashMap; -use crate::{ - db::Document, - util::{cursor::CursorContext, line_index_ext::LineIndexExt}, - Db, -}; +use crate::util::{cursor::CursorContext, line_index_ext::LineIndexExt}; -pub fn prepare_rename_all(db: &dyn Db, uri: &Url, position: Position) -> Option<Range> { - let context = CursorContext::new(db, uri, position, ())?; +pub fn prepare_rename_all(workspace: &Workspace, uri: &Url, position: Position) -> Option<Range> { + let context = CursorContext::new(workspace, uri, position, ())?; let range = entry::prepare_rename(&context) .or_else(|| label::prepare_rename(&context)) .or_else(|| command::prepare_rename(&context))?; - let line_index = context.document.line_index(db); - Some(line_index.line_col_lsp_range(range)) + Some(context.document.line_index.line_col_lsp_range(range)) } pub fn rename_all( - db: &dyn Db, + workspace: &Workspace, uri: &Url, position: Position, new_name: String, ) -> Option<WorkspaceEdit> { - let context = CursorContext::new(db, uri, position, Params { new_name })?; + let context = CursorContext::new(workspace, uri, position, Params { new_name })?; let result = entry::rename(&context) .or_else(|| label::rename(&context)) .or_else(|| command::rename(&context))?; @@ -37,15 +33,14 @@ pub fn rename_all( .changes .into_iter() .map(|(document, old_edits)| { - let line_index = document.line_index(db); let new_edits = old_edits .into_iter() .map(|Indel { delete, insert }| { - TextEdit::new(line_index.line_col_lsp_range(delete), insert) + TextEdit::new(document.line_index.line_col_lsp_range(delete), insert) }) .collect(); - (document.location(db).uri(db).clone(), new_edits) + (document.uri.clone(), new_edits) }) .collect(); @@ -63,7 +58,7 @@ struct Indel { insert: String, } -#[derive(Debug, PartialEq, Eq, Clone)] -struct RenameResult { - changes: FxHashMap<Document, Vec<Indel>>, +#[derive(Debug)] +struct RenameResult<'a> { + changes: FxHashMap<&'a Document, Vec<Indel>>, } diff --git a/support/texlab/crates/texlab/src/features/rename/command.rs b/support/texlab/crates/texlab/src/features/rename/command.rs new file mode 100644 index 0000000000..5cb14f80d1 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/rename/command.rs @@ -0,0 +1,39 @@ +use base_db::DocumentData; +use rowan::{TextRange, TextSize}; +use rustc_hash::FxHashMap; +use syntax::latex; + +use crate::util::cursor::CursorContext; + +use super::{Indel, Params, RenameResult}; + +pub(super) fn prepare_rename<T>(context: &CursorContext<T>) -> Option<TextRange> { + context.cursor.command_range(context.offset) +} + +pub(super) fn rename<'a>(context: &CursorContext<'a, Params>) -> Option<RenameResult<'a>> { + prepare_rename(context)?; + let name = context.cursor.as_tex()?.text(); + let mut changes = FxHashMap::default(); + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + let root = data.root_node(); + let edits = root + .descendants_with_tokens() + .filter_map(|element| element.into_token()) + .filter(|token| token.kind() == latex::COMMAND_NAME && token.text() == name) + .map(|token| { + let range = token.text_range(); + Indel { + delete: TextRange::new(range.start() + TextSize::from(1), range.end()), + insert: context.params.new_name.clone(), + } + }) + .collect(); + + changes.insert(*document, edits); + } + + Some(RenameResult { changes }) +} diff --git a/support/texlab/src/features/rename/entry.rs b/support/texlab/crates/texlab/src/features/rename/entry.rs index 67c0388f4f..fd1fb183f9 100644 --- a/support/texlab/src/features/rename/entry.rs +++ b/support/texlab/crates/texlab/src/features/rename/entry.rs @@ -1,15 +1,13 @@ +use base_db::DocumentData; use rowan::{ast::AstNode, TextRange}; use rustc_hash::FxHashMap; - -use crate::{ - db::parse::DocumentData, - syntax::{ - bibtex::{self, HasName}, - latex, - }, - util::cursor::CursorContext, +use syntax::{ + bibtex::{self, HasName}, + latex, }; +use crate::util::cursor::CursorContext; + use super::{Indel, Params, RenameResult}; pub(super) fn prepare_rename<T>(context: &CursorContext<T>) -> Option<TextRange> { @@ -20,17 +18,18 @@ pub(super) fn prepare_rename<T>(context: &CursorContext<T>) -> Option<TextRange> Some(range) } -pub(super) fn rename(context: &CursorContext<Params>) -> Option<RenameResult> { +pub(super) fn rename<'a>(context: &CursorContext<'a, Params>) -> Option<RenameResult<'a>> { prepare_rename(context)?; let (key_text, _) = context .find_citation_key_word() .or_else(|| context.find_entry_key())?; let mut changes = FxHashMap::default(); - for document in context.related() { - match document.parse(context.db) { + for document in &context.project.documents { + match &document.data { DocumentData::Tex(data) => { - let root = data.root(context.db); + let root = data.root_node(); + let edits: Vec<_> = root .descendants() .filter_map(latex::Citation::cast) @@ -42,10 +41,11 @@ pub(super) fn rename(context: &CursorContext<Params>) -> Option<RenameResult> { insert: context.params.new_name.clone(), }) .collect(); - changes.insert(document, edits); + + changes.insert(*document, edits); } DocumentData::Bib(data) => { - let root = data.root(context.db); + let root = data.root_node(); let edits: Vec<_> = root .descendants() .filter_map(bibtex::Entry::cast) @@ -56,10 +56,14 @@ pub(super) fn rename(context: &CursorContext<Params>) -> Option<RenameResult> { insert: context.params.new_name.clone(), }) .collect(); - changes.insert(document, edits); + + changes.insert(*document, edits); } - DocumentData::Log(_) | DocumentData::TexlabRoot(_) | DocumentData::Tectonic(_) => {} - } + DocumentData::Aux(_) + | DocumentData::Log(_) + | DocumentData::Root + | DocumentData::Tectonic => {} + }; } Some(RenameResult { changes }) diff --git a/support/texlab/crates/texlab/src/features/rename/label.rs b/support/texlab/crates/texlab/src/features/rename/label.rs new file mode 100644 index 0000000000..803fb61989 --- /dev/null +++ b/support/texlab/crates/texlab/src/features/rename/label.rs @@ -0,0 +1,37 @@ +use base_db::DocumentData; +use rowan::TextRange; +use rustc_hash::FxHashMap; + +use crate::util::cursor::CursorContext; + +use super::{Indel, Params, RenameResult}; + +pub(super) fn prepare_rename<T>(context: &CursorContext<T>) -> Option<TextRange> { + let (_, range) = context.find_label_name_key()?; + Some(range) +} + +pub(super) fn rename<'a>(context: &CursorContext<'a, Params>) -> Option<RenameResult<'a>> { + prepare_rename(context)?; + let (name_text, _) = context.find_label_name_key()?; + + let mut changes = FxHashMap::default(); + for document in &context.project.documents { + let DocumentData::Tex(data) = &document.data else { continue }; + + let edits = data + .semantics + .labels + .iter() + .filter(|label| label.name.text == name_text) + .map(|label| Indel { + delete: label.name.range, + insert: context.params.new_name.clone(), + }) + .collect(); + + changes.insert(*document, edits); + } + + Some(RenameResult { changes }) +} diff --git a/support/texlab/src/features/symbol.rs b/support/texlab/crates/texlab/src/features/symbol.rs index 26a0ec87ef..b8005eaf44 100644 --- a/support/texlab/src/features/symbol.rs +++ b/support/texlab/crates/texlab/src/features/symbol.rs @@ -5,31 +5,35 @@ mod types; use std::cmp::Reverse; -use lsp_types::{DocumentSymbolResponse, SymbolInformation, Url, WorkspaceSymbolParams}; +use base_db::Workspace; +use lsp_types::{ + ClientCapabilities, DocumentSymbolResponse, SymbolInformation, Url, WorkspaceSymbolParams, +}; -use crate::{db::Workspace, util::capabilities::ClientCapabilitiesExt, Db}; +use crate::util::capabilities::ClientCapabilitiesExt; use self::{project_order::ProjectOrdering, types::InternalSymbol}; -pub fn find_document_symbols(db: &dyn Db, uri: &Url) -> Option<DocumentSymbolResponse> { - let workspace = Workspace::get(db); - let document = workspace.lookup_uri(db, uri)?; +pub fn find_document_symbols( + workspace: &Workspace, + uri: &Url, + client_capabilties: &ClientCapabilities, +) -> Option<DocumentSymbolResponse> { + let document = workspace.lookup(uri)?; + let project = workspace.project(document); let mut buf = Vec::new(); - latex::find_symbols(db, document, &mut buf); - bibtex::find_symbols(db, document, &mut buf); + latex::find_symbols(workspace, &project, document, &mut buf); + bibtex::find_symbols(document, &mut buf); - let config = &db.config().symbols; + let config = &workspace.config().symbols; - InternalSymbol::filter(&mut buf, &config); + InternalSymbol::filter(&mut buf, config); - if workspace - .client_capabilities(db) - .has_hierarchical_document_symbol_support() - { + if client_capabilties.has_hierarchical_document_symbol_support() { let symbols = buf .into_iter() - .map(|symbol| symbol.into_document_symbol(db)) + .map(|symbol| symbol.into_document_symbol()) .collect(); Some(DocumentSymbolResponse::Nested(symbols)) @@ -44,7 +48,7 @@ pub fn find_document_symbols(db: &dyn Db, uri: &Url) -> Option<DocumentSymbolRes .map(|symbol| symbol.into_symbol_info(uri.clone())) .collect(); - sort_symbols(db, &mut new_buf); + sort_symbols(workspace, &mut new_buf); Some(DocumentSymbolResponse::Flat(new_buf)) } } @@ -57,16 +61,17 @@ struct WorkspaceSymbol { #[must_use] pub fn find_workspace_symbols( - db: &dyn Db, + workspace: &Workspace, params: &WorkspaceSymbolParams, ) -> Vec<SymbolInformation> { let mut symbols = Vec::new(); - let workspace = Workspace::get(db); - for document in workspace.documents(db).iter().copied() { + for document in workspace.iter() { + let project = workspace.project(document); + let mut buf = Vec::new(); - latex::find_symbols(db, document, &mut buf); - bibtex::find_symbols(db, document, &mut buf); + latex::find_symbols(workspace, &project, document, &mut buf); + bibtex::find_symbols(document, &mut buf); let mut new_buf = Vec::new(); for symbol in buf { @@ -76,7 +81,7 @@ pub fn find_workspace_symbols( for symbol in new_buf { symbols.push(WorkspaceSymbol { search_text: symbol.search_text(), - info: symbol.into_symbol_info(document.location(db).uri(db).clone()), + info: symbol.into_symbol_info(document.uri.clone()), }); } } @@ -102,20 +107,20 @@ pub fn find_workspace_symbols( } } - sort_symbols(db, &mut filtered); + sort_symbols(workspace, &mut filtered); filtered } -fn sort_symbols(db: &dyn Db, symbols: &mut [SymbolInformation]) { - let ordering = ProjectOrdering::new(db); +fn sort_symbols(workspace: &Workspace, symbols: &mut [SymbolInformation]) { + let ordering = ProjectOrdering::new(workspace); symbols.sort_by(|left, right| { let left_key = ( - ordering.get(db, &left.location.uri), + ordering.get(&left.location.uri), left.location.range.start, Reverse(left.location.range.end), ); let right_key = ( - ordering.get(db, &right.location.uri), + ordering.get(&right.location.uri), right.location.range.start, Reverse(right.location.range.end), ); diff --git a/support/texlab/src/features/symbol/bibtex.rs b/support/texlab/crates/texlab/src/features/symbol/bibtex.rs index 80c10ee1ba..6ddfe964ce 100644 --- a/support/texlab/src/features/symbol/bibtex.rs +++ b/support/texlab/crates/texlab/src/features/symbol/bibtex.rs @@ -1,27 +1,22 @@ +use base_db::{Document, DocumentData, LineIndex}; use rowan::ast::AstNode; +use syntax::bibtex::{self, HasName, HasType}; -use crate::{ - db::Document, - syntax::bibtex::{self, HasName, HasType}, - util::{ - lang_data::{BibtexEntryTypeCategory, LANGUAGE_DATA}, - line_index::LineIndex, - line_index_ext::LineIndexExt, - }, - Db, +use crate::util::{ + lang_data::{BibtexEntryTypeCategory, LANGUAGE_DATA}, + line_index_ext::LineIndexExt, }; 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.line_index(db); - for node in data.root(db).children() { +pub fn find_symbols(document: &Document, buf: &mut Vec<InternalSymbol>) { + let DocumentData::Bib(data) = &document.data else { return }; + + let line_index = &document.line_index; + for node in data.root_node().children() { process_string(node.clone(), line_index, buf) .or_else(|| process_entry(node, line_index, buf)); } - - Some(()) } fn process_string( diff --git a/support/texlab/src/features/symbol/latex.rs b/support/texlab/crates/texlab/src/features/symbol/latex.rs index 8bb5680483..0f67f4fbc5 100644 --- a/support/texlab/src/features/symbol/latex.rs +++ b/support/texlab/crates/texlab/src/features/symbol/latex.rs @@ -1,29 +1,36 @@ use std::str::FromStr; +use base_db::{semantics::Span, Document, DocumentData, Project, Workspace}; use lsp_types::Range; -use rowan::ast::AstNode; +use rowan::{ast::AstNode, TextRange}; +use syntax::latex::{self, HasBrack, HasCurly}; use titlecase::titlecase; -use crate::{ - db::{Document, Word, Workspace}, - syntax::latex::{self, HasBrack, HasCurly}, - util::{ - label::{find_caption_by_parent, LabeledFloatKind}, - line_index_ext::LineIndexExt, - }, - Db, +use crate::util::{ + label::{find_caption_by_parent, LabeledFloatKind}, + line_index_ext::LineIndexExt, }; 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_tex()?; - let mut symbols = visit(db, document, data.root(db)); +pub fn find_symbols( + workspace: &Workspace, + project: &Project, + document: &Document, + buf: &mut Vec<InternalSymbol>, +) { + let DocumentData::Tex(data) = &document.data else { return }; + + let mut symbols = visit(workspace, project, document, data.root_node()); buf.append(&mut symbols); - Some(()) } -fn visit(db: &dyn Db, document: Document, node: latex::SyntaxNode) -> Vec<InternalSymbol> { +fn visit( + workspace: &Workspace, + project: &Project, + document: &Document, + node: latex::SyntaxNode, +) -> Vec<InternalSymbol> { let symbol = match node.kind() { latex::PART | latex::CHAPTER @@ -31,23 +38,25 @@ fn visit(db: &dyn Db, document: Document, node: latex::SyntaxNode) -> Vec<Intern | latex::SUBSECTION | latex::SUBSUBSECTION | latex::PARAGRAPH - | latex::SUBPARAGRAPH => visit_section(db, document, node.clone()), - latex::ENUM_ITEM => visit_enum_item(db, document, node.clone()), - latex::EQUATION => visit_equation(db, document, node.clone()), + | latex::SUBPARAGRAPH => visit_section(project, document, node.clone()), + latex::ENUM_ITEM => visit_enum_item(workspace, project, document, node.clone()), + latex::EQUATION => visit_equation(project, document, node.clone()), latex::ENVIRONMENT => latex::Environment::cast(node.clone()) .and_then(|env| env.begin()) .and_then(|begin| begin.name()) .and_then(|name| name.key()) .map(|name| name.to_string()) .and_then(|name| { - if db.config().syntax.math_environments.contains(&name) { - visit_equation_environment(db, document, node.clone()) - } else if db.config().syntax.enum_environments.contains(&name) { - visit_enumeration(db, document, node.clone(), &name) + let config = &workspace.config().syntax; + + if config.math_environments.contains(&name) { + visit_equation_environment(project, document, node.clone()) + } else if config.enum_environments.contains(&name) { + visit_enumeration(project, document, node.clone(), &name) } else if let Ok(float_kind) = LabeledFloatKind::from_str(&name) { - visit_float(db, document, node.clone(), float_kind) + visit_float(project, document, node.clone(), float_kind) } else { - visit_theorem(db, document, node.clone(), &name) + visit_theorem(project, document, node.clone(), &name) } }), _ => None, @@ -56,51 +65,53 @@ fn visit(db: &dyn Db, document: Document, node: latex::SyntaxNode) -> Vec<Intern match symbol { Some(mut parent) => { for child in node.children() { - parent.children.append(&mut visit(db, document, child)); + parent + .children + .append(&mut visit(workspace, project, document, child)); } + vec![parent] } None => { let mut symbols = Vec::new(); for child in node.children() { - symbols.append(&mut visit(db, document, child)); + symbols.append(&mut visit(workspace, project, document, child)); } + symbols } } } fn visit_section( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: latex::SyntaxNode, ) -> Option<InternalSymbol> { let section = latex::Section::cast(node)?; let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(§ion)); let group = section.name()?; let group_text = group.content_text()?; - let symbol = match find_label_by_parent(db, document, section.syntax()) { - Some(NumberedLabel { - name: label, - range: selection_range, - number, - }) => { - let name = match number { - Some(number) => format!("{} {}", number.text(db), group_text), + let label = NumberedLabel::find(project, section.syntax()); + + let symbol = match label { + Some(label) => { + let name = match label.number { + Some(number) => format!("{} {}", number, group_text), None => group_text, }; InternalSymbol { name, - label: Some(label), + label: Some(label.name.text), kind: InternalSymbolKind::Section, deprecated: false, full_range, - selection_range, + selection_range: document.line_index.line_col_lsp_range(label.range), children: Vec::new(), } } @@ -119,11 +130,12 @@ fn visit_section( } fn visit_enum_item( - db: &dyn Db, - document: Document, + workspace: &Workspace, + project: &Project, + document: &Document, node: latex::SyntaxNode, ) -> Option<InternalSymbol> { - let enum_envs = &db.config().syntax.enum_environments; + let enum_envs = &workspace.config().syntax.enum_environments; let enum_item = latex::EnumItem::cast(node.clone())?; if !enum_item .syntax() @@ -138,7 +150,7 @@ fn visit_enum_item( } let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(&enum_item)); let name = enum_item @@ -146,20 +158,14 @@ fn visit_enum_item( .and_then(|label| label.content_text()) .unwrap_or_else(|| "Item".to_string()); - let symbol = match find_label_by_parent(db, document, &node) { - Some(NumberedLabel { - name: label, - range: selection_range, - number, - }) => InternalSymbol { - name: number - .map(|num| num.text(db).clone()) - .unwrap_or_else(|| name.clone()), - label: Some(label), + let symbol = match NumberedLabel::find(project, &node) { + Some(label) => InternalSymbol { + name: label.number.map_or_else(|| name.clone(), String::from), + label: Some(label.name.text), kind: InternalSymbolKind::EnumerationItem, deprecated: false, full_range, - selection_range, + selection_range: document.line_index.line_col_lsp_range(label.range), children: Vec::new(), }, None => InternalSymbol { @@ -172,61 +178,58 @@ fn visit_enum_item( children: Vec::new(), }, }; + Some(symbol) } fn visit_equation( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: latex::SyntaxNode, ) -> Option<InternalSymbol> { let equation = latex::Equation::cast(node)?; let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(&equation)); - make_equation_symbol(db, document, equation.syntax(), full_range) + make_equation_symbol(project, document, equation.syntax(), full_range) } fn visit_equation_environment( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: latex::SyntaxNode, ) -> Option<InternalSymbol> { let environment = latex::Environment::cast(node)?; let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(&environment)); - make_equation_symbol(db, document, environment.syntax(), full_range) + make_equation_symbol(project, document, environment.syntax(), full_range) } fn make_equation_symbol( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: &latex::SyntaxNode, full_range: Range, ) -> Option<InternalSymbol> { - let symbol = match find_label_by_parent(db, document, node) { - Some(NumberedLabel { - name: label, - range: selection_range, - number, - }) => { - let name = match number { - Some(number) => format!("Equation ({})", number.text(db)), + let symbol = match NumberedLabel::find(project, node) { + Some(label) => { + let name = match label.number { + Some(number) => format!("Equation ({})", number), None => "Equation".to_string(), }; InternalSymbol { name, - label: Some(label), + label: Some(label.name.text), kind: InternalSymbolKind::Equation, deprecated: false, full_range, - selection_range, + selection_range: document.line_index.line_col_lsp_range(label.range), children: Vec::new(), } } @@ -240,39 +243,36 @@ fn make_equation_symbol( children: Vec::new(), }, }; + Some(symbol) } fn visit_enumeration( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: latex::SyntaxNode, env_name: &str, ) -> Option<InternalSymbol> { let environment = latex::Environment::cast(node)?; let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(&environment)); let name = titlecase(env_name); - let symbol = match find_label_by_parent(db, document, environment.syntax()) { - Some(NumberedLabel { - name: label, - range: selection_range, - number, - }) => { - let name = match number { - Some(number) => format!("{} {}", name, number.text(db)), + let symbol = match NumberedLabel::find(project, environment.syntax()) { + Some(label) => { + let name = match label.number { + Some(number) => format!("{} {}", name, number), None => name, }; InternalSymbol { name, - label: Some(label), + label: Some(label.name.text), kind: InternalSymbolKind::Enumeration, deprecated: false, full_range, - selection_range, + selection_range: document.line_index.line_col_lsp_range(label.range), children: Vec::new(), } } @@ -290,14 +290,14 @@ fn visit_enumeration( } fn visit_float( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: latex::SyntaxNode, float_kind: LabeledFloatKind, ) -> Option<InternalSymbol> { let environment = latex::Environment::cast(node)?; let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(&environment)); let (float_kind, symbol_kind) = match float_kind { @@ -308,24 +308,20 @@ fn visit_float( }; let caption = find_caption_by_parent(environment.syntax())?; - let symbol = match find_label_by_parent(db, document, environment.syntax()) { - Some(NumberedLabel { - name: label, - range: selection_range, - number, - }) => { - let name = match number { - Some(number) => format!("{} {}: {}", float_kind, number.text(db), caption), + let symbol = match NumberedLabel::find(project, environment.syntax()) { + Some(label) => { + let name = match label.number { + Some(number) => format!("{} {}: {}", float_kind, number, caption), None => format!("{}: {}", float_kind, caption), }; InternalSymbol { name, - label: Some(label), + label: Some(label.name.text), kind: symbol_kind, deprecated: false, full_range, - selection_range, + selection_range: document.line_index.line_col_lsp_range(label.range), children: Vec::new(), } } @@ -344,17 +340,17 @@ fn visit_float( } fn visit_theorem( - db: &dyn Db, - document: Document, + project: &Project, + document: &Document, node: latex::SyntaxNode, environment_name: &str, ) -> Option<InternalSymbol> { - let definition = Workspace::get(db) - .related(db, document) + let definition = project + .documents .iter() - .filter_map(|document| document.parse(db).as_tex()) - .flat_map(|data| data.analyze(db).theorem_environments(db)) - .find(|env| env.name(db).text(db) == environment_name)?; + .filter_map(|document| document.data.as_tex()) + .flat_map(|data| data.semantics.theorem_definitions.iter()) + .find(|theorem| theorem.name.text == environment_name)?; let node = latex::Environment::cast(node)?; let theorem_description = node @@ -363,48 +359,36 @@ fn visit_theorem( .and_then(|option| option.content_text()); let full_range = document - .line_index(db) + .line_index .line_col_lsp_range(latex::small_range(&node)); - let symbol = match find_label_by_parent(db, document, node.syntax()) { - Some(NumberedLabel { - name: label, - range: selection_range, - number, - }) => { - let name = match (number, theorem_description) { + let symbol = match NumberedLabel::find(project, node.syntax()) { + Some(label) => { + let name = match (label.number, theorem_description) { (Some(number), Some(desc)) => { - format!( - "{} {} ({})", - definition.description(db).text(db), - number.text(db), - desc - ) + format!("{} {} ({})", definition.description, number, desc) } - (Some(number), None) => format!( - "{} {}", - definition.description(db).text(db), - number.text(db) - ), - (None, Some(desc)) => format!("{} ({})", definition.description(db).text(db), desc), - (None, None) => definition.description(db).text(db).clone(), + (Some(number), None) => format!("{} {}", definition.description, number), + (None, Some(desc)) => format!("{} ({})", definition.description, desc), + (None, None) => definition.description.clone(), }; InternalSymbol { name, - label: Some(label), + label: Some(label.name.text), kind: InternalSymbolKind::Theorem, deprecated: false, full_range, - selection_range, + selection_range: document.line_index.line_col_lsp_range(label.range), children: Vec::new(), } } None => { let name = match theorem_description { - Some(desc) => format!("{} ({})", definition.description(db).text(db), desc), - None => definition.description(db).text(db).clone(), + Some(desc) => format!("{} ({})", definition.description, desc), + None => definition.description.clone(), }; + InternalSymbol { name, label: None, @@ -416,31 +400,32 @@ fn visit_theorem( } } }; + Some(symbol) } -#[derive(Debug, PartialEq, Eq, Clone)] -struct NumberedLabel { - name: Word, - range: Range, - number: Option<Word>, +#[derive(Debug)] +struct NumberedLabel<'a> { + name: Span, + range: TextRange, + number: Option<&'a str>, } -fn find_label_by_parent( - db: &dyn Db, - document: Document, - parent: &latex::SyntaxNode, -) -> Option<NumberedLabel> { - let node = parent.children().find_map(latex::LabelDefinition::cast)?; - let name = Word::new(db, node.name()?.key()?.to_string()); - let range = document - .line_index(db) - .line_col_lsp_range(latex::small_range(&node)); +impl<'a> NumberedLabel<'a> { + fn find(project: &Project<'a>, parent: &latex::SyntaxNode) -> Option<Self> { + let label = parent.children().find_map(latex::LabelDefinition::cast)?; + let name = Span::from(&label.name()?.key()?); + let number = project + .documents + .iter() + .filter_map(|document| document.data.as_aux()) + .find_map(|data| data.semantics.label_numbers.get(&name.text)) + .map(|number| number.as_str()); - let number = Workspace::get(db).number_of_label(db, document, name); - Some(NumberedLabel { - name, - range, - number, - }) + Some(NumberedLabel { + name, + range: latex::small_range(&label), + number, + }) + } } diff --git a/support/texlab/crates/texlab/src/features/symbol/project_order.rs b/support/texlab/crates/texlab/src/features/symbol/project_order.rs new file mode 100644 index 0000000000..9dfb146f2b --- /dev/null +++ b/support/texlab/crates/texlab/src/features/symbol/project_order.rs @@ -0,0 +1,203 @@ +use base_db::{graph, Document, Workspace}; +use itertools::Itertools; +use lsp_types::Url; + +#[derive(Debug, PartialEq, Eq, Clone)] +pub struct ProjectOrdering<'a> { + ordering: Vec<&'a Document>, +} + +impl<'a> ProjectOrdering<'a> { + pub fn new(workspace: &'a Workspace) -> Self { + let ordering: Vec<_> = workspace + .iter() + .filter(|document| { + document + .data + .as_tex() + .map_or(false, |data| data.semantics.can_be_root) + }) + .chain(workspace.iter()) + .flat_map(|document| { + graph::Graph::new(workspace, document) + .preorder() + .rev() + .collect_vec() + }) + .unique() + .collect(); + + Self { ordering } + } + + pub fn get(&self, uri: &Url) -> usize { + self.ordering + .iter() + .position(|doc| doc.uri == *uri) + .unwrap_or(std::usize::MAX) + } +} + +#[cfg(test)] +mod tests { + use base_db::Owner; + use distro::Language; + use rowan::TextSize; + + use super::*; + + #[test] + fn test_no_cycles() { + let mut workspace = Workspace::default(); + + let a = Url::parse("http://example.com/a.tex").unwrap(); + let b = Url::parse("http://example.com/b.tex").unwrap(); + let c = Url::parse("http://example.com/c.tex").unwrap(); + + workspace.open( + a.clone(), + String::new(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + b.clone(), + String::new(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + c.clone(), + r#"\documentclass{article}\include{b}\include{a}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + let ordering = ProjectOrdering::new(&workspace); + assert_eq!(ordering.get(&a), 0); + assert_eq!(ordering.get(&b), 1); + assert_eq!(ordering.get(&c), 2); + } + + #[test] + fn test_two_layers() { + let mut workspace = Workspace::default(); + + let a = Url::parse("http://example.com/a.tex").unwrap(); + let b = Url::parse("http://example.com/b.tex").unwrap(); + let c = Url::parse("http://example.com/c.tex").unwrap(); + + workspace.open( + a.clone(), + String::new(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + workspace.open( + b.clone(), + r#"\include{a}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + workspace.open( + c.clone(), + r#"\begin{documnent}\include{b}\end{document}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + let ordering = ProjectOrdering::new(&workspace); + assert_eq!(ordering.get(&a), 0); + assert_eq!(ordering.get(&b), 1); + assert_eq!(ordering.get(&c), 2); + } + + #[test] + fn test_cycles() { + let mut workspace = Workspace::default(); + + let a = Url::parse("http://example.com/a.tex").unwrap(); + let b = Url::parse("http://example.com/b.tex").unwrap(); + let c = Url::parse("http://example.com/c.tex").unwrap(); + workspace.open( + a.clone(), + r#"\begin{document}\include{b}\end{document}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + b.clone(), + r#"\include{a}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + c.clone(), + r#"\include{a}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + let ordering = ProjectOrdering::new(&workspace); + assert_ne!(ordering.get(&a), 0); + } + + #[test] + fn test_multiple_roots() { + let mut workspace = Workspace::default(); + + let a = Url::parse("http://example.com/a.tex").unwrap(); + let b = Url::parse("http://example.com/b.tex").unwrap(); + let c = Url::parse("http://example.com/c.tex").unwrap(); + let d = Url::parse("http://example.com/d.tex").unwrap(); + + workspace.open( + a.clone(), + r#"\begin{document}\include{b}\end{document}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + b.clone(), + String::new(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + c.clone(), + String::new(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + workspace.open( + d.clone(), + r#"\begin{document}\include{c}\end{document}"#.to_string(), + Language::Tex, + Owner::Client, + TextSize::default(), + ); + + let ordering = ProjectOrdering::new(&workspace); + assert!(ordering.get(&b) < ordering.get(&a)); + assert!(ordering.get(&c) < ordering.get(&d)); + } +} diff --git a/support/texlab/src/features/symbol/types.rs b/support/texlab/crates/texlab/src/features/symbol/types.rs index 9e8ea28792..b8fc9b462f 100644 --- a/support/texlab/src/features/symbol/types.rs +++ b/support/texlab/crates/texlab/src/features/symbol/types.rs @@ -1,10 +1,7 @@ +use base_db::SymbolConfig; use lsp_types::{DocumentSymbol, Location, Range, SymbolInformation, SymbolKind, Url}; -use crate::{ - db::Word, - util::{self, lang_data::BibtexEntryTypeCategory, lsp_enums::Structure}, - Db, SymbolConfig, -}; +use crate::util::{self, lang_data::BibtexEntryTypeCategory, lsp_enums::Structure}; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum InternalSymbolKind { @@ -43,7 +40,7 @@ impl InternalSymbolKind { #[derive(Debug, PartialEq, Eq, Clone)] pub struct InternalSymbol { pub name: String, - pub label: Option<Word>, + pub label: Option<String>, pub kind: InternalSymbolKind, pub deprecated: bool, pub full_range: Range, @@ -102,17 +99,17 @@ impl InternalSymbol { } } - pub fn into_document_symbol(self, db: &dyn Db) -> DocumentSymbol { + pub fn into_document_symbol(self) -> DocumentSymbol { let children = self .children .into_iter() - .map(|child| child.into_document_symbol(db)) + .map(|child| child.into_document_symbol()) .collect(); #[allow(deprecated)] DocumentSymbol { name: self.name, - detail: self.label.map(|word| word.text(db).clone()), + detail: self.label, kind: self.kind.into_symbol_kind(), deprecated: Some(self.deprecated), range: self.full_range, diff --git a/support/texlab/src/features/workspace_command.rs b/support/texlab/crates/texlab/src/features/workspace_command.rs index cac998125e..cac998125e 100644 --- a/support/texlab/src/features/workspace_command.rs +++ b/support/texlab/crates/texlab/src/features/workspace_command.rs diff --git a/support/texlab/src/features/workspace_command/change_environment.rs b/support/texlab/crates/texlab/src/features/workspace_command/change_environment.rs index ef2c96eae1..a7d2eba6cf 100644 --- a/support/texlab/src/features/workspace_command/change_environment.rs +++ b/support/texlab/crates/texlab/src/features/workspace_command/change_environment.rs @@ -1,6 +1,7 @@ use std::collections::hash_map::HashMap; use anyhow::Result; +use base_db::Workspace; use lsp_types::{ApplyWorkspaceEditParams, TextDocumentPositionParams, TextEdit, WorkspaceEdit}; use rowan::ast::AstNode; use serde::{Deserialize, Serialize}; @@ -9,11 +10,10 @@ use thiserror::Error; use crate::{ normalize_uri, util::{cursor::CursorContext, line_index_ext::LineIndexExt}, - Db, }; fn change_environment_context( - db: &dyn Db, + workspace: &Workspace, args: Vec<serde_json::Value>, ) -> Result<CursorContext<Params>> { let params: ChangeEnvironmentParams = serde_json::from_value( @@ -28,7 +28,7 @@ fn change_environment_context( let position = params.text_document_position.position; CursorContext::new( - db, + workspace, &uri, position, Params { @@ -39,10 +39,10 @@ fn change_environment_context( } pub fn change_environment( - db: &dyn Db, + workspace: &Workspace, args: Vec<serde_json::Value>, ) -> Option<((), ApplyWorkspaceEditParams)> { - let context = change_environment_context(db, args).ok()?; + let context = change_environment_context(workspace, args).ok()?; let (beg, end) = context.find_environment()?; let beg_name = beg.to_string(); @@ -53,10 +53,10 @@ pub fn change_environment( } let new_name = &context.params.new_name; - let line_index = context.document.line_index(db); + let line_index = &context.document.line_index; let mut changes = HashMap::default(); changes.insert( - context.document.location(db).uri(db).clone(), + context.document.uri.clone(), vec![ TextEdit::new( line_index.line_col_lsp_range(beg.syntax().text_range()), diff --git a/support/texlab/src/features/workspace_command/clean.rs b/support/texlab/crates/texlab/src/features/workspace_command/clean.rs index cea22fc687..d11c278d8c 100644 --- a/support/texlab/src/features/workspace_command/clean.rs +++ b/support/texlab/crates/texlab/src/features/workspace_command/clean.rs @@ -1,10 +1,11 @@ use std::process::Stdio; use anyhow::Result; +use base_db::Workspace; use lsp_types::{TextDocumentIdentifier, Url}; use thiserror::Error; -use crate::{db::Workspace, normalize_uri, Db}; +use crate::normalize_uri; #[derive(Debug, Error)] pub enum CleanError { @@ -31,7 +32,11 @@ pub struct CleanCommand { } impl CleanCommand { - pub fn new(db: &dyn Db, options: CleanOptions, args: Vec<serde_json::Value>) -> Result<Self> { + pub fn new( + workspace: &Workspace, + 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)?; @@ -39,26 +44,19 @@ impl CleanCommand { let mut uri = params.uri; normalize_uri(&mut uri); - let workspace = Workspace::get(db); - let document = workspace - .lookup_uri(db, &uri) + .lookup(&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) + .path .as_deref() .ok_or_else(|| CleanError::NoLocalFile(uri.clone()))?; + let current_dir = workspace.current_dir(&document.dir); + + let output_dir = workspace.output_dir(¤t_dir).to_file_path().unwrap(); + let flag = match options { CleanOptions::Auxiliary => "-c", CleanOptions::Artifacts => "-C", diff --git a/support/texlab/crates/texlab/src/features/workspace_command/dep_graph.rs b/support/texlab/crates/texlab/src/features/workspace_command/dep_graph.rs new file mode 100644 index 0000000000..faf20d301e --- /dev/null +++ b/support/texlab/crates/texlab/src/features/workspace_command/dep_graph.rs @@ -0,0 +1,57 @@ +use anyhow::Result; +use base_db::{graph, Document, Workspace}; +use itertools::Itertools; +use std::io::Write; + +use rustc_hash::FxHashMap; + +pub fn show_dependency_graph(workspace: &Workspace) -> Result<String> { + let documents = workspace + .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.uri.as_str(); + let shape = if document + .data + .as_tex() + .map_or(false, |data| data.semantics.can_be_root) + { + "tripleoctagon" + } else if document + .data + .as_tex() + .map_or(false, |data| data.semantics.can_be_compiled) + { + "doubleoctagon" + } else { + "octagon" + }; + + writeln!(&mut writer, "\t{node} [label=\"{label}\", shape={shape}];")?; + } + + for edge in workspace + .iter() + .flat_map(|start| graph::Graph::new(workspace, start).edges) + .unique() + { + let source = &documents[edge.source]; + let target = &documents[edge.target]; + let label = edge + .weight + .as_ref() + .map_or("<artifact>", |weight| &weight.link.path.text); + + writeln!(&mut writer, "\t{source} -> {target} [label=\"{label}\"];")?; + } + + writeln!(&mut writer, "}}")?; + Ok(String::from_utf8(writer)?) +} diff --git a/support/texlab/crates/texlab/src/lib.rs b/support/texlab/crates/texlab/src/lib.rs new file mode 100644 index 0000000000..e17aab362b --- /dev/null +++ b/support/texlab/crates/texlab/src/lib.rs @@ -0,0 +1,33 @@ +mod client; +pub mod features; +mod server; +pub mod util; + +pub use self::{client::LspClient, server::Server}; + +pub(crate) fn normalize_uri(uri: &mut lsp_types::Url) { + fn fix_drive_letter(text: &str) -> Option<String> { + if !text.is_ascii() { + return None; + } + + match &text[1..] { + ":" => Some(text.to_ascii_uppercase()), + "%3A" | "%3a" => Some(format!("{}:", text[0..1].to_ascii_uppercase())), + _ => None, + } + } + + if let Some(mut segments) = uri.path_segments() { + if let Some(mut path) = segments.next().and_then(fix_drive_letter) { + for segment in segments { + path.push('/'); + path.push_str(segment); + } + + uri.set_path(&path); + } + } + + uri.set_fragment(None); +} diff --git a/support/texlab/src/main.rs b/support/texlab/crates/texlab/src/main.rs index ed807f8799..ed807f8799 100644 --- a/support/texlab/src/main.rs +++ b/support/texlab/crates/texlab/src/main.rs diff --git a/support/texlab/src/server.rs b/support/texlab/crates/texlab/src/server.rs index bf0ef64261..0d52c41463 100644 --- a/support/texlab/src/server.rs +++ b/support/texlab/crates/texlab/src/server.rs @@ -1,6 +1,5 @@ mod dispatch; pub mod options; -mod query; use std::{ path::PathBuf, @@ -8,22 +7,22 @@ use std::{ }; use anyhow::Result; +use base_db::{Config, Owner, Workspace}; use crossbeam_channel::{Receiver, Sender}; -use log::{error, info}; +use distro::{Distro, Language}; use lsp_server::{Connection, ErrorCode, Message, RequestId}; use lsp_types::{notification::*, request::*, *}; use once_cell::sync::Lazy; +use parking_lot::RwLock; use rowan::{ast::AstNode, TextSize}; -use rustc_hash::FxHashSet; +use rustc_hash::{FxHashMap, FxHashSet}; use serde::{Deserialize, Serialize}; use serde_repr::{Deserialize_repr, Serialize_repr}; +use syntax::bibtex; use threadpool::ThreadPool; use crate::{ - citation, client::LspClient, - db::{self, discover_dependencies, Document, Language, Owner, Workspace}, - distro::Distro, features::{ build::{self, BuildParams, BuildResult, BuildStatus}, completion::{self, builder::CompletionItemData}, @@ -32,12 +31,10 @@ use crate::{ workspace_command::{change_environment, clean, dep_graph}, }, normalize_uri, - syntax::bibtex, util::{ self, capabilities::ClientCapabilitiesExt, components::COMPONENT_DATABASE, line_index_ext::LineIndexExt, }, - Config, Db, }; use self::options::{Options, StartupOptions}; @@ -49,15 +46,18 @@ enum InternalMessage { FileEvent(notify::Event), ForwardSearch(Url), Diagnostics, - ChktexResult(Url, Vec<db::diagnostics::Diagnostic>), + ChktexResult(Url, Vec<lsp_types::Diagnostic>), } pub struct Server { connection: Arc<Connection>, internal_tx: Sender<InternalMessage>, internal_rx: Receiver<InternalMessage>, + workspace: Arc<RwLock<Workspace>>, client: LspClient, - engine: query::Engine, + client_capabilities: Arc<ClientCapabilities>, + client_info: Option<Arc<ClientInfo>>, + chktex_diagnostics: FxHashMap<Url, Vec<Diagnostic>>, watcher: FileWatcher, pool: ThreadPool, } @@ -71,33 +71,38 @@ impl Server { connection: Arc::new(connection), internal_tx, internal_rx, + workspace: Default::default(), client, - engine: query::Engine::default(), + client_capabilities: Default::default(), + client_info: Default::default(), + chktex_diagnostics: Default::default(), watcher, pool: threadpool::Builder::new().build(), } } - fn run_with_db<R, Q>(&self, id: RequestId, query: Q) + fn run_query<R, Q>(&self, id: RequestId, query: Q) where R: Serialize, - Q: FnOnce(&dyn Db) -> R + Send + 'static, + Q: FnOnce(&Workspace) -> R + Send + 'static, { let client = self.client.clone(); - self.engine.fork(move |db| { - let response = lsp_server::Response::new_ok(id, query(db)); + let workspace = Arc::clone(&self.workspace); + self.pool.execute(move || { + let response = lsp_server::Response::new_ok(id, query(&workspace.read())); client.send_response(response).unwrap(); }); } - fn run_and_request_with_db<R, S, Q>(&self, id: RequestId, query: Q) + fn run_query_and_request<R, S, Q>(&self, id: RequestId, query: Q) where R: Request, S: Serialize, - Q: FnOnce(&dyn Db) -> Option<(S, R::Params)> + Send + 'static, + Q: FnOnce(&Workspace) -> Option<(S, R::Params)> + Send + 'static, { let client = self.client.clone(); - self.engine.fork(move |db| match query(db) { + let workspace = Arc::clone(&self.workspace); + self.pool.execute(move || match query(&workspace.read()) { Some((result, request_params)) => { let response = lsp_server::Response::new_ok(id, result); client.send_response(response).unwrap(); @@ -110,7 +115,7 @@ impl Server { }); } - fn run_errorable<R, Q>(&self, id: RequestId, query: Q) + fn run_fallible<R, Q>(&self, id: RequestId, query: Q) where R: Serialize, Q: FnOnce() -> Result<R> + Send + 'static, @@ -187,31 +192,18 @@ impl Server { let (id, params) = self.connection.initialize_start()?; let params: InitializeParams = serde_json::from_value(params)?; - let db = self.engine.write(); - let workspace = Workspace::get(db); - workspace - .set_client_capabilities(db) - .with_durability(salsa::Durability::HIGH) - .to(params.capabilities); - - db::ServerContext::get(db) - .set_always_incomplete_completion_list(db) - .with_durability(salsa::Durability::HIGH) - .to(params - .client_info - .map_or(false, |client| &client.name == "Visual Studio Code")); - - let root_dirs = params + self.client_capabilities = Arc::new(params.capabilities); + self.client_info = params.client_info.map(Arc::new); + + let workspace_folders = params .workspace_folders .unwrap_or_default() .into_iter() - .map(|folder| db::Location::new(db, folder.uri)) + .filter(|folder| folder.uri.scheme() == "file") + .flat_map(|folder| folder.uri.to_file_path()) .collect(); - workspace - .set_root_dirs(db) - .with_durability(salsa::Durability::HIGH) - .to(root_dirs); + self.workspace.write().set_folders(workspace_folders); let result = InitializeResult { capabilities: self.capabilities(), @@ -235,7 +227,7 @@ impl Server { Distro::default() }); - info!("Detected distribution: {:?}", distro.kind); + log::info!("Detected distribution: {:?}", distro.kind); sender.send(InternalMessage::SetDistro(distro)).unwrap(); }); } @@ -246,12 +238,7 @@ impl Server { } fn register_configuration(&mut self) { - let db = self.engine.read(); - - if Workspace::get(db) - .client_capabilities(db) - .has_push_configuration_support() - { + if self.client_capabilities.has_push_configuration_support() { let registration = Registration { id: "pull-config".to_string(), method: DidChangeConfiguration::METHOD.to_string(), @@ -276,19 +263,27 @@ impl Server { } fn update_workspace(&mut self) { - let db = self.engine.write(); - discover_dependencies(db); - self.watcher.watch(db); + let mut workspace = self.workspace.write(); + workspace.discover(); + self.watcher.watch(&mut workspace); + drop(workspace); self.publish_diagnostics_with_delay(); } fn publish_diagnostics(&mut self) -> Result<()> { - let db = self.engine.read(); + let workspace = self.workspace.read(); + let mut all_diagnostics = util::diagnostics::collect(&workspace); + + for (uri, diagnostics) in &self.chktex_diagnostics { + let Some(document) = workspace.lookup(uri) else { continue }; + let Some(existing) = all_diagnostics.get_mut(document) else { continue }; + existing.extend(diagnostics.iter().cloned()); + } - let all_diagnostics = db::diagnostics::collect_filtered(db, Workspace::get(db)); + util::diagnostics::filter(&mut all_diagnostics, &workspace); for (document, diagnostics) in all_diagnostics { - let uri = document.location(db).uri(db).clone(); + let uri = document.uri.clone(); let version = None; let params = PublishDiagnosticsParams { uri, @@ -304,9 +299,8 @@ impl Server { } fn publish_diagnostics_with_delay(&mut self) { - let db = self.engine.read(); let sender = self.internal_tx.clone(); - let delay = db.config().diagnostics.delay; + let delay = self.workspace.read().config().diagnostics.delay; self.pool.execute(move || { std::thread::sleep(delay); sender.send(InternalMessage::Diagnostics).unwrap(); @@ -314,12 +308,7 @@ impl Server { } fn pull_options(&mut self) { - let db = self.engine.read(); - let workspace = Workspace::get(db); - if !workspace - .client_capabilities(db) - .has_pull_configuration_support() - { + if !self.client_capabilities.has_pull_configuration_support() { return; } @@ -342,20 +331,16 @@ impl Server { sender.send(InternalMessage::SetOptions(options)).unwrap(); } Err(why) => { - error!("Retrieving configuration failed: {}", why); + log::error!("Retrieving configuration failed: {}", why); } }; }); } fn update_options(&mut self, options: Options) { - let db = self.engine.write(); - db::ServerContext::get(db) - .set_config(db) - .with_durability(salsa::Durability::MEDIUM) - .to(Config::from(options)); - - self.watcher.watch(db); + let mut workspace = self.workspace.write(); + workspace.set_config(Config::from(options)); + self.watcher.watch(&mut workspace); } fn cancel(&self, _params: CancelParams) -> Result<()> { @@ -367,12 +352,7 @@ impl Server { } fn did_change_configuration(&mut self, params: DidChangeConfigurationParams) -> Result<()> { - let db = self.engine.read(); - let workspace = Workspace::get(db); - if workspace - .client_capabilities(db) - .has_pull_configuration_support() - { + if self.client_capabilities.has_pull_configuration_support() { self.pull_options(); } else { let options = self.client.parse_options(params.settings)?; @@ -382,25 +362,24 @@ impl Server { Ok(()) } - fn did_open(&mut self, mut params: DidOpenTextDocumentParams) -> Result<()> { - normalize_uri(&mut params.text_document.uri); + fn did_open(&mut self, params: DidOpenTextDocumentParams) -> Result<()> { + let mut uri = params.text_document.uri; + normalize_uri(&mut uri); - let db = self.engine.write(); - let workspace = Workspace::get(db); let language_id = ¶ms.text_document.language_id; let language = Language::from_id(language_id).unwrap_or(Language::Tex); - let document = workspace.open( - db, - params.text_document.uri, + self.workspace.write().open( + uri.clone(), params.text_document.text, language, Owner::Client, + TextSize::default(), ); self.update_workspace(); - if self.engine.read().config().diagnostics.chktex.on_open { - self.run_chktex(document); + if self.workspace.read().config().diagnostics.chktex.on_open { + self.run_chktex(&uri); } Ok(()) @@ -410,37 +389,35 @@ impl Server { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - let db = self.engine.write(); - let workspace = Workspace::get(db); - let document = match workspace.lookup_uri(db, &uri) { - Some(document) => document, - None => return Ok(()), - }; + let mut workspace = self.workspace.write(); for change in params.content_changes { + let Some(document) = workspace.lookup(&uri) else { return Ok(()) }; match change.range { Some(range) => { - let range = document.line_index(db).offset_lsp_range(range); - document.edit(db, range, &change.text); + let range = document.line_index.offset_lsp_range(range); + drop(document); + workspace.edit(&uri, range, &change.text); } None => { - document - .set_text(db) - .with_durability(salsa::Durability::LOW) - .to(change.text); - - document - .set_cursor(db) - .with_durability(salsa::Durability::LOW) - .to(TextSize::from(0)); + let language = document.language; + drop(document); + workspace.open( + uri.clone(), + change.text, + language, + Owner::Client, + TextSize::default(), + ); } }; } + drop(workspace); self.update_workspace(); - if self.engine.read().config().diagnostics.chktex.on_edit { - self.run_chktex(document); + if self.workspace.read().config().diagnostics.chktex.on_edit { + self.run_chktex(&uri); } Ok(()) @@ -450,19 +427,14 @@ impl Server { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - let db = self.engine.read(); - let workspace = Workspace::get(db); - if db.config().build.on_save { + if self.workspace.read().config().build.on_save { self.build_internal(uri.clone(), |_| ())?; } self.publish_diagnostics_with_delay(); - let db = self.engine.read(); - if let Some(document) = workspace.lookup_uri(db, &uri) { - if db.config().diagnostics.chktex.on_save { - self.run_chktex(document); - } + if self.workspace.read().config().diagnostics.chktex.on_save { + self.run_chktex(&uri); } Ok(()) @@ -471,49 +443,47 @@ impl Server { fn did_close(&mut self, params: DidCloseTextDocumentParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - - let db = self.engine.write(); - if let Some(document) = Workspace::get(db).lookup_uri(db, &uri) { - document - .set_owner(db) - .with_durability(salsa::Durability::LOW) - .to(Owner::Server); - } - + self.workspace.write().close(&uri); self.publish_diagnostics_with_delay(); Ok(()) } - fn run_chktex(&mut self, document: Document) { - let db = self.engine.read(); - if let Some(command) = util::chktex::Command::new(db, document) { - let sender = self.internal_tx.clone(); - let uri = document.location(db).uri(db).clone(); - self.pool.execute(move || { - let diagnostics = command.run().unwrap_or_default(); - sender - .send(InternalMessage::ChktexResult(uri, diagnostics)) - .unwrap(); - }); - } + fn run_chktex(&mut self, uri: &Url) { + let workspace = self.workspace.read(); + let Some(document) = workspace.lookup(uri) else { return }; + let Some(command) = util::chktex::Command::new(&workspace, document) else { return }; + + let sender = self.internal_tx.clone(); + let uri = document.uri.clone(); + self.pool.execute(move || { + let diagnostics = command.run().unwrap_or_default(); + sender + .send(InternalMessage::ChktexResult(uri, diagnostics)) + .unwrap(); + }); } fn document_link(&self, id: RequestId, params: DocumentLinkParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.run_with_db(id, move |db| link::find_all(db, &uri).unwrap_or_default()); + self.run_query(id, move |workspace| { + link::find_all(workspace, &uri).unwrap_or_default() + }); Ok(()) } fn document_symbols(&self, id: RequestId, params: DocumentSymbolParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.run_with_db(id, move |db| symbol::find_document_symbols(db, &uri)); + let client_capabilities = Arc::clone(&self.client_capabilities); + self.run_query(id, move |workspace| { + symbol::find_document_symbols(workspace, &uri, &client_capabilities) + }); Ok(()) } fn workspace_symbols(&self, id: RequestId, params: WorkspaceSymbolParams) -> Result<()> { - self.run_with_db(id, move |db| symbol::find_workspace_symbols(db, ¶ms)); + self.run_query(id, move |db| symbol::find_workspace_symbols(db, ¶ms)); Ok(()) } @@ -521,12 +491,22 @@ impl Server { let mut uri = params.text_document_position.text_document.uri; normalize_uri(&mut uri); let position = params.text_document_position.position; - self.run_with_db(id, move |db| completion::complete(db, &uri, position)); + let client_capabilities = Arc::clone(&self.client_capabilities); + let client_info = self.client_info.clone(); + self.run_query(id, move |db| { + completion::complete( + db, + &uri, + position, + &client_capabilities, + client_info.as_deref(), + ) + }); Ok(()) } fn completion_resolve(&self, id: RequestId, mut item: CompletionItem) -> Result<()> { - self.run_with_db(id, move |db| { + self.run_query(id, move |workspace| { match item .data .clone() @@ -538,13 +518,13 @@ impl Server { .map(Documentation::MarkupContent); } Some(CompletionItemData::Citation { uri, key }) => { - if let Some(root) = Workspace::get(db) - .lookup_uri(db, &uri) - .and_then(|document| document.parse(db).as_bib().map(|data| data.root(db))) + if let Some(data) = workspace + .lookup(&uri) + .and_then(|document| document.data.as_bib()) { - item.documentation = bibtex::Root::cast(root) + item.documentation = bibtex::Root::cast(data.root_node()) .and_then(|root| root.find_entry(&key)) - .and_then(|entry| citation::render(&entry)) + .and_then(|entry| citeproc::render(&entry)) .map(|value| { Documentation::MarkupContent(MarkupContent { kind: MarkupKind::Markdown, @@ -565,7 +545,7 @@ impl Server { fn folding_range(&self, id: RequestId, params: FoldingRangeParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { folding::find_all(db, &uri).unwrap_or_default() }); Ok(()) @@ -575,7 +555,7 @@ impl Server { let mut uri = params.text_document_position.text_document.uri; normalize_uri(&mut uri); let position = params.text_document_position.position; - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { reference::find_all(db, &uri, position, ¶ms.context).unwrap_or_default() }); @@ -586,21 +566,18 @@ impl Server { let mut uri = params.text_document_position_params.text_document.uri; normalize_uri(&mut uri); - let db = self.engine.write(); - let workspace = Workspace::get(db); - if let Some(document) = workspace.lookup_uri(db, &uri) { + let workspace = self.workspace.read(); + if let Some(document) = workspace.lookup(&uri) { let position = document - .line_index(db) + .line_index .offset_lsp(params.text_document_position_params.position); - document - .set_cursor(db) - .with_durability(salsa::Durability::LOW) - .to(position); + drop(workspace); + self.workspace.write().set_cursor(&uri, position); } let position = params.text_document_position_params.position; - self.run_with_db(id, move |db| hover::find(db, &uri, position)); + self.run_query(id, move |db| hover::find(db, &uri, position)); Ok(()) } @@ -608,7 +585,7 @@ impl Server { let mut uri = params.text_document_position_params.text_document.uri; normalize_uri(&mut uri); let position = params.text_document_position_params.position; - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { definition::goto_definition(db, &uri, position) }); @@ -618,7 +595,7 @@ impl Server { fn prepare_rename(&self, id: RequestId, params: TextDocumentPositionParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { rename::prepare_rename_all(db, &uri, params.position) }); @@ -629,7 +606,7 @@ impl Server { let mut uri = params.text_document_position.text_document.uri; normalize_uri(&mut uri); let position = params.text_document_position.position; - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { rename::rename_all(db, &uri, position, params.new_name) }); @@ -640,7 +617,7 @@ impl Server { let mut uri = params.text_document_position_params.text_document.uri; normalize_uri(&mut uri); let position = params.text_document_position_params.position; - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { highlight::find_all(db, &uri, position).unwrap_or_default() }); Ok(()) @@ -649,7 +626,7 @@ impl Server { fn formatting(&self, id: RequestId, params: DocumentFormattingParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { formatting::format_source_code(db, &uri, ¶ms.options) }); @@ -659,24 +636,26 @@ impl Server { fn execute_command(&mut self, id: RequestId, params: ExecuteCommandParams) -> Result<()> { match params.command.as_str() { "texlab.cleanAuxiliary" => { - let db = self.engine.read(); + let workspace = self.workspace.read(); let opt = clean::CleanOptions::Auxiliary; - let command = clean::CleanCommand::new(db, opt, params.arguments); - self.run_errorable(id, || command?.run()); + let command = clean::CleanCommand::new(&workspace, opt, params.arguments); + self.run_fallible(id, || command?.run()); } "texlab.cleanArtifacts" => { - let db = self.engine.read(); + let workspace = self.workspace.read(); let opt = clean::CleanOptions::Auxiliary; - let command = clean::CleanCommand::new(db, opt, params.arguments); - self.run_errorable(id, || command?.run()); + let command = clean::CleanCommand::new(&workspace, opt, params.arguments); + self.run_fallible(id, || command?.run()); } "texlab.changeEnvironment" => { - self.run_and_request_with_db::<ApplyWorkspaceEdit, _, _>(id, move |db| { - change_environment::change_environment(db, params.arguments) + self.run_query_and_request::<ApplyWorkspaceEdit, _, _>(id, move |workspace| { + change_environment::change_environment(workspace, params.arguments) }); } "texlab.showDependencyGraph" => { - self.run_with_db(id, move |db| dep_graph::show_dependency_graph(db).unwrap()); + self.run_query(id, move |workspace| { + dep_graph::show_dependency_graph(workspace).unwrap() + }); } _ => { self.client @@ -695,7 +674,7 @@ impl Server { fn inlay_hints(&self, id: RequestId, params: InlayHintParams) -> Result<()> { let mut uri = params.text_document.uri; normalize_uri(&mut uri); - self.run_with_db(id, move |db| { + self.run_query(id, move |db| { inlay_hint::find_all(db, &uri, params.range).unwrap_or_default() }); Ok(()) @@ -735,16 +714,14 @@ impl Server { ) -> Result<()> { static LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(())); - let db = self.engine.read(); - let compiler = match build::Command::new(db, uri.clone(), self.client.clone()) { - Some(compiler) => compiler, - None => { - callback(BuildStatus::FAILURE); - return Ok(()); - } + let workspace = self.workspace.read(); + let client = self.client.clone(); + let Some(compiler) = build::Command::new(&workspace, uri.clone(), client, &self.client_capabilities) else { + callback(BuildStatus::FAILURE); + return Ok(()); }; - let forward_search_after = db.config().build.forward_search_after; + let forward_search_after = workspace.config().build.forward_search_after; let sender = self.internal_tx.clone(); self.pool.execute(move || { @@ -781,8 +758,9 @@ impl Server { position: Option<Position>, callback: impl FnOnce(ForwardSearchStatus) + Send + 'static, ) -> Result<()> { - let db = self.engine.read(); - let command = match forward_search::Command::configure(db, &uri, position) { + let workspace = self.workspace.read(); + + let command = match forward_search::Command::configure(&workspace, &uri, position) { Ok(command) => command, Err(why) => { log::error!("Forward search failed: {}", why); @@ -817,37 +795,27 @@ impl Server { fn handle_file_event(&mut self, event: notify::Event) { let mut changed = false; - let db = self.engine.write(); - let workspace = Workspace::get(db); + let mut workspace = self.workspace.write(); match event.kind { notify::EventKind::Create(_) | notify::EventKind::Modify(_) => { for path in event.paths { if workspace - .lookup_path(db, &path) - .map_or(true, |document| document.owner(db) == Owner::Server) + .lookup_path(&path) + .map_or(true, |document| document.owner == Owner::Server) { if let Some(language) = Language::from_path(&path) { - workspace.load(db, &path, language, Owner::Server); - changed = true; + changed |= workspace.load(&path, language, Owner::Server).is_ok(); } } } } notify::EventKind::Remove(_) => { for path in event.paths { - if let Some(document) = workspace.lookup_path(db, &path) { - if document.owner(db) == Owner::Server { - let mut documents = workspace - .set_documents(db) - .with_durability(salsa::Durability::LOW) - .to(FxHashSet::default()); - - documents.remove(&document); - workspace - .set_documents(db) - .with_durability(salsa::Durability::MEDIUM) - .to(documents); - + if let Some(document) = workspace.lookup_path(&path) { + if document.owner == Owner::Server { + let uri = document.uri.clone(); + drop(document); + workspace.remove(&uri); changed = true; } } @@ -856,6 +824,7 @@ impl Server { notify::EventKind::Any | notify::EventKind::Access(_) | notify::EventKind::Other => {} }; + drop(workspace); if changed { self.publish_diagnostics_with_delay(); } @@ -945,11 +914,7 @@ impl Server { recv(&self.internal_rx) -> msg => { match msg? { InternalMessage::SetDistro(distro) => { - let db = self.engine.write(); - Workspace::get(db) - .set_file_name_db(db) - .with_durability(salsa::Durability::HIGH) - .to(distro.file_name_db); + self.workspace.write().set_distro(distro); } InternalMessage::SetOptions(options) => { self.update_options(options); @@ -964,12 +929,7 @@ impl Server { self.publish_diagnostics()?; } InternalMessage::ChktexResult(uri, diagnostics) => { - let db = self.engine.write(); - let workspace = Workspace::get(db); - if let Some(document) = workspace.lookup_uri(db, &uri) { - document.linter(db).set_chktex(db).to(diagnostics); - } - + self.chktex_diagnostics.insert(uri, diagnostics); self.publish_diagnostics()?; } }; @@ -982,7 +942,6 @@ impl Server { self.initialize()?; self.process_messages()?; self.pool.join(); - self.engine.finish(); Ok(()) } } @@ -1006,9 +965,8 @@ impl FileWatcher { }) } - pub fn watch(&mut self, db: &dyn Db) { - let workspace = Workspace::get(db); - workspace.watch(db, &mut self.watcher, &mut self.watched_dirs); + pub fn watch(&mut self, workspace: &mut Workspace) { + workspace.watch(&mut self.watcher, &mut self.watched_dirs); } } diff --git a/support/texlab/src/server/dispatch.rs b/support/texlab/crates/texlab/src/server/dispatch.rs index f5659ee3b4..add4954d5f 100644 --- a/support/texlab/src/server/dispatch.rs +++ b/support/texlab/crates/texlab/src/server/dispatch.rs @@ -1,5 +1,4 @@ use anyhow::Result; -use log::warn; use lsp_server::{ErrorCode, Notification, Request, RequestId, Response}; use serde::de::DeserializeOwned; @@ -37,7 +36,7 @@ impl NotificationDispatcher { pub fn default(self) { if let Some(not) = &self.not { - warn!("Unknown notification: {}", not.method); + log::warn!("Unknown notification: {}", not.method); } } } @@ -76,7 +75,7 @@ impl RequestDispatcher { pub fn default(self) -> Option<Response> { self.req.map(|req| { - warn!("Unknown request: {}", req.method); + log::warn!("Unknown request: {}", req.method); Response::new_err( req.id, ErrorCode::MethodNotFound as i32, diff --git a/support/texlab/src/server/options.rs b/support/texlab/crates/texlab/src/server/options.rs index 87f49691f0..a955905d3c 100644 --- a/support/texlab/src/server/options.rs +++ b/support/texlab/crates/texlab/src/server/options.rs @@ -1,10 +1,9 @@ use std::time::Duration; +use base_db::{Config, Formatter, SynctexConfig}; use regex::Regex; use serde::{Deserialize, Serialize}; -use crate::{Config, Formatter, SynctexConfig}; - #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] #[serde(default)] diff --git a/support/texlab/src/util.rs b/support/texlab/crates/texlab/src/util.rs index 6f27305f1b..5eed8a3357 100644 --- a/support/texlab/src/util.rs +++ b/support/texlab/crates/texlab/src/util.rs @@ -2,9 +2,9 @@ pub mod capabilities; pub mod chktex; pub mod components; pub mod cursor; +pub mod diagnostics; pub mod label; pub mod lang_data; -pub mod line_index; pub mod line_index_ext; pub mod lsp_enums; pub mod regex_filter; diff --git a/support/texlab/src/util/capabilities.rs b/support/texlab/crates/texlab/src/util/capabilities.rs index 987c0b48dd..987c0b48dd 100644 --- a/support/texlab/src/util/capabilities.rs +++ b/support/texlab/crates/texlab/src/util/capabilities.rs diff --git a/support/texlab/src/util/chktex.rs b/support/texlab/crates/texlab/src/util/chktex.rs index 0774207917..91d74a9cdc 100644 --- a/support/texlab/src/util/chktex.rs +++ b/support/texlab/crates/texlab/src/util/chktex.rs @@ -4,19 +4,14 @@ use std::{ process::Stdio, }; +use base_db::{Document, Workspace}; +use distro::Language; use encoding_rs_io::DecodeReaderBytesBuilder; +use lsp_types::{Diagnostic, NumberOrString}; use lsp_types::{DiagnosticSeverity, Position, Range}; use once_cell::sync::Lazy; use regex::Regex; -use crate::{ - db::{ - diagnostics::{Diagnostic, DiagnosticCode}, - Document, Workspace, - }, - Db, -}; - #[derive(Debug)] pub struct Command { text: String, @@ -24,25 +19,26 @@ pub struct Command { } impl Command { - pub fn new(db: &dyn Db, document: Document) -> Option<Self> { - document.parse(db).as_tex()?; + pub fn new(workspace: &Workspace, document: &Document) -> Option<Self> { + if document.language != Language::Tex { + return None; + } - let workspace = Workspace::get(db); let parent = workspace - .parents(db, document) - .iter() + .parents(document) + .into_iter() .next() - .map_or(document, Clone::clone); + .unwrap_or(document); - let working_dir = workspace - .working_dir(db, parent.directory(db)) - .path(db) - .as_deref()? - .to_owned(); + if parent.uri.scheme() != "file" { + log::warn!("Calling ChkTeX on non-local files is not supported yet."); + return None; + } + let working_dir = workspace.current_dir(&parent.dir).to_file_path().ok()?; log::debug!("Calling ChkTeX from directory: {}", working_dir.display()); - let text = document.text(db).clone(); + let text = document.text.clone(); Some(Self { text, working_dir }) } @@ -88,9 +84,14 @@ impl Command { diagnostics.push(Diagnostic { range, - severity, - code: DiagnosticCode::Chktex(code.into()), + severity: Some(severity), + code: Some(NumberOrString::String(code.into())), message, + code_description: None, + source: Some(String::from("ChkTeX")), + related_information: None, + tags: None, + data: None, }); } diff --git a/support/texlab/src/util/components.rs b/support/texlab/crates/texlab/src/util/components.rs index 022e7efbc8..9d51cd039d 100644 --- a/support/texlab/src/util/components.rs +++ b/support/texlab/crates/texlab/src/util/components.rs @@ -1,5 +1,6 @@ use std::io::Read; +use base_db::{semantics::tex::LinkKind, Project}; use flate2::read::GzDecoder; use itertools::Itertools; use lsp_types::{MarkupContent, MarkupKind}; @@ -7,11 +8,6 @@ use once_cell::sync::Lazy; use serde::Deserialize; use smol_str::SmolStr; -use crate::{ - db::{analysis::TexLinkKind, Document, Workspace}, - Db, -}; - #[derive(Debug, PartialEq, Eq, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ComponentDatabase { @@ -29,15 +25,15 @@ impl ComponentDatabase { }) } - pub fn linked_components(&self, db: &dyn Db, child: Document) -> Vec<&Component> { - Workspace::get(db) - .related(db, child) + pub fn linked_components(&self, project: &Project) -> Vec<&Component> { + project + .documents .iter() - .filter_map(|document| document.parse(db).as_tex()) - .flat_map(|data| data.analyze(db).links(db)) - .filter_map(|link| match link.kind(db) { - TexLinkKind::Sty => Some(format!("{}.sty", link.path(db).text(db))), - TexLinkKind::Cls => Some(format!("{}.cls", link.path(db).text(db))), + .filter_map(|document| document.data.as_tex()) + .flat_map(|data| data.semantics.links.iter()) + .filter_map(|link| match link.kind { + LinkKind::Sty => Some(format!("{}.sty", link.path.text)), + LinkKind::Cls => Some(format!("{}.cls", link.path.text)), _ => None, }) .filter_map(|name| self.find(&name)) diff --git a/support/texlab/src/util/cursor.rs b/support/texlab/crates/texlab/src/util/cursor.rs index d3168155da..8db642c0bf 100644 --- a/support/texlab/src/util/cursor.rs +++ b/support/texlab/crates/texlab/src/util/cursor.rs @@ -1,13 +1,9 @@ +use base_db::{Document, DocumentData, Project, Workspace}; use lsp_types::{Position, Url}; use rowan::{ast::AstNode, TextRange, TextSize}; +use syntax::{bibtex, latex}; -use crate::{ - db::{parse::DocumentData, Document, Workspace}, - syntax::{bibtex, latex}, - Db, -}; - -use super::{line_index::LineIndex, line_index_ext::LineIndexExt}; +use super::line_index_ext::LineIndexExt; #[derive(Debug)] pub enum Cursor { @@ -121,57 +117,49 @@ impl Cursor { } } -pub struct CursorContext<'db, T = ()> { - pub db: &'db dyn Db, - pub document: Document, - pub line_index: &'db LineIndex, - pub workspace: Workspace, +pub struct CursorContext<'a, T = ()> { + pub workspace: &'a Workspace, + pub document: &'a Document, + pub project: Project<'a>, pub cursor: Cursor, pub offset: TextSize, pub params: T, } -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.line_index(db); - let offset = line_index.offset_lsp(position); +impl<'a, T> CursorContext<'a, T> { + pub fn new(workspace: &'a Workspace, uri: &Url, position: Position, params: T) -> Option<Self> { + let document = workspace.lookup(uri)?; + let offset = document.line_index.offset_lsp(position); - let cursor = match document.parse(db) { + let cursor = match &document.data { DocumentData::Tex(data) => { - let root = data.root(db); + let root = data.root_node(); let left = root.token_at_offset(offset).left_biased(); let right = root.token_at_offset(offset).right_biased(); Cursor::new_tex(left, right) } DocumentData::Bib(data) => { - let root = data.root(db); + let root = data.root_node(); let left = root.token_at_offset(offset).left_biased(); let right = root.token_at_offset(offset).right_biased(); Cursor::new_bib(left, right) } - DocumentData::Log(_) | DocumentData::TexlabRoot(_) | DocumentData::Tectonic(_) => None, + DocumentData::Aux(_) + | DocumentData::Log(_) + | DocumentData::Root + | DocumentData::Tectonic => None, }; Some(Self { - db, - document, - line_index, workspace, + document, + project: workspace.project(document), cursor: cursor.unwrap_or(Cursor::Nothing), offset, params, }) } - pub fn related(&self) -> impl Iterator<Item = Document> + '_ { - self.workspace - .related(self.db, self.document) - .iter() - .copied() - } - pub fn is_inside_latex_curly(&self, group: &impl latex::HasCurly) -> bool { latex::small_range(group).contains(self.offset) || group.right_curly().is_none() } diff --git a/support/texlab/crates/texlab/src/util/diagnostics.rs b/support/texlab/crates/texlab/src/util/diagnostics.rs new file mode 100644 index 0000000000..9bac4df44e --- /dev/null +++ b/support/texlab/crates/texlab/src/util/diagnostics.rs @@ -0,0 +1,120 @@ +use base_db::{diagnostics::ErrorCode, Document, Workspace}; +use distro::Language; +use lsp_types::{DiagnosticSeverity, NumberOrString}; +use rustc_hash::FxHashMap; +use syntax::BuildErrorLevel; + +use crate::util; + +use super::line_index_ext::LineIndexExt; + +pub fn collect(workspace: &Workspace) -> FxHashMap<&Document, Vec<lsp_types::Diagnostic>> { + let mut results = FxHashMap::default(); + + for document in workspace.iter() { + let lsp_diagnostics = document + .diagnostics + .iter() + .map(|diagnostic| create_diagnostic(document, diagnostic)) + .collect::<Vec<_>>(); + + results.insert(document, lsp_diagnostics); + } + + for document in workspace + .iter() + .filter(|document| document.language == Language::Log) + { + for (document, diagnostics) in base_db::diagnostics::log::analyze(workspace, document) { + let lsp_diagnostics = diagnostics + .iter() + .map(|diagnostic| create_diagnostic(document, diagnostic)) + .collect::<Vec<_>>(); + + results.get_mut(document).unwrap().extend(lsp_diagnostics); + } + } + + results +} + +fn create_diagnostic( + document: &Document, + diagnostic: &base_db::diagnostics::Diagnostic, +) -> lsp_types::Diagnostic { + let range = document.line_index.line_col_lsp_range(diagnostic.range); + + let severity = match &diagnostic.code { + ErrorCode::UnexpectedRCurly + | ErrorCode::RCurlyInserted + | ErrorCode::MismatchedEnvironment + | ErrorCode::ExpectingLCurly + | ErrorCode::ExpectingKey + | ErrorCode::ExpectingRCurly + | ErrorCode::ExpectingEq + | ErrorCode::ExpectingFieldValue => DiagnosticSeverity::ERROR, + ErrorCode::Build(error) => match error.level { + BuildErrorLevel::Error => DiagnosticSeverity::ERROR, + BuildErrorLevel::Warning => DiagnosticSeverity::WARNING, + }, + }; + + let code = match &diagnostic.code { + ErrorCode::UnexpectedRCurly => Some(1), + ErrorCode::RCurlyInserted => Some(2), + ErrorCode::MismatchedEnvironment => Some(3), + ErrorCode::ExpectingLCurly => Some(4), + ErrorCode::ExpectingKey => Some(5), + ErrorCode::ExpectingRCurly => Some(6), + ErrorCode::ExpectingEq => Some(7), + ErrorCode::ExpectingFieldValue => Some(8), + ErrorCode::Build(_) => None, + }; + + let source = match &diagnostic.code { + ErrorCode::UnexpectedRCurly + | ErrorCode::RCurlyInserted + | ErrorCode::MismatchedEnvironment + | ErrorCode::ExpectingLCurly + | ErrorCode::ExpectingKey + | ErrorCode::ExpectingRCurly + | ErrorCode::ExpectingEq + | ErrorCode::ExpectingFieldValue => "texlab", + ErrorCode::Build(_) => "latex", + }; + + let message = String::from(match &diagnostic.code { + ErrorCode::UnexpectedRCurly => "Unexpected \"}\"", + ErrorCode::RCurlyInserted => "Missing \"}\" inserted", + ErrorCode::MismatchedEnvironment => "Mismatched environment", + ErrorCode::ExpectingLCurly => "Expecting a curly bracket: \"{\"", + ErrorCode::ExpectingKey => "Expecting a key", + ErrorCode::ExpectingRCurly => "Expecting a curly bracket: \"}\"", + ErrorCode::ExpectingEq => "Expecting an equality sign: \"=\"", + ErrorCode::ExpectingFieldValue => "Expecting a field value", + ErrorCode::Build(error) => &error.message, + }); + + lsp_types::Diagnostic { + severity: Some(severity), + code: code.map(NumberOrString::Number), + source: Some(String::from(source)), + ..lsp_types::Diagnostic::new_simple(range, message) + } +} + +pub fn filter( + all_diagnostics: &mut FxHashMap<&Document, Vec<lsp_types::Diagnostic>>, + workspace: &Workspace, +) { + let config = &workspace.config().diagnostics; + for diagnostics in all_diagnostics.values_mut() { + diagnostics.retain(|diagnostic| { + util::regex_filter::filter( + &diagnostic.message, + &config.allowed_patterns, + &config.ignored_patterns, + ) + }); + } +} diff --git a/support/texlab/crates/texlab/src/util/label.rs b/support/texlab/crates/texlab/src/util/label.rs new file mode 100644 index 0000000000..33b860a173 --- /dev/null +++ b/support/texlab/crates/texlab/src/util/label.rs @@ -0,0 +1,202 @@ +use std::str::FromStr; + +use base_db::{ + semantics::tex::{Label, LabelObject}, + Project, Workspace, +}; +use rowan::{ast::AstNode, TextRange}; +use syntax::latex::{self, HasCurly}; + +use self::LabeledObject::*; + +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +pub enum LabeledFloatKind { + Figure, + Table, + Listing, + Algorithm, +} + +impl LabeledFloatKind { + pub fn as_str(self) -> &'static str { + match self { + Self::Figure => "Figure", + Self::Table => "Table", + Self::Listing => "Listing", + Self::Algorithm => "Algorithm", + } + } +} + +impl FromStr for LabeledFloatKind { + type Err = (); + + fn from_str(s: &str) -> Result<Self, Self::Err> { + match s { + "figure" | "subfigure" => Ok(Self::Figure), + "table" | "subtable" => Ok(Self::Table), + "listing" | "lstlisting" => Ok(Self::Listing), + "algorithm" => Ok(Self::Algorithm), + _ => Err(()), + } + } +} + +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum LabeledObject<'a> { + Section { + prefix: &'a str, + text: &'a str, + }, + Float { + kind: LabeledFloatKind, + caption: &'a str, + }, + Theorem { + kind: &'a str, + description: Option<&'a str>, + }, + Equation, + EnumItem, +} + +#[derive(Debug, PartialEq, Eq, Clone)] +pub struct RenderedLabel<'a> { + pub range: TextRange, + pub number: Option<&'a str>, + pub object: LabeledObject<'a>, +} + +impl<'a> RenderedLabel<'a> { + pub fn reference(&self) -> String { + match &self.number { + Some(number) => match &self.object { + Section { prefix, text } => format!("{} {} ({})", prefix, number, text), + Float { kind, caption } => { + format!("{} {}: {}", kind.as_str(), number, caption) + } + Theorem { + kind, + description: None, + } => format!("{} {}", kind, number), + Theorem { + kind, + description: Some(description), + } => format!("{} {} ({})", kind, number, description), + Equation => format!("Equation ({})", number), + EnumItem => format!("Item {}", number), + }, + None => match &self.object { + Section { prefix, text } => format!("{} ({})", prefix, text), + Float { kind, caption } => format!("{}: {}", kind.as_str(), caption), + Theorem { + kind, + description: None, + } => String::from(*kind), + Theorem { + kind, + description: Some(description), + } => format!("{} ({})", kind, description), + Equation => "Equation".into(), + EnumItem => "Item".into(), + }, + } + } + + pub fn detail(&self) -> Option<String> { + match &self.object { + Section { .. } | Theorem { .. } | Equation | EnumItem => Some(self.reference()), + Float { kind, .. } => { + let result = match &self.number { + Some(number) => format!("{} {}", kind.as_str(), number), + None => kind.as_str().to_owned(), + }; + Some(result) + } + } + } +} + +pub fn render<'a>( + workspace: &'a Workspace, + project: &Project<'a>, + label: &'a Label, +) -> Option<RenderedLabel<'a>> { + let number = project + .documents + .iter() + .filter_map(|document| document.data.as_aux()) + .find_map(|data| data.semantics.label_numbers.get(&label.name.text)) + .map(|number| number.as_str()); + + for target in &label.targets { + match &target.object { + LabelObject::Section { prefix, text } => { + return Some(RenderedLabel { + range: target.range, + number, + object: LabeledObject::Section { prefix, text }, + }); + } + LabelObject::EnumItem => { + return Some(RenderedLabel { + range: target.range, + number, + object: LabeledObject::EnumItem, + }); + } + LabelObject::Environment { + name, + options, + caption, + } => { + let config = &workspace.config().syntax; + if config.math_environments.contains(name.as_str()) { + return Some(RenderedLabel { + range: target.range, + number, + object: LabeledObject::Equation, + }); + } + + if let Ok(kind) = LabeledFloatKind::from_str(name) { + return Some(RenderedLabel { + range: target.range, + number, + object: LabeledObject::Float { + kind, + caption: caption.as_deref()?, + }, + }); + } + + if let Some(theorem) = project + .documents + .iter() + .filter_map(|document| document.data.as_tex()) + .flat_map(|data| data.semantics.theorem_definitions.iter()) + .find(|theorem| theorem.name.text == *name) + { + return Some(RenderedLabel { + range: target.range, + number, + object: LabeledObject::Theorem { + kind: &theorem.description, + description: options.as_deref(), + }, + }); + } + } + }; + } + + None +} + +pub(crate) fn find_caption_by_parent(parent: &latex::SyntaxNode) -> Option<String> { + parent + .children() + .filter_map(latex::Caption::cast) + .find_map(|node| node.long()) + .and_then(|node| node.content_text()) +} diff --git a/support/texlab/src/util/lang_data.rs b/support/texlab/crates/texlab/src/util/lang_data.rs index 734ceb6df2..734ceb6df2 100644 --- a/support/texlab/src/util/lang_data.rs +++ b/support/texlab/crates/texlab/src/util/lang_data.rs diff --git a/support/texlab/src/util/line_index_ext.rs b/support/texlab/crates/texlab/src/util/line_index_ext.rs index becbb8bde7..bf4d9fa422 100644 --- a/support/texlab/src/util/line_index_ext.rs +++ b/support/texlab/crates/texlab/src/util/line_index_ext.rs @@ -1,8 +1,7 @@ +use base_db::{LineCol, LineColUtf16, LineIndex}; use lsp_types::{Position, Range}; use rowan::{TextRange, TextSize}; -use super::line_index::{LineColUtf16, LineIndex}; - pub trait LineIndexExt { fn offset_lsp(&self, line_col: Position) -> TextSize; @@ -36,7 +35,17 @@ impl LineIndexExt for LineIndex { fn line_col_lsp_range(&self, offset: TextRange) -> Range { let start = self.line_col_lsp(offset.start()); - let end = self.line_col_lsp(offset.end()); + let mut end = self.line_col_lsp(offset.end()); + if end.line != start.line && end.character == 0 { + // Prefer keeping multi-line ranges on the same line + let line_end = self.offset(LineCol { + line: end.line, + col: 0, + }); + + end = self.line_col_lsp(line_end - TextSize::from(1)); + } + Range::new(start, end) } } diff --git a/support/texlab/src/util/lsp_enums.rs b/support/texlab/crates/texlab/src/util/lsp_enums.rs index 75b97097c5..75b97097c5 100644 --- a/support/texlab/src/util/lsp_enums.rs +++ b/support/texlab/crates/texlab/src/util/lsp_enums.rs diff --git a/support/texlab/src/util/regex_filter.rs b/support/texlab/crates/texlab/src/util/regex_filter.rs index a33417464e..a33417464e 100644 --- a/support/texlab/src/util/regex_filter.rs +++ b/support/texlab/crates/texlab/src/util/regex_filter.rs diff --git a/support/texlab/tests/lsp/fixture.rs b/support/texlab/crates/texlab/tests/lsp/fixture.rs index ebebe1f5e6..02bed8c38a 100644 --- a/support/texlab/tests/lsp/fixture.rs +++ b/support/texlab/crates/texlab/tests/lsp/fixture.rs @@ -5,6 +5,7 @@ use std::{ }; use anyhow::Result; +use distro::Language; use lsp_server::Connection; use lsp_types::{ notification::{DidOpenTextDocument, Exit, Initialized}, @@ -13,7 +14,7 @@ use lsp_types::{ Position, Range, TextDocumentIdentifier, TextDocumentItem, TextDocumentPositionParams, Url, }; use tempfile::{tempdir, TempDir}; -use texlab::{db::Language, LspClient, Server}; +use texlab::{LspClient, Server}; #[derive(Debug)] pub struct Fixture { @@ -50,7 +51,7 @@ impl Fixture { let language_id = String::from(match language { Language::Tex => "latex", Language::Bib => "bibtex", - Language::Log | Language::TexlabRoot | Language::Tectonic => continue, + Language::Aux | Language::Log | Language::Root | Language::Tectonic => continue, }); client.send_notification::<DidOpenTextDocument>(DidOpenTextDocumentParams { @@ -124,7 +125,8 @@ static LOGGER: Once = Once::new(); pub struct TestBed { fixture: Fixture, locations: Vec<Location>, - directory: TempDir, + _temp_dir: TempDir, + temp_dir_path: PathBuf, client: LspClient, client_thread: Option<JoinHandle<()>>, server_thread: Option<JoinHandle<()>>, @@ -184,12 +186,14 @@ impl TestBed { }) }; - let directory = tempdir()?; + let temp_dir = tempdir()?; + let temp_dir_path = temp_dir.path().canonicalize()?; + let locations = fixture .documents .iter() .flat_map(|document| { - let uri = Url::from_file_path(directory.path().join(&document.path)).unwrap(); + let uri = Url::from_file_path(temp_dir_path.join(&document.path)).unwrap(); document .ranges .iter() @@ -200,7 +204,8 @@ impl TestBed { Ok(TestBed { fixture, locations, - directory, + _temp_dir: temp_dir, + temp_dir_path, client, client_thread: Some(client_thread), server_thread: Some(server_thread), @@ -217,7 +222,7 @@ impl TestBed { self.client .send_notification::<Initialized>(InitializedParams {})?; - self.fixture.setup(&self.client, &self.directory.path())?; + self.fixture.setup(&self.client, self.directory())?; Ok(()) } @@ -232,7 +237,7 @@ impl TestBed { .iter() .find_map(|document| document.cursor.map(|cursor| (document, cursor)))?; - let uri = Url::from_file_path(self.directory.path().join(&document.path)).unwrap(); + let uri = Url::from_file_path(self.temp_dir_path.join(&document.path)).unwrap(); let id = TextDocumentIdentifier::new(uri); Some(TextDocumentPositionParams::new(id, cursor)) } @@ -242,7 +247,7 @@ impl TestBed { } pub fn directory(&self) -> &Path { - self.directory.path() + &self.temp_dir_path } pub fn documents(&self) -> &[Document] { @@ -250,17 +255,15 @@ impl TestBed { } pub fn redact(&self, uri: &Url) -> Url { - let root = if cfg!(windows) { - PathBuf::from("C:/") - } else { - PathBuf::from("/") - }; + if uri.scheme() != "file" { + return uri.clone(); + } - let path = uri.to_file_path().unwrap(); - let path = path.strip_prefix(self.directory()).unwrap_or(&path); - let path = root.join(path); + let path = uri.to_file_path().unwrap().canonicalize().unwrap(); + let path = path.strip_prefix(self.directory()).unwrap(); + let path = path.to_str().unwrap(); - let uri = Url::from_file_path(path).unwrap(); - Url::parse(&uri.as_str().replace("file:///C:/", "file:///")).unwrap() + let text = format!("redacted://{}", path.replace('\\', "/")); + Url::parse(&text).unwrap() } } diff --git a/support/texlab/tests/lsp/main.rs b/support/texlab/crates/texlab/tests/lsp/main.rs index aeb4f8993c..aeb4f8993c 100644 --- a/support/texlab/tests/lsp/main.rs +++ b/support/texlab/crates/texlab/tests/lsp/main.rs diff --git a/support/texlab/tests/lsp/text_document.rs b/support/texlab/crates/texlab/tests/lsp/text_document.rs index cfab1d04c8..cfab1d04c8 100644 --- a/support/texlab/tests/lsp/text_document.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document.rs diff --git a/support/texlab/tests/lsp/text_document/completion.rs b/support/texlab/crates/texlab/tests/lsp/text_document/completion.rs index 3c2e7962d4..3c2e7962d4 100644 --- a/support/texlab/tests/lsp/text_document/completion.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/completion.rs diff --git a/support/texlab/tests/lsp/text_document/definition.rs b/support/texlab/crates/texlab/tests/lsp/text_document/definition.rs index 78eed633c8..78eed633c8 100644 --- a/support/texlab/tests/lsp/text_document/definition.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/definition.rs diff --git a/support/texlab/tests/lsp/text_document/document_highlight.rs b/support/texlab/crates/texlab/tests/lsp/text_document/document_highlight.rs index 5cfb8fbee8..5cfb8fbee8 100644 --- a/support/texlab/tests/lsp/text_document/document_highlight.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/document_highlight.rs diff --git a/support/texlab/tests/lsp/text_document/document_link.rs b/support/texlab/crates/texlab/tests/lsp/text_document/document_link.rs index 6aab6105de..6aab6105de 100644 --- a/support/texlab/tests/lsp/text_document/document_link.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/document_link.rs diff --git a/support/texlab/tests/lsp/text_document/document_symbol.rs b/support/texlab/crates/texlab/tests/lsp/text_document/document_symbol.rs index 6ac00176b9..6ac00176b9 100644 --- a/support/texlab/tests/lsp/text_document/document_symbol.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/document_symbol.rs diff --git a/support/texlab/tests/lsp/text_document/folding_range.rs b/support/texlab/crates/texlab/tests/lsp/text_document/folding_range.rs index 063ca7533d..063ca7533d 100644 --- a/support/texlab/tests/lsp/text_document/folding_range.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/folding_range.rs diff --git a/support/texlab/tests/lsp/text_document/formatting.rs b/support/texlab/crates/texlab/tests/lsp/text_document/formatting.rs index 295022c76a..65200b1d84 100644 --- a/support/texlab/tests/lsp/text_document/formatting.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/formatting.rs @@ -1,8 +1,9 @@ +use base_db::LineIndex; use insta::assert_snapshot; use lsp_types::{ request::Formatting, ClientCapabilities, DocumentFormattingParams, FormattingOptions, }; -use texlab::util::{line_index::LineIndex, line_index_ext::LineIndexExt}; +use texlab::util::line_index_ext::LineIndexExt; use crate::fixture::TestBed; diff --git a/support/texlab/tests/lsp/text_document/hover.rs b/support/texlab/crates/texlab/tests/lsp/text_document/hover.rs index 5dafceb781..5dafceb781 100644 --- a/support/texlab/tests/lsp/text_document/hover.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/hover.rs diff --git a/support/texlab/tests/lsp/text_document/inlay_hint.rs b/support/texlab/crates/texlab/tests/lsp/text_document/inlay_hint.rs index d8ae8e304a..d8ae8e304a 100644 --- a/support/texlab/tests/lsp/text_document/inlay_hint.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/inlay_hint.rs diff --git a/support/texlab/tests/lsp/text_document/references.rs b/support/texlab/crates/texlab/tests/lsp/text_document/references.rs index 9933babbd4..9933babbd4 100644 --- a/support/texlab/tests/lsp/text_document/references.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/references.rs diff --git a/support/texlab/tests/lsp/text_document/rename.rs b/support/texlab/crates/texlab/tests/lsp/text_document/rename.rs index 183443809a..183443809a 100644 --- a/support/texlab/tests/lsp/text_document/rename.rs +++ b/support/texlab/crates/texlab/tests/lsp/text_document/rename.rs diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_package_ref.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_package_ref.snap index 19c84e95fc..19c84e95fc 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_package_ref.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_package_ref.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_empty.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_empty.snap index 23e5b695ef..23e5b695ef 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_empty.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_empty.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_open_brace.snap index 25171b679c..25171b679c 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_simple.snap index 1d3f3329c1..1d3f3329c1 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__acronym_ref_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_empty.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_empty.snap index ecc48b5a7f..ecc48b5a7f 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_empty.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_empty.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_open_brace.snap index 530527a384..530527a384 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_word.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_word.snap index c98249c781..c98249c781 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_word.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__argument_word.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__begin_environment_without_snippet_support.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__begin_environment_without_snippet_support.snap index bb9e30ae55..bb9e30ae55 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__begin_environment_without_snippet_support.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__begin_environment_without_snippet_support.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation.snap index b8755fdef0..b8755fdef0 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_acronym.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_acronym.snap index 36478c45c8..36478c45c8 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_acronym.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_acronym.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace.snap index 41a1d9ced3..41a1d9ced3 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace_multiple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace_multiple.snap index 8ef509b463..8ef509b463 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace_multiple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__citation_open_brace_multiple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_open_brace.snap index 421335a4a5..421335a4a5 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_open_brace.snap index 5d7338e48e..5d7338e48e 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_simple.snap index 811b47c9ee..811b47c9ee 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_set_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_simple.snap index dbb34f08d9..dbb34f08d9 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_model_definition_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_open_brace.snap index e30fc4c1b0..e30fc4c1b0 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_simple.snap index 5aab0d8e3b..5aab0d8e3b 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_word.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_word.snap index fe803dc6cc..fe803dc6cc 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_word.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__color_word.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_bibtex.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_bibtex.snap index 616fb22a6b..616fb22a6b 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_bibtex.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_bibtex.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple.snap index 0e40056a6e..0e40056a6e 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple_package.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple_package.snap index 360229fa7a..360229fa7a 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple_package.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_command_simple_package.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_class.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_class.snap index a2e5e17ac4..a2e5e17ac4 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_class.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_class.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_command_definition.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_command_definition.snap index 28d9c6e82c..28d9c6e82c 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_command_definition.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_command_definition.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple.snap index f892dba5a7..f892dba5a7 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple_end.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple_end.snap index 95a2e1db04..95a2e1db04 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple_end.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__component_environment_simple_end.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_preamble.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_preamble.snap index 0fd8b00254..0fd8b00254 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_preamble.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_preamble.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_string.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_string.snap index 6844fc1862..6844fc1862 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_string.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_after_string.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_at_empty.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_at_empty.snap index e74f5fed37..e74f5fed37 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_at_empty.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_at_empty.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_article.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_article.snap index f9defdee01..f9defdee01 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_article.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_article.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_preamble.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_preamble.snap index aad03a392b..aad03a392b 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_preamble.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_preamble.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_string.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_string.snap index e30c60a45c..e30c60a45c 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_string.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_before_string.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_complete_entry.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_complete_entry.snap index 2724026a26..2724026a26 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_complete_entry.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__entry_type_complete_entry.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_closed.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_closed.snap index a5a1d7838e..a5a1d7838e 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_closed.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_closed.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_open.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_open.snap index 693d4ed141..693d4ed141 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_open.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_empty_entry_open.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_field_name.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_field_name.snap index cb0d41ed5d..cb0d41ed5d 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_field_name.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_field_name.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_closed.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_closed.snap index 66dbf62785..66dbf62785 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_closed.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_closed.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_open.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_open.snap index 221f78f335..221f78f335 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_open.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__field_entry_two_fields_name_open.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_open_brace.snap index 1be95d5d99..1be95d5d99 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_simple.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_simple.snap index 81e9299d69..81e9299d69 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_simple.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__glossary_ref_simple.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_closed_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_closed_brace.snap index 9ed7978612..9ed7978612 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_closed_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_closed_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_open_brace.snap index b650b621c6..b650b621c6 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_class_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_closed_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_closed_brace.snap index f8cad5526c..f8cad5526c 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_closed_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_closed_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_open_brace.snap index d234241e24..d234241e24 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__import_package_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap index 2b8f89b48d..2b8f89b48d 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_857_1.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap index 11adde5924..c49510429d 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__issue_864.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/completion.rs +source: crates/texlab/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}\"#)" --- [ diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__label.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__label.snap index a186c56920..a186c56920 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__label.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__label.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_import.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_import.snap index 351dc96deb..351dc96deb 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_import.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_import.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_texlabroot.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_texlabroot.snap index 8ddefbc6ad..8ddefbc6ad 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_texlabroot.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__project_resolution_texlabroot.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_begin.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_begin.snap index f60725667f..f60725667f 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_begin.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_begin.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_end.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_end.snap index 0ec951db1d..0ec951db1d 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_end.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__theorem_end.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_closed_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_closed_brace.snap index e727fbbc1d..e727fbbc1d 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_closed_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_closed_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_open_brace.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_open_brace.snap index 668b445c91..668b445c91 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_open_brace.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__tikz_library_open_brace.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_command.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_command.snap index 83e2e701ea..ce8c10d8e9 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_command.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_command.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/completion.rs +source: crates/texlab/tests/lsp/text_document/completion.rs expression: "complete(r#\"\n%! main.tex\n\\foobar\n\\fooba\n |\n ^^^^^\n\\begin{foo}\n\\end{foo}\n\\begin{fo}\"#)" --- [ diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_environment.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_environment.snap index c46a9beb26..c46a9beb26 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_environment.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__completion__user_environment.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_import.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_import.snap index b27d0f7a32..24e4efd8aa 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_import.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_import.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_link.rs +source: crates/texlab/tests/lsp/text_document/document_link.rs expression: "find_links(r#\"\n%! foo.tex\n\\import{.}{bar/baz}\n|\n\n%! bar/baz.tex\"#)" --- [ @@ -14,6 +14,6 @@ expression: "find_links(r#\"\n%! foo.tex\n\\import{.}{bar/baz}\n|\n\n%! bar/baz. "character": 18 } }, - "target": "file:///bar/baz.tex" + "target": "redacted://bar/baz.tex" } ] diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_include.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_include.snap index fd88cb4a8c..c19654b797 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_include.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_link__document_include.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_link.rs +source: crates/texlab/tests/lsp/text_document/document_link.rs expression: "find_links(r#\"\n%! foo.tex\n\\input{bar.tex}\n|\n\n%! bar.tex\"#)" --- [ @@ -14,6 +14,6 @@ expression: "find_links(r#\"\n%! foo.tex\n\\input{bar.tex}\n|\n\n%! bar.tex\"#)" "character": 14 } }, - "target": "file:///bar.tex" + "target": "redacted://bar.tex" } ] diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_flat.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_flat.snap index cd18c3f06e..b160196d26 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_flat.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_flat.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_symbol.rs +source: crates/texlab/tests/lsp/text_document/document_symbol.rs expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin{document}\n\n\\begin{enumerate}\n \\item\\label{it:foo} Foo\n \\item\\label{it:bar} Bar\n \\item[Baz] Baz\n \\item[Qux]\\label{it:qux} Qux\n\\end{enumerate}\n\n\\end{document}\n|\n\n%! main.aux\n\\relax\n\\newlabel{it:foo}{{1}{1}}\n\\newlabel{it:qux}{{2}{1}}\"#,\n serde_json::json!({}), serde_json::Value::Null)" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 10, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 4, @@ -26,7 +26,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 5, @@ -44,7 +44,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 6, @@ -62,7 +62,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 7, @@ -80,7 +80,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 8, diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_nested.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_nested.snap index 8f777b6d8f..8f777b6d8f 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_nested.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__enumerate_nested.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_flat.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_flat.snap index d37fe4cbbf..6ff985fa81 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_flat.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_flat.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_symbol.rs +source: crates/texlab/tests/lsp/text_document/document_symbol.rs expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin{document}\n\n\\begin{equation}\\label{eq:foo}\n Foo\n\\end{equation}\n\n\\begin{equation}\\label{eq:bar}\n Bar\n\\end{equation}\n\n\\begin{equation}\n Baz\n\\end{equation}\n\n\\end{document}\n|\n\n%! main.aux\n\\relax\n\\newlabel{eq:foo}{{1}{1}}\"#,\n serde_json::json!({}), serde_json::Value::Null)" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 14, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 4, @@ -26,7 +26,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 14, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 8, @@ -44,7 +44,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 14, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 12, diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_nested.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_nested.snap index 5965400814..5965400814 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_nested.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__equation_nested.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_flat.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_flat.snap index e93be78925..742e405e0f 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_flat.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_flat.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_symbol.rs +source: crates/texlab/tests/lsp/text_document/document_symbol.rs expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin{document}\n\n\\begin{figure}\n Foo\n \\caption{Foo}\\label{fig:foo}\n\\end{figure}\n\n\\begin{figure}\n Bar\n \\caption{Bar}\\label{fig:bar}\n\\end{figure}\n\n\\begin{figure}\n Baz\n \\caption{Baz}\n\\end{figure}\n\n\\begin{figure}\n Qux\n\\end{figure}\n\n\\end{document}\n|\n\n%! main.aux\n\\relax\n\\@writefile{lof}{\\contentsline {figure}{\\numberline {1}{\\ignorespaces Foo}}{1}\\protected@file@percent }\n\\newlabel{fig:foo}{{1}{1}}\n\\@writefile{lof}{\\contentsline {figure}{\\numberline {2}{\\ignorespaces Bar}}{1}\\protected@file@percent }\n\\@writefile{lof}{\\contentsline {figure}{\\numberline {3}{\\ignorespaces Baz}}{1}\\protected@file@percent }\"#,\n serde_json::json!({}), serde_json::Value::Null)" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 6, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 4, @@ -26,7 +26,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 6, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 9, @@ -44,7 +44,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 6, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 14, diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_nested.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_nested.snap index a625beb1fb..a625beb1fb 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_nested.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__float_nested.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__ignored_patterns.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__ignored_patterns.snap index 90c445fc01..c1981e9db2 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__ignored_patterns.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__ignored_patterns.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_symbol.rs +source: crates/texlab/tests/lsp/text_document/document_symbol.rs expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin{document}\n\n\\begin{equation}\\label{eq:foo}\n Foo\n\\end{equation}\n \n\\begin{enumerate}\n \\item Foo\n \\item Bar\n\\end{enumerate}\n\n\\end{document}\n|\"#,\n serde_json::json!({}),\n serde_json::json!({\n \"symbols\" : { \"ignoredPatterns\" : [\"Item\", \"Enumerate\"] }\n }))" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 14, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 4, diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_flat.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_flat.snap index 85d9cef9e8..5ab04f4e60 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_flat.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_flat.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_symbol.rs +source: crates/texlab/tests/lsp/text_document/document_symbol.rs expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin{document}\n\n\\section{Foo}\n\n\\section{Bar}\\label{sec:bar}\n\n\\subsection{Baz}\\label{sec:baz}\n\n\\end{document}\n|\n\n%! main.aux\n\\relax\n\\@writefile{toc}{\\contentsline {section}{\\numberline {1}Foo}{1}\\protected@file@percent }\n\\@writefile{toc}{\\contentsline {section}{\\numberline {2}Bar}{1}\\protected@file@percent }\n\\newlabel{sec:bar}{{2}{1}}\"#,\n serde_json::json!({}), serde_json::Value::Null)" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 4, @@ -26,7 +26,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 6, @@ -44,7 +44,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\n\\begin "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 8, diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_nested.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_nested.snap index bac292bf01..bac292bf01 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_nested.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__section_nested.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_flat.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_flat.snap index 55ab44980c..a20b9bb236 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_flat.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_flat.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/text_document/document_symbol.rs +source: crates/texlab/tests/lsp/text_document/document_symbol.rs expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepackage{amsthm}\n\\newtheorem{lemma}{Lemma}\n\n\\begin{document}\n\n\\begin{lemma}[Foo]\\label{thm:foo}\n Foo\n\\end{lemma}\n\n\\begin{lemma}\\label{thm:bar}\n Bar\n\\end{lemma}\n\n\\begin{lemma}\\label{thm:baz}\n Baz\n\\end{lemma}\n\n\\begin{lemma}[Qux]\n Qux\n\\end{lemma}\n\n\\end{document}\n|\n\n%! main.aux\n\\relax\n\\newlabel{thm:foo}{{1}{1}}\n\\newlabel{thm:bar}{{2}{1}}\"#,\n serde_json::json!({}), serde_json::Value::Null)" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepack "kind": 13, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 6, @@ -26,7 +26,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepack "kind": 13, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 10, @@ -44,7 +44,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepack "kind": 13, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 14, @@ -62,7 +62,7 @@ expression: "find_symbols(r#\"\n%! main.tex\n\\documentclass{article}\n\\usepack "kind": 13, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 18, diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_nested.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_nested.snap index 82bdd6d1d9..82bdd6d1d9 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_nested.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__document_symbol__theorem_nested.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__bibtex.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__bibtex.snap index 2063cc39e5..2063cc39e5 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__bibtex.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__bibtex.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__latex.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__latex.snap index 74632eda56..74632eda56 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__latex.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__folding_range__latex.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_command.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_command.snap index b98dd68758..b98dd68758 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_command.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_command.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_insert_braces.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_insert_braces.snap index a95f5d3006..a95f5d3006 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_insert_braces.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_insert_braces.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_join_strings.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_join_strings.snap index 3ea6bf18ad..3ea6bf18ad 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_join_strings.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_join_strings.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_multiple_entries.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_multiple_entries.snap index 966f133a76..966f133a76 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_multiple_entries.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_multiple_entries.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_parens.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_parens.snap index ca317db108..ca317db108 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_parens.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_parens.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_preamble.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_preamble.snap index 6448e3a791..6448e3a791 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_preamble.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_preamble.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_string.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_string.snap index a1739290fd..a1739290fd 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_string.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_string.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_trailing_comma.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_trailing_comma.snap index dd5c7b49f0..dd5c7b49f0 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_trailing_comma.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_trailing_comma.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_wrap_long_lines.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_wrap_long_lines.snap index c52b8a9317..c52b8a9317 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_wrap_long_lines.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__formatting__bibtex_internal_wrap_long_lines.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_cite.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_cite.snap index 6e6c6b264c..6e6c6b264c 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_cite.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_cite.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_entry.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_entry.snap index c13c16051d..c13c16051d 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_entry.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__citation_inside_entry.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__component_known_package.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__component_known_package.snap index ea1801d4ed..ea1801d4ed 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__component_known_package.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__component_known_package.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__entry_type_known_type.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__entry_type_known_type.snap index f3b146fb21..f3b146fb21 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__entry_type_known_type.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__entry_type_known_type.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__field_known.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__field_known.snap index 42d630c287..42d630c287 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__field_known.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__field_known.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file.snap index 19b36c4ebb..19b36c4ebb 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file_mumber.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file_mumber.snap index 78ccef8e46..78ccef8e46 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file_mumber.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__label_theorem_child_file_mumber.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__section.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__section.snap index c8aa265330..c8aa265330 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__section.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__section.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__string_inside_reference.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__string_inside_reference.snap index cfcc196e26..cfcc196e26 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__string_inside_reference.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__hover__string_inside_reference.snap diff --git a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap index b8568fd2fd..b8568fd2fd 100644 --- a/support/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap +++ b/support/texlab/crates/texlab/tests/lsp/text_document/snapshots/lsp__text_document__inlay_hint__label_definition.snap diff --git a/support/texlab/tests/lsp/workspace.rs b/support/texlab/crates/texlab/tests/lsp/workspace.rs index 15e0679dea..15e0679dea 100644 --- a/support/texlab/tests/lsp/workspace.rs +++ b/support/texlab/crates/texlab/tests/lsp/workspace.rs diff --git a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_bibtex.snap b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_bibtex.snap index 0c2e328570..3e74634e7b 100644 --- a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_bibtex.snap +++ b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_bibtex.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/workspace/symbol.rs +source: crates/texlab/tests/lsp/workspace/symbol.rs expression: "find_symbols(FIXTURE, \"bibtex\")" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(FIXTURE, \"bibtex\")" "kind": 24, "deprecated": false, "location": { - "uri": "file:///main.bib", + "uri": "redacted://main.bib", "range": { "start": { "line": 0, @@ -26,7 +26,7 @@ expression: "find_symbols(FIXTURE, \"bibtex\")" "kind": 15, "deprecated": false, "location": { - "uri": "file:///main.bib", + "uri": "redacted://main.bib", "range": { "start": { "line": 2, diff --git a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_figure.snap b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_figure.snap index 090fe25045..66758aa90e 100644 --- a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_figure.snap +++ b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_figure.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/workspace/symbol.rs +source: crates/texlab/tests/lsp/workspace/symbol.rs expression: "find_symbols(FIXTURE, \"figure\")" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(FIXTURE, \"figure\")" "kind": 6, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 15, diff --git a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_item.snap b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_item.snap index 6f739ffb29..fdc506b308 100644 --- a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_item.snap +++ b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_item.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/workspace/symbol.rs +source: crates/texlab/tests/lsp/workspace/symbol.rs expression: "find_symbols(FIXTURE, \"item\")" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(FIXTURE, \"item\")" "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 24, @@ -26,7 +26,7 @@ expression: "find_symbols(FIXTURE, \"item\")" "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 25, @@ -44,7 +44,7 @@ expression: "find_symbols(FIXTURE, \"item\")" "kind": 22, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 26, diff --git a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_math.snap b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_math.snap index 6e63e65aa4..2dc59f021b 100644 --- a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_math.snap +++ b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_math.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/workspace/symbol.rs +source: crates/texlab/tests/lsp/workspace/symbol.rs expression: "find_symbols(FIXTURE, \"math\")" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(FIXTURE, \"math\")" "kind": 14, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 9, @@ -26,7 +26,7 @@ expression: "find_symbols(FIXTURE, \"math\")" "kind": 13, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 33, diff --git a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_section.snap b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_section.snap index fef2f41be6..eff280251a 100644 --- a/support/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_section.snap +++ b/support/texlab/crates/texlab/tests/lsp/workspace/snapshots/lsp__workspace__symbol__filter_type_section.snap @@ -1,5 +1,5 @@ --- -source: tests/lsp/workspace/symbol.rs +source: crates/texlab/tests/lsp/workspace/symbol.rs expression: "find_symbols(FIXTURE, \"section\")" --- [ @@ -8,7 +8,7 @@ expression: "find_symbols(FIXTURE, \"section\")" "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 7, @@ -26,7 +26,7 @@ expression: "find_symbols(FIXTURE, \"section\")" "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 13, @@ -44,7 +44,7 @@ expression: "find_symbols(FIXTURE, \"section\")" "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 21, @@ -62,7 +62,7 @@ expression: "find_symbols(FIXTURE, \"section\")" "kind": 2, "deprecated": false, "location": { - "uri": "file:///main.tex", + "uri": "redacted://main.tex", "range": { "start": { "line": 29, diff --git a/support/texlab/tests/lsp/workspace/symbol.rs b/support/texlab/crates/texlab/tests/lsp/workspace/symbol.rs index e726ed6860..e726ed6860 100644 --- a/support/texlab/tests/lsp/workspace/symbol.rs +++ b/support/texlab/crates/texlab/tests/lsp/workspace/symbol.rs diff --git a/support/texlab/src/db.rs b/support/texlab/src/db.rs deleted file mode 100644 index 521655ce80..0000000000 --- a/support/texlab/src/db.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub mod analysis; -mod context; -pub mod diagnostics; -mod discovery; -mod document; -pub mod parse; -mod workspace; - -pub use {context::*, discovery::*, document::*, workspace::*}; - -#[salsa::interned] -pub struct Word { - #[return_ref] - pub text: String, -} diff --git a/support/texlab/src/db/analysis.rs b/support/texlab/src/db/analysis.rs deleted file mode 100644 index 1f1bd508a8..0000000000 --- a/support/texlab/src/db/analysis.rs +++ /dev/null @@ -1,221 +0,0 @@ -pub mod label; - -use rowan::{ast::AstNode, NodeOrToken, TextRange}; - -use crate::{ - syntax::latex::{self, HasCurly}, - Db, -}; - -use super::Word; - -#[salsa::tracked] -pub struct TexLink { - pub kind: TexLinkKind, - pub path: Word, - pub range: TextRange, - pub base_dir: Option<Word>, -} - -impl TexLink { - fn of_include(db: &dyn Db, node: latex::SyntaxNode, results: &mut Vec<Self>) -> Option<()> { - let include = latex::Include::cast(node)?; - let kind = match include.syntax().kind() { - latex::LATEX_INCLUDE => TexLinkKind::Tex, - latex::BIBLATEX_INCLUDE | latex::BIBTEX_INCLUDE => TexLinkKind::Bib, - latex::PACKAGE_INCLUDE => TexLinkKind::Sty, - latex::CLASS_INCLUDE => TexLinkKind::Cls, - _ => return None, - }; - - for path in include.path_list()?.keys() { - results.push(Self::new( - db, - kind, - Word::new(db, path.to_string()), - latex::small_range(&path), - None, - )); - } - - Some(()) - } - - fn of_import(db: &dyn Db, node: latex::SyntaxNode, results: &mut Vec<Self>) -> Option<()> { - let import = latex::Import::cast(node)?; - - let mut base_dir = import.directory()?.key()?.to_string(); - if !base_dir.ends_with('/') { - base_dir.push('/'); - } - - let path = import.file()?.key()?; - results.push(Self::new( - db, - TexLinkKind::Tex, - Word::new(db, path.to_string()), - latex::small_range(&path), - Some(Word::new(db, base_dir)), - )); - - Some(()) - } -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub enum TexLinkKind { - Sty, - Cls, - Tex, - Bib, -} - -impl TexLinkKind { - pub fn extensions(self) -> &'static [&'static str] { - match self { - Self::Sty => &["sty"], - Self::Cls => &["cls"], - Self::Tex => &["tex"], - Self::Bib => &["bib"], - } - } -} - -#[salsa::tracked] -pub struct TheoremEnvironment { - pub name: Word, - pub description: Word, -} - -impl TheoremEnvironment { - fn of_definition(db: &dyn Db, node: latex::SyntaxNode, results: &mut Vec<Self>) -> Option<()> { - let theorem = latex::TheoremDefinition::cast(node)?; - let name = theorem.name()?.key()?.to_string(); - let description = theorem.description()?; - let description = description.content_text()?; - - results.push(Self::new( - db, - Word::new(db, name), - Word::new(db, description), - )); - - Some(()) - } -} - -#[salsa::tracked] -pub struct GraphicsPath { - #[return_ref] - pub path: String, -} - -impl GraphicsPath { - pub fn of_command(db: &dyn Db, node: latex::SyntaxNode, results: &mut Vec<Self>) -> Option<()> { - let definition = latex::GraphicsPath::cast(node)?; - for path in definition - .path_list() - .filter_map(|group| group.key()) - .map(|path| path.to_string()) - { - results.push(GraphicsPath::new(db, path)); - } - - Some(()) - } -} - -#[salsa::tracked] -pub struct TexAnalysis { - #[return_ref] - pub links: Vec<TexLink>, - - #[return_ref] - pub labels: Vec<label::Name>, - - #[return_ref] - pub label_numbers: Vec<label::Number>, - - #[return_ref] - pub theorem_environments: Vec<TheoremEnvironment>, - - #[return_ref] - pub graphics_paths: Vec<GraphicsPath>, - - #[return_ref] - pub command_name_ranges: Vec<TextRange>, - - #[return_ref] - pub environment_names: Vec<String>, -} - -#[salsa::tracked] -impl TexAnalysis { - #[salsa::tracked] - pub fn has_document_environment(self, db: &dyn Db) -> bool { - self.environment_names(db) - .iter() - .any(|name| name == "document") - } -} - -impl TexAnalysis { - pub(super) fn analyze(db: &dyn Db, root: &latex::SyntaxNode) -> Self { - let mut links = Vec::new(); - let mut labels = Vec::new(); - let mut label_numbers = Vec::new(); - let mut theorem_environments = Vec::new(); - let mut graphics_paths = Vec::new(); - let mut command_name_ranges = Vec::new(); - let mut environment_names = Vec::new(); - - 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( - db, - links, - labels, - label_numbers, - theorem_environments, - graphics_paths, - command_name_ranges, - environment_names, - ) - } -} diff --git a/support/texlab/src/db/analysis/label.rs b/support/texlab/src/db/analysis/label.rs deleted file mode 100644 index 77ee5268eb..0000000000 --- a/support/texlab/src/db/analysis/label.rs +++ /dev/null @@ -1,122 +0,0 @@ -use rowan::{ - ast::{AstNode, AstPtr}, - TextRange, -}; - -use crate::{db::Word, syntax::latex, Db}; - -#[salsa::tracked] -pub struct Number { - pub name: Word, - pub text: Word, -} - -impl Number { - pub(super) fn of_number( - db: &dyn Db, - node: latex::SyntaxNode, - results: &mut Vec<Self>, - ) -> Option<()> { - let number = latex::LabelNumber::cast(node)?; - let name = number.name()?.key()?.to_string(); - let text = number - .text()? - .syntax() - .descendants_with_tokens() - .filter_map(|element| element.into_node()) - .find(|node| node.kind() == latex::TEXT || node.kind() == latex::MIXED_GROUP)? - .text() - .to_string(); - - results.push(Self::new(db, Word::new(db, name), Word::new(db, text))); - - Some(()) - } -} - -#[derive(Debug, PartialEq, Eq, Clone, Hash)] -pub enum Origin { - Definition(AstPtr<latex::LabelDefinition>), - Reference(AstPtr<latex::LabelReference>), - ReferenceRange(AstPtr<latex::LabelReferenceRange>), -} - -impl Origin { - pub fn as_definition(&self) -> Option<&AstPtr<latex::LabelDefinition>> { - match self { - Self::Definition(ptr) => Some(ptr), - _ => None, - } - } -} - -#[salsa::tracked] -pub struct Name { - pub origin: Origin, - pub name: Word, - pub range: TextRange, -} - -impl Name { - pub(super) fn of_definition( - db: &dyn Db, - node: latex::SyntaxNode, - results: &mut Vec<Self>, - ) -> Option<()> { - let label = latex::LabelDefinition::cast(node)?; - let name = label.name()?.key()?; - results.push(Self::new( - db, - Origin::Definition(AstPtr::new(&label)), - Word::new(db, name.to_string()), - latex::small_range(&name), - )); - - Some(()) - } - - pub(super) fn of_reference( - db: &dyn Db, - node: latex::SyntaxNode, - results: &mut Vec<Self>, - ) -> Option<()> { - let label = latex::LabelReference::cast(node)?; - for name in label.name_list()?.keys() { - results.push(Self::new( - db, - Origin::Reference(AstPtr::new(&label)), - Word::new(db, name.to_string()), - latex::small_range(&name), - )); - } - - Some(()) - } - - pub(super) fn of_reference_range( - db: &dyn Db, - node: latex::SyntaxNode, - results: &mut Vec<Self>, - ) -> Option<()> { - let label = latex::LabelReferenceRange::cast(node)?; - if let Some(name) = label.from().and_then(|name| name.key()) { - results.push(Self::new( - db, - Origin::ReferenceRange(AstPtr::new(&label)), - Word::new(db, name.to_string()), - latex::small_range(&name), - )); - } - - if let Some(name) = label.to().and_then(|name| name.key()) { - results.push(Self::new( - db, - Origin::ReferenceRange(AstPtr::new(&label)), - Word::new(db, name.to_string()), - latex::small_range(&name), - )); - } - - Some(()) - } -} diff --git a/support/texlab/src/db/context.rs b/support/texlab/src/db/context.rs deleted file mode 100644 index c6277eb099..0000000000 --- a/support/texlab/src/db/context.rs +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 6b1a177133..0000000000 --- a/support/texlab/src/db/diagnostics.rs +++ /dev/null @@ -1,177 +0,0 @@ -pub mod bib; -pub mod log; -pub mod tex; - -use lsp_types::{DiagnosticSeverity, NumberOrString, Range}; -use rustc_hash::FxHashMap; - -use crate::{db::workspace::Workspace, util, Db}; - -use super::document::{Document, Language}; - -#[derive(Debug, PartialEq, Eq, Clone)] -pub struct Diagnostic { - pub severity: DiagnosticSeverity, - pub range: Range, - pub code: DiagnosticCode, - pub message: String, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] -pub enum DiagnosticCode { - Tex(TexCode), - Bib(BibCode), - Log(Document), - Chktex(String), -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub enum TexCode { - UnexpectedRCurly, - RCurlyInserted, - MismatchedEnvironment, -} - -impl From<TexCode> for String { - fn from(code: TexCode) -> Self { - match code { - TexCode::UnexpectedRCurly => "Unexpected \"}\"".to_string(), - TexCode::RCurlyInserted => "Missing \"}\" inserted".to_string(), - TexCode::MismatchedEnvironment => "Mismatched environment".to_string(), - } - } -} - -impl From<TexCode> for NumberOrString { - fn from(code: TexCode) -> Self { - match code { - TexCode::UnexpectedRCurly => NumberOrString::Number(1), - TexCode::RCurlyInserted => NumberOrString::Number(2), - TexCode::MismatchedEnvironment => NumberOrString::Number(3), - } - } -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -#[allow(clippy::enum_variant_names)] -pub enum BibCode { - ExpectingLCurly, - ExpectingKey, - ExpectingRCurly, - ExpectingEq, - ExpectingFieldValue, -} - -impl From<BibCode> for String { - fn from(code: BibCode) -> Self { - match code { - BibCode::ExpectingLCurly => "Expecting a curly bracket: \"{\"".to_string(), - BibCode::ExpectingKey => "Expecting a key".to_string(), - BibCode::ExpectingRCurly => "Expecting a curly bracket: \"}\"".to_string(), - BibCode::ExpectingEq => "Expecting an equality sign: \"=\"".to_string(), - BibCode::ExpectingFieldValue => "Expecting a field value".to_string(), - } - } -} - -impl From<BibCode> for NumberOrString { - fn from(code: BibCode) -> Self { - match code { - BibCode::ExpectingLCurly => NumberOrString::Number(4), - BibCode::ExpectingKey => NumberOrString::Number(5), - BibCode::ExpectingRCurly => NumberOrString::Number(6), - BibCode::ExpectingEq => NumberOrString::Number(7), - BibCode::ExpectingFieldValue => NumberOrString::Number(8), - } - } -} - -#[salsa::tracked(return_ref)] -pub fn collect(db: &dyn Db, workspace: Workspace) -> FxHashMap<Document, Vec<Diagnostic>> { - let mut results: FxHashMap<Document, Vec<Diagnostic>> = FxHashMap::default(); - - for document in workspace.documents(db).iter().copied() { - match document.language(db) { - Language::Tex => { - results.entry(document).or_default().extend( - tex::collect(db, document) - .iter() - .chain(document.linter(db).chktex(db)) - .cloned(), - ); - } - Language::Bib => { - results - .entry(document) - .or_default() - .extend(bib::collect(db, document).iter().cloned()); - } - Language::Log => { - log::collect(db, workspace, document) - .iter() - .for_each(|(document, diagnostics)| { - results - .entry(*document) - .or_default() - .extend(diagnostics.clone()); - }); - } - Language::TexlabRoot | Language::Tectonic => {} - } - } - - results -} - -#[salsa::tracked] -pub fn collect_filtered( - db: &dyn Db, - workspace: Workspace, -) -> FxHashMap<Document, Vec<lsp_types::Diagnostic>> { - let all_diagnostics = collect(db, workspace); - let mut all_filtered: FxHashMap<Document, Vec<lsp_types::Diagnostic>> = FxHashMap::default(); - - 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) { - continue; - } - - if let Some(diagnostics) = all_diagnostics.get(document) { - for diagnostic in diagnostics.iter().filter(|diag| { - util::regex_filter::filter( - &diag.message, - &config.allowed_patterns, - &config.ignored_patterns, - ) - }) { - let source = match diagnostic.code { - DiagnosticCode::Tex(_) | DiagnosticCode::Bib(_) => "texlab", - DiagnosticCode::Log(_) => "latex-build", - DiagnosticCode::Chktex(_) => "chktex", - }; - - let code = match diagnostic.code.clone() { - DiagnosticCode::Tex(code) => Some(code.into()), - DiagnosticCode::Bib(code) => Some(code.into()), - DiagnosticCode::Chktex(code) => Some(NumberOrString::String(code)), - DiagnosticCode::Log(_) => None, - }; - - filtered.push(lsp_types::Diagnostic { - range: diagnostic.range, - code, - severity: Some(diagnostic.severity), - message: diagnostic.message.clone(), - source: Some(source.to_string()), - ..Default::default() - }); - } - } - - all_filtered.insert(*document, filtered); - } - - all_filtered -} diff --git a/support/texlab/src/db/diagnostics/bib.rs b/support/texlab/src/db/diagnostics/bib.rs deleted file mode 100644 index 4f5dfc55a1..0000000000 --- a/support/texlab/src/db/diagnostics/bib.rs +++ /dev/null @@ -1,112 +0,0 @@ -use lsp_types::DiagnosticSeverity; -use rowan::{ast::AstNode, TextRange}; - -use crate::{ - db::document::Document, - syntax::bibtex::{self, HasDelims, HasEq, HasName, HasType, HasValue}, - util::line_index_ext::LineIndexExt, - Db, -}; - -use super::{BibCode, Diagnostic, DiagnosticCode}; - -#[salsa::tracked(return_ref)] -pub fn collect(db: &dyn Db, document: Document) -> Vec<Diagnostic> { - let mut results = Vec::new(); - let data = match document.parse(db).as_bib() { - Some(data) => data, - None => return results, - }; - - for node in data.root(db).descendants() { - analyze_entry(db, document, node.clone(), &mut results) - .or_else(|| analyze_field(db, document, node, &mut results)); - } - - results -} - -fn analyze_entry( - db: &dyn Db, - document: Document, - node: bibtex::SyntaxNode, - results: &mut Vec<Diagnostic>, -) -> Option<()> { - let line_index = document.line_index(db); - - let entry = bibtex::Entry::cast(node)?; - if entry.left_delim_token().is_none() { - let code = BibCode::ExpectingLCurly; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: line_index.line_col_lsp_range(entry.type_token()?.text_range()), - code: DiagnosticCode::Bib(code), - message: String::from(code), - }); - - return Some(()); - } - - if entry.name_token().is_none() { - let code = BibCode::ExpectingKey; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: line_index.line_col_lsp_range(entry.left_delim_token()?.text_range()), - code: DiagnosticCode::Bib(code), - message: String::from(code), - }); - - return Some(()); - } - - if entry.right_delim_token().is_none() { - let code = BibCode::ExpectingRCurly; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: line_index - .line_col_lsp_range(TextRange::empty(entry.syntax().text_range().end())), - code: DiagnosticCode::Bib(code), - message: String::from(code), - }); - - return Some(()); - } - - Some(()) -} - -fn analyze_field( - db: &dyn Db, - document: Document, - node: bibtex::SyntaxNode, - results: &mut Vec<Diagnostic>, -) -> Option<()> { - let line_index = document.line_index(db); - - let field = bibtex::Field::cast(node)?; - if field.eq_token().is_none() { - let code = BibCode::ExpectingEq; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: line_index.line_col_lsp_range(field.name_token()?.text_range()), - code: DiagnosticCode::Bib(code), - message: String::from(code), - }); - - return Some(()); - } - - if field.value().is_none() { - let code = BibCode::ExpectingFieldValue; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: line_index.line_col_lsp_range(field.name_token()?.text_range()), - code: DiagnosticCode::Bib(code), - message: String::from(code), - }); - - return Some(()); - } - - Some(()) -} diff --git a/support/texlab/src/db/diagnostics/log.rs b/support/texlab/src/db/diagnostics/log.rs deleted file mode 100644 index 368fd3fdcc..0000000000 --- a/support/texlab/src/db/diagnostics/log.rs +++ /dev/null @@ -1,100 +0,0 @@ -use lsp_types::{DiagnosticSeverity, Position, Range, Url}; -use rowan::{TextLen, TextRange, TextSize}; -use rustc_hash::FxHashMap; - -use crate::{ - db::{document::Document, workspace::Workspace}, - syntax::{BuildError, BuildErrorLevel}, - util::line_index_ext::LineIndexExt, - Db, -}; - -use super::{Diagnostic, DiagnosticCode}; - -#[salsa::tracked(return_ref)] -pub fn collect( - db: &dyn Db, - workspace: Workspace, - log_document: Document, -) -> FxHashMap<Document, Vec<Diagnostic>> { - let mut results = FxHashMap::default(); - - let log = match log_document.parse(db).as_log() { - Some(data) => data.log(db), - None => return results, - }; - - let root_document = match workspace.parents(db, log_document).iter().next().copied() { - Some(document) => document, - None => return results, - }; - - let base_path = match root_document - .location(db) - .path(db) - .as_deref() - .and_then(|path| path.parent()) - { - Some(path) => path, - None => return results, - }; - - for error in &log.errors { - let full_path = base_path.join(&error.relative_path); - let full_path_uri = if let Ok(uri) = Url::from_file_path(&full_path) { - uri - } else { - continue; - }; - - let severity = match error.level { - BuildErrorLevel::Error => DiagnosticSeverity::ERROR, - BuildErrorLevel::Warning => DiagnosticSeverity::WARNING, - }; - - let range = find_range_of_hint(db, workspace, &full_path_uri, error).unwrap_or_else(|| { - let line = error.line.unwrap_or(0); - Range::new(Position::new(line, 0), Position::new(line, 0)) - }); - - let diagnostic = Diagnostic { - severity, - range, - code: DiagnosticCode::Log(log_document), - message: error.message.clone(), - }; - - let tex_document = workspace - .lookup_uri(db, &full_path_uri) - .unwrap_or(root_document); - - results.entry(tex_document).or_default().push(diagnostic); - } - - results -} - -fn find_range_of_hint( - db: &dyn Db, - workspace: Workspace, - uri: &Url, - error: &BuildError, -) -> Option<Range> { - let document = workspace.lookup_uri(db, uri)?; - let text = document.text(db); - let line = error.line? as usize; - let hint = error.hint.as_deref()?; - let line_index = document.line_index(db); - - let line_start = line_index.newlines.get(line).copied()?; - let line_end = line_index - .newlines - .get(line + 1) - .copied() - .unwrap_or(text.text_len()); - - let line_text = &text[line_start.into()..line_end.into()]; - let hint_start = line_start + TextSize::try_from(line_text.find(hint)?).unwrap(); - let hint_end = hint_start + hint.text_len(); - Some(line_index.line_col_lsp_range(TextRange::new(hint_start, hint_end))) -} diff --git a/support/texlab/src/db/diagnostics/tex.rs b/support/texlab/src/db/diagnostics/tex.rs deleted file mode 100644 index a7b030a5bf..0000000000 --- a/support/texlab/src/db/diagnostics/tex.rs +++ /dev/null @@ -1,147 +0,0 @@ -use lsp_types::DiagnosticSeverity; -use rowan::{ast::AstNode, NodeOrToken, TextRange}; - -use crate::{db::document::Document, syntax::latex, util::line_index_ext::LineIndexExt, Db}; - -use super::{Diagnostic, DiagnosticCode, TexCode}; - -#[salsa::tracked] -pub fn collect(db: &dyn Db, document: Document) -> Vec<Diagnostic> { - let mut results = Vec::new(); - - if !document.location(db).uri(db).as_str().ends_with(".tex") { - return results; - } - - let data = match document.parse(db).as_tex() { - Some(data) => data, - None => return 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 -} - -fn analyze_environment( - db: &dyn Db, - document: Document, - node: latex::SyntaxNode, - results: &mut Vec<Diagnostic>, -) -> Option<()> { - let environment = latex::Environment::cast(node)?; - let name1 = environment.begin()?.name()?.key()?; - let name2 = environment.end()?.name()?.key()?; - if name1 != name2 { - let code = TexCode::MismatchedEnvironment; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: document - .line_index(db) - .line_col_lsp_range(latex::small_range(&name1)), - code: DiagnosticCode::Tex(code), - message: String::from(code), - }); - } - - Some(()) -} - -fn analyze_curly_group( - db: &dyn Db, - document: Document, - node: latex::SyntaxNode, - results: &mut Vec<Diagnostic>, -) -> Option<()> { - if !matches!( - node.kind(), - latex::CURLY_GROUP - | latex::CURLY_GROUP_COMMAND - | latex::CURLY_GROUP_KEY_VALUE - | latex::CURLY_GROUP_WORD - | latex::CURLY_GROUP_WORD_LIST - ) { - return None; - } - - let is_inside_verbatim_environment = node - .ancestors() - .filter_map(latex::Environment::cast) - .filter_map(|env| env.begin()) - .filter_map(|begin| begin.name()) - .filter_map(|name| name.key()) - .any(|name| { - ["asy", "lstlisting", "minted", "verbatim"].contains(&name.to_string().as_str()) - }); - - if !is_inside_verbatim_environment - && !node - .children_with_tokens() - .filter_map(NodeOrToken::into_token) - .any(|token| token.kind() == latex::R_CURLY) - { - let code = TexCode::RCurlyInserted; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: document - .line_index(db) - .line_col_lsp_range(TextRange::empty(node.text_range().end())), - code: DiagnosticCode::Tex(code), - message: String::from(code), - }); - } - - Some(()) -} - -fn analyze_curly_braces( - document: Document, - db: &dyn Db, - node: rowan::SyntaxNode<latex::LatexLanguage>, - results: &mut Vec<Diagnostic>, -) -> Option<()> { - if node.kind() == latex::ERROR && node.first_token()?.text() == "}" { - let code = TexCode::UnexpectedRCurly; - results.push(Diagnostic { - severity: DiagnosticSeverity::ERROR, - range: document - .line_index(db) - .line_col_lsp_range(node.text_range()), - code: DiagnosticCode::Tex(code), - message: String::from(code), - }); - - Some(()) - } else { - None - } -} diff --git a/support/texlab/src/db/discovery.rs b/support/texlab/src/db/discovery.rs deleted file mode 100644 index 9cc5a4e807..0000000000 --- a/support/texlab/src/db/discovery.rs +++ /dev/null @@ -1,258 +0,0 @@ -use std::path::Path; - -use itertools::Itertools; -use lsp_types::Url; -use rustc_hash::FxHashSet; - -use crate::{util::HOME_DIR, Db}; - -use super::{ - analysis::TexLink, - document::{Document, Language, Location, Owner}, - workspace::Workspace, -}; - -#[salsa::accumulator] -pub struct MissingDependencies(MissingDependency); - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub struct MissingDependency { - pub location: Location, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub struct Dependency { - pub source: Document, - pub target: Document, - pub origin: Option<DependencyOrigin>, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub struct DependencyOrigin { - pub link: TexLink, - pub old_base_dir: Location, - pub new_base_dir: Location, -} - -pub fn hidden_dependencies( - db: &dyn Db, - document: Document, - base_dir: Location, - dependencies: &mut Vec<Dependency>, -) { - 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] -pub fn hidden_dependency( - db: &dyn Db, - source: Document, - base_dir: Location, - extension: &'static str, -) -> Option<Dependency> { - let workspace = Workspace::get(db); - - let stem = source.location(db).stem(db)?; - let name = format!("{stem}.{extension}"); - - let location = workspace.output_dir(db, base_dir).join(db, &name)?; - match workspace.lookup(db, location) { - Some(target) => Some(Dependency { - source, - target, - origin: None, - }), - None => { - MissingDependencies::push(db, MissingDependency { location }); - None - } - } -} - -pub fn source_dependencies<'db>( - db: &'db dyn Db, - source: Document, - base_dir: Location, -) -> impl Iterator<Item = Dependency> + 'db { - source - .parse(db) - .as_tex() - .into_iter() - .flat_map(|data| data.analyze(db).links(db)) - .filter_map(move |link| source_dependency(db, source, base_dir, *link)) -} - -#[salsa::tracked] -pub fn source_dependency( - db: &dyn Db, - source: Document, - base_dir: Location, - link: TexLink, -) -> Option<Dependency> { - let workspace = Workspace::get(db); - - let stem = link.path(db).text(db); - - let mut file_names = vec![stem.clone()]; - link.kind(db) - .extensions() - .iter() - .map(|ext| format!("{stem}.{ext}")) - .for_each(|name| file_names.push(name)); - - let file_name_db = workspace.file_name_db(db); - let distro_files = file_names - .iter() - .filter_map(|name| file_name_db.get(name)) - .filter(|path| { - HOME_DIR - .as_deref() - .map_or(false, |dir| path.starts_with(dir)) - }) - .flat_map(Url::from_file_path) - .map(|uri| Location::new(db, uri)); - - for location in file_names - .iter() - .filter_map(|file_name| base_dir.join(db, file_name)) - .chain(distro_files) - { - match workspace.lookup(db, location) { - Some(target) => { - let origin = Some(DependencyOrigin { - link, - old_base_dir: base_dir, - new_base_dir: link - .base_dir(db) - .and_then(|path| base_dir.join(db, path.text(db))) - .unwrap_or(base_dir), - }); - - return Some(Dependency { - source, - target, - origin, - }); - } - None => { - MissingDependencies::push(db, MissingDependency { location }); - } - }; - } - - None -} - -#[derive(Debug, PartialEq, Eq, Clone, Hash)] -pub struct DependencyGraph { - pub start: Document, - pub edges: Vec<Dependency>, -} - -impl DependencyGraph { - pub fn preorder(&self) -> impl DoubleEndedIterator<Item = Document> + '_ { - std::iter::once(self.start) - .chain(self.edges.iter().map(|group| group.target)) - .unique() - } -} - -#[salsa::tracked(return_ref)] -pub fn dependency_graph(db: &dyn Db, start: Document) -> DependencyGraph { - let workspace = Workspace::get(db); - - let base_dir = workspace.working_dir(db, start.directory(db)); - let mut edges = Vec::new(); - let mut stack = vec![(start, base_dir)]; - let mut visited = FxHashSet::default(); - - while let Some((source, base_dir)) = stack.pop() { - for edge in source_dependencies(db, source, base_dir) { - edges.push(edge); - if visited.insert(edge.target) { - stack.push((edge.target, edge.origin.unwrap().new_base_dir)); - } - } - - hidden_dependencies(db, source, base_dir, &mut edges); - } - - DependencyGraph { start, edges } -} - -pub fn discover_dependencies(db: &mut dyn Db) { - let workspace = Workspace::get(db); - loop { - let mut changed = discover_parents(db, workspace); - - let paths: FxHashSet<_> = workspace - .documents(db) - .iter() - .flat_map(|&start| dependency_graph::accumulated::<MissingDependencies>(db, start)) - .filter_map(|link| link.location.path(db).as_deref()) - .filter(|path| path.is_file()) - .map(Path::to_path_buf) - .collect(); - - for path in paths { - if workspace.lookup_path(db, &path).is_none() { - let language = Language::from_path(&path).unwrap_or(Language::Tex); - changed |= workspace.load(db, &path, language, Owner::Server).is_some(); - } - } - - if !changed { - break; - } - } -} - -fn discover_parents(db: &mut dyn Db, workspace: Workspace) -> bool { - let mut changed = false; - - let dirs: FxHashSet<_> = workspace - .documents(db) - .iter() - .flat_map(|document| document.ancestor_dirs(db)) - .filter(|path| is_part_of_workspace(db, workspace, path)) - .map(Path::to_path_buf) - .collect(); - - for path in dirs - .iter() - .flat_map(std::fs::read_dir) - .flatten() - .flatten() - .filter(|entry| entry.file_type().map_or(false, |ty| ty.is_file())) - .map(|entry| entry.path()) - { - if let Some(language) = Language::from_path(&path) { - let can_be_parent = matches!( - language, - Language::Tex | Language::TexlabRoot | Language::Tectonic - ); - - if can_be_parent && workspace.lookup_path(db, &path).is_none() { - changed |= workspace.load(db, &path, language, Owner::Server).is_some(); - } - } - } - - changed -} - -fn is_part_of_workspace(db: &dyn Db, workspace: Workspace, path: &Path) -> bool { - let root_dirs = workspace.root_dirs(db); - if root_dirs.is_empty() { - return true; - } - - root_dirs - .iter() - .filter_map(|dir| dir.path(db).as_deref()) - .any(|dir| path.starts_with(dir)) -} diff --git a/support/texlab/src/db/document.rs b/support/texlab/src/db/document.rs deleted file mode 100644 index 40d0ab025f..0000000000 --- a/support/texlab/src/db/document.rs +++ /dev/null @@ -1,199 +0,0 @@ -use std::path::{Path, PathBuf}; - -use lsp_types::Url; -use rowan::{TextRange, TextSize}; - -use crate::{ - db::{ - diagnostics::Diagnostic, - parse::{BibDocumentData, LogDocumentData, TectonicData, TexDocumentData, TexlabRootData}, - }, - parser::{parse_bibtex, parse_build_log, parse_latex}, - util::line_index::LineIndex, - Db, -}; - -use super::{ - analysis::TexLinkKind, - parse::{self, DocumentData}, -}; - -#[salsa::interned] -pub struct Location { - #[return_ref] - pub uri: Url, -} - -#[salsa::tracked] -impl Location { - #[salsa::tracked(return_ref)] - pub fn path(self, db: &dyn Db) -> Option<PathBuf> { - let uri = self.uri(db); - if uri.scheme() == "file" { - uri.to_file_path().ok() - } else { - None - } - } - - pub fn stem(self, db: &dyn Db) -> Option<String> { - let path = self.uri(db).to_file_path().ok()?; - let stem = path.file_stem()?.to_str()?; - Some(String::from(stem)) - } - - pub fn join(self, db: &dyn Db, path: &str) -> Option<Location> { - let uri = self.uri(db).join(path).ok()?; - Some(Location::new(db, uri)) - } -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub enum Owner { - Client, - Server, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub enum Language { - Tex, - Bib, - Log, - TexlabRoot, - Tectonic, -} - -impl Language { - pub fn from_path(path: &Path) -> Option<Self> { - let name = path.file_name()?; - if name.eq_ignore_ascii_case(".texlabroot") || name.eq_ignore_ascii_case("texlabroot") { - return Some(Self::TexlabRoot); - } - - if name.eq_ignore_ascii_case("Tectonic.toml") { - return Some(Self::Tectonic); - } - - let extname = path.extension()?.to_str()?; - match extname.to_lowercase().as_str() { - "tex" | "sty" | "cls" | "def" | "lco" | "aux" | "rnw" => Some(Self::Tex), - "bib" | "bibtex" => Some(Self::Bib), - "log" => Some(Self::Log), - _ => None, - } - } - - pub fn from_id(id: &str) -> Option<Self> { - match id { - "tex" | "latex" => Some(Self::Tex), - "bib" | "bibtex" => Some(Self::Bib), - "texlabroot" => Some(Self::TexlabRoot), - _ => None, - } - } -} - -#[salsa::input] -pub struct LinterData { - #[return_ref] - pub chktex: Vec<Diagnostic>, -} - -#[salsa::input] -pub struct Document { - /// An object containing the URI of the document. - pub location: Location, - - /// 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.set_text(db).to(String::new()); - text.replace_range(std::ops::Range::<usize>::from(range), replace_with); - self.set_text(db).to(text); - self.set_cursor(db).to(range.start()); - } - - pub fn directory(self, db: &dyn Db) -> Location { - self.location(db).join(db, ".").unwrap() - } - - pub fn ancestor_dirs<'db>(self, db: &'db dyn Db) -> impl Iterator<Item = &'db Path> + 'db { - self.location(db) - .path(db) - .as_deref() - .into_iter() - .flat_map(|path| path.ancestors()) - .skip(1) - } -} - -#[salsa::tracked] -impl Document { - #[salsa::tracked] - pub fn parse(self, db: &dyn Db) -> DocumentData { - let text = self.text(db); - match self.language(db) { - Language::Tex => { - let data = TexDocumentData::new(db, parse_latex(text)); - parse::DocumentData::Tex(data) - } - Language::Bib => { - let data = BibDocumentData::new(db, parse_bibtex(text)); - DocumentData::Bib(data) - } - Language::Log => { - let data = LogDocumentData::new(db, parse_build_log(text)); - DocumentData::Log(data) - } - Language::TexlabRoot => { - let data = TexlabRootData; - DocumentData::TexlabRoot(data) - } - Language::Tectonic => { - let data = TectonicData; - DocumentData::Tectonic(data) - } - } - } - - #[salsa::tracked] - pub fn can_be_root(self, db: &dyn Db) -> bool { - self.parse(db).as_tex().map_or(false, |data| { - let analysis = data.analyze(db); - analysis.has_document_environment(db) - && !analysis - .links(db) - .iter() - .filter(|link| link.kind(db) == TexLinkKind::Cls) - .any(|link| link.path(db).text(db) == "subfiles") - }) - } - - #[salsa::tracked] - pub fn can_be_built(self, db: &dyn Db) -> bool { - self.parse(db) - .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/parse.rs b/support/texlab/src/db/parse.rs deleted file mode 100644 index 7187135d52..0000000000 --- a/support/texlab/src/db/parse.rs +++ /dev/null @@ -1,79 +0,0 @@ -use crate::{ - db::analysis::TexAnalysis, - syntax::{bibtex, latex, BuildLog}, - Db, -}; - -#[salsa::interned] -pub struct TexDocumentData { - pub green: rowan::GreenNode, -} - -impl TexDocumentData { - pub fn root(self, db: &dyn Db) -> latex::SyntaxNode { - latex::SyntaxNode::new_root(self.green(db)) - } -} - -#[salsa::tracked] -impl TexDocumentData { - #[salsa::tracked] - pub fn analyze(self, db: &dyn Db) -> TexAnalysis { - let root = latex::SyntaxNode::new_root(self.green(db)); - TexAnalysis::analyze(db, &root) - } -} - -#[salsa::interned] -pub struct BibDocumentData { - pub green: rowan::GreenNode, -} - -impl BibDocumentData { - pub fn root(self, db: &dyn Db) -> bibtex::SyntaxNode { - bibtex::SyntaxNode::new_root(self.green(db)) - } -} - -#[salsa::interned] -pub struct LogDocumentData { - pub log: BuildLog, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub struct TexlabRootData; - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub struct TectonicData; - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] -pub enum DocumentData { - Tex(TexDocumentData), - Bib(BibDocumentData), - Log(LogDocumentData), - TexlabRoot(TexlabRootData), - Tectonic(TectonicData), -} - -impl DocumentData { - pub fn as_tex(self) -> Option<TexDocumentData> { - match self { - Self::Tex(data) => Some(data), - _ => None, - } - } - - pub fn as_bib(self) -> Option<BibDocumentData> { - match self { - Self::Bib(data) => Some(data), - _ => None, - } - } - - pub fn as_log(self) -> Option<LogDocumentData> { - match self { - Self::Log(data) => Some(data), - _ => None, - } - } -} diff --git a/support/texlab/src/db/workspace.rs b/support/texlab/src/db/workspace.rs deleted file mode 100644 index 67c99792a2..0000000000 --- a/support/texlab/src/db/workspace.rs +++ /dev/null @@ -1,211 +0,0 @@ -use std::{ - borrow::Cow, - path::{Path, PathBuf}, -}; - -use itertools::Itertools; -use lsp_types::{ClientCapabilities, Url}; -use rowan::TextSize; -use rustc_hash::FxHashSet; - -use crate::{ - db::document::{Document, Location}, - distro::FileNameDB, - Db, -}; - -use super::{ - dependency_graph, - document::{Language, LinterData, Owner}, - Word, -}; - -#[salsa::input(singleton)] -pub struct Workspace { - #[return_ref] - pub documents: FxHashSet<Document>, - - #[return_ref] - pub client_capabilities: ClientCapabilities, - - #[return_ref] - pub root_dirs: Vec<Location>, - - #[return_ref] - pub file_name_db: FileNameDB, -} - -impl Workspace { - pub fn lookup(self, db: &dyn Db, location: Location) -> Option<Document> { - self.documents(db) - .iter() - .find(|document| document.location(db) == location) - .copied() - } - - pub fn lookup_uri(self, db: &dyn Db, uri: &Url) -> Option<Document> { - self.documents(db) - .iter() - .find(|document| document.location(db).uri(db) == uri) - .copied() - } - - pub fn lookup_path(self, db: &dyn Db, path: &Path) -> Option<Document> { - self.documents(db) - .iter() - .find(|document| document.location(db).path(db).as_deref() == Some(path)) - .copied() - } - - pub fn index_files<'db>(self, db: &'db dyn Db) -> impl Iterator<Item = Document> + 'db { - self.documents(db) - .iter() - .copied() - .filter(|&document| document.can_be_root(db)) - } - - pub fn open( - self, - db: &mut dyn Db, - uri: Url, - text: String, - language: Language, - owner: Owner, - ) -> Document { - let location = Location::new(db, uri); - let cursor = TextSize::from(0); - match self.lookup(db, location) { - Some(document) => { - document.set_text(db).to(text); - document.set_language(db).to(language); - document.set_owner(db).to(owner); - document.set_cursor(db).to(cursor); - document - } - None => { - let document = Document::new( - db, - location, - text, - language, - owner, - cursor, - LinterData::new(db, Vec::new()), - ); - - let mut documents = self.set_documents(db).to(FxHashSet::default()); - documents.insert(document); - self.set_documents(db).to(documents); - document - } - } - } - - pub fn load( - self, - db: &mut dyn Db, - path: &Path, - language: Language, - owner: Owner, - ) -> Option<Document> { - log::debug!("Loading document {} from disk...", path.display()); - - let uri = Url::from_file_path(path).ok()?; - let data = std::fs::read(path).ok()?; - let text = match String::from_utf8_lossy(&data) { - Cow::Borrowed(_) => unsafe { String::from_utf8_unchecked(data) }, - Cow::Owned(text) => text, - }; - - Some(self.open(db, uri, text, language, owner)) - } - - pub fn watch( - self, - db: &dyn Db, - watcher: &mut dyn notify::Watcher, - watched_dirs: &mut FxHashSet<PathBuf>, - ) { - let output_dirs = self - .documents(db) - .iter() - .map(|document| self.working_dir(db, document.directory(db))) - .map(|base_dir| self.output_dir(db, base_dir)) - .filter_map(|location| location.path(db).as_deref()); - - self.documents(db) - .iter() - .map(|document| document.location(db)) - .filter_map(|location| location.path(db).as_deref()) - .filter_map(|path| path.parent()) - .chain(output_dirs) - .filter(|path| watched_dirs.insert(path.to_path_buf())) - .for_each(|path| { - let _ = watcher.watch(path, notify::RecursiveMode::NonRecursive); - }); - } -} - -#[salsa::tracked] -impl Workspace { - #[salsa::tracked] - pub fn working_dir(self, db: &dyn Db, base_dir: Location) -> Location { - if let Some(dir) = db - .config() - .root_dir - .as_ref() - .and_then(|path| base_dir.join(db, path)) - { - return dir; - } - - self.documents(db) - .iter() - .filter(|doc| matches!(doc.language(db), Language::TexlabRoot | Language::Tectonic)) - .filter_map(|doc| doc.location(db).join(db, ".")) - .find(|root_dir| { - base_dir - .uri(db) - .as_str() - .starts_with(root_dir.uri(db).as_str()) - }) - .unwrap_or(base_dir) - } - - #[salsa::tracked] - pub fn output_dir(self, db: &dyn Db, base_dir: Location) -> Location { - let mut path = db.config().build.output_dir.clone(); - if !path.ends_with('/') { - path.push('/'); - } - - base_dir.join(db, &path).unwrap_or(base_dir) - } - - #[salsa::tracked(return_ref)] - pub fn parents(self, db: &dyn Db, child: Document) -> Vec<Document> { - self.index_files(db) - .filter(|&parent| dependency_graph(db, parent).preorder().contains(&child)) - .collect() - } - - #[salsa::tracked(return_ref)] - pub fn related(self, db: &dyn Db, child: Document) -> FxHashSet<Document> { - self.index_files(db) - .chain(self.documents(db).iter().copied()) - .map(|start| dependency_graph(db, start).preorder().collect_vec()) - .filter(|project| project.contains(&child)) - .flatten() - .collect() - } - - #[salsa::tracked] - pub fn number_of_label(self, db: &dyn Db, child: Document, name: Word) -> Option<Word> { - self.related(db, child) - .iter() - .filter_map(|document| document.parse(db).as_tex()) - .flat_map(|data| data.analyze(db).label_numbers(db)) - .find(|number| number.name(db) == name) - .map(|number| number.text(db)) - } -} diff --git a/support/texlab/src/features/completion/acronym_ref.rs b/support/texlab/src/features/completion/acronym_ref.rs deleted file mode 100644 index be7725fa2f..0000000000 --- a/support/texlab/src/features/completion/acronym_ref.rs +++ /dev/null @@ -1,29 +0,0 @@ -use rowan::ast::AstNode; - -use crate::{syntax::latex, util::cursor::CursorContext}; - -use super::builder::CompletionBuilder; - -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { - let (_, range, group) = context.find_curly_group_word()?; - latex::AcronymReference::cast(group.syntax().parent()?)?; - - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - for name in data - .root(context.db) - .descendants() - .filter_map(latex::AcronymDefinition::cast) - .filter_map(|node| node.name()) - .filter_map(|name| name.key()) - { - builder.glossary_entry(range, name.to_string()); - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/completion/glossary_ref.rs b/support/texlab/src/features/completion/glossary_ref.rs deleted file mode 100644 index 34d53bf24d..0000000000 --- a/support/texlab/src/features/completion/glossary_ref.rs +++ /dev/null @@ -1,35 +0,0 @@ -use rowan::ast::AstNode; - -use crate::{syntax::latex, util::cursor::CursorContext}; - -use super::builder::CompletionBuilder; - -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { - let (_, range, group) = context.find_curly_group_word()?; - latex::GlossaryEntryReference::cast(group.syntax().parent()?)?; - - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - for node in data.root(context.db).descendants() { - if let Some(name) = latex::GlossaryEntryDefinition::cast(node.clone()) - .and_then(|entry| entry.name()) - .and_then(|name| name.key()) - .map(|name| name.to_string()) - { - builder.glossary_entry(range, name); - } else if let Some(name) = latex::AcronymDefinition::cast(node) - .and_then(|entry| entry.name()) - .and_then(|name| name.key()) - .map(|name| name.to_string()) - { - builder.glossary_entry(range, name); - } - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/completion/label.rs b/support/texlab/src/features/completion/label.rs deleted file mode 100644 index ae3e010b0e..0000000000 --- a/support/texlab/src/features/completion/label.rs +++ /dev/null @@ -1,79 +0,0 @@ -use rowan::{ast::AstNode, TextRange}; - -use crate::{ - syntax::latex, - util::{self, cursor::CursorContext, label::LabeledObject, lsp_enums::Structure}, -}; - -use super::builder::CompletionBuilder; - -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { - let (range, is_math) = find_reference(context).or_else(|| find_reference_range(context))?; - - let db = context.db; - for document in context.related() { - if let Some(data) = document.parse(db).as_tex() { - for label in data - .analyze(db) - .labels(db) - .iter() - .filter(|label| label.origin(db).as_definition().is_some()) - { - match util::label::render(db, document, *label) { - Some(rendered_label) => { - let kind = match &rendered_label.object { - LabeledObject::Section { .. } => Structure::Section, - LabeledObject::Float { .. } => Structure::Float, - LabeledObject::Theorem { .. } => Structure::Theorem, - LabeledObject::Equation => Structure::Equation, - LabeledObject::EnumItem => Structure::Item, - }; - - if is_math && kind != Structure::Equation { - continue; - } - - let header = rendered_label.detail(db); - let footer = match &rendered_label.object { - LabeledObject::Float { caption, .. } => Some(caption.clone()), - _ => None, - }; - - let text = format!( - "{} {}", - label.name(db).text(db), - rendered_label.reference(db) - ); - - builder.label(range, label.name(db).text(db), kind, header, footer, text); - } - None => { - let kind = Structure::Label; - let header = None; - let footer = None; - let text = label.name(db).text(db).clone(); - builder.label(range, label.name(db).text(db), kind, header, footer, text); - } - } - } - } - } - - Some(()) -} - -fn find_reference(context: &CursorContext) -> Option<(TextRange, bool)> { - let (_, range, group) = context.find_curly_group_word_list()?; - let reference = latex::LabelReference::cast(group.syntax().parent()?)?; - let is_math = reference.command()?.text() == "\\eqref"; - Some((range, is_math)) -} - -fn find_reference_range(context: &CursorContext) -> Option<(TextRange, bool)> { - let (_, range, group) = context.find_curly_group_word()?; - latex::LabelReferenceRange::cast(group.syntax().parent()?)?; - Some((range, false)) -} diff --git a/support/texlab/src/features/completion/theorem.rs b/support/texlab/src/features/completion/theorem.rs deleted file mode 100644 index cd0dfe3a84..0000000000 --- a/support/texlab/src/features/completion/theorem.rs +++ /dev/null @@ -1,21 +0,0 @@ -use crate::util::cursor::CursorContext; - -use super::builder::CompletionBuilder; - -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { - let (_, range) = context.find_environment_name()?; - - let db = context.db; - for document in context.related() { - if let Some(data) = document.parse(db).as_tex() { - for environment in data.analyze(db).theorem_environments(db) { - builder.user_environment(range, environment.name(db).text(db)); - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/completion/user_command.rs b/support/texlab/src/features/completion/user_command.rs deleted file mode 100644 index 14c2222701..0000000000 --- a/support/texlab/src/features/completion/user_command.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::util::cursor::CursorContext; - -use super::builder::CompletionBuilder; - -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { - let range = context.cursor.command_range(context.offset)?; - let token = context.cursor.as_tex()?; - - let db = context.db; - for document in context.related() { - if let Some(data) = document.parse(db).as_tex() { - let text = document.text(db); - for name in data - .analyze(db) - .command_name_ranges(db) - .iter() - .copied() - .filter(|range| *range != token.text_range()) - .map(|range| &text[std::ops::Range::<usize>::from(range)]) - { - builder.user_command(range, name); - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/completion/user_environment.rs b/support/texlab/src/features/completion/user_environment.rs deleted file mode 100644 index cf6c2a7c78..0000000000 --- a/support/texlab/src/features/completion/user_environment.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::util::cursor::CursorContext; - -use super::builder::CompletionBuilder; - -pub fn complete<'db>( - context: &'db CursorContext, - builder: &mut CompletionBuilder<'db>, -) -> Option<()> { - let (name, range) = context.find_environment_name()?; - - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - for name in data - .analyze(context.db) - .environment_names(context.db) - .iter() - .filter(|n| n.as_str() != name) - { - builder.user_environment(range, name); - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/definition/command.rs b/support/texlab/src/features/definition/command.rs deleted file mode 100644 index 743a0f6d3c..0000000000 --- a/support/texlab/src/features/definition/command.rs +++ /dev/null @@ -1,41 +0,0 @@ -use rowan::ast::AstNode; - -use crate::{syntax::latex, util::cursor::CursorContext}; - -use super::DefinitionResult; - -pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionResult>> { - let name = context - .cursor - .as_tex() - .filter(|token| token.kind() == latex::COMMAND_NAME)?; - - let origin_selection_range = name.text_range(); - - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - let root = data.root(context.db); - if let Some(result) = root - .descendants() - .filter_map(latex::CommandDefinition::cast) - .filter(|def| { - def.name() - .and_then(|name| name.command()) - .map_or(false, |node| node.text() == name.text()) - }) - .find_map(|def| { - Some(DefinitionResult { - origin_selection_range, - target: document, - target_range: latex::small_range(&def), - target_selection_range: def.name()?.command()?.text_range(), - }) - }) - { - return Some(vec![result]); - } - } - } - - None -} diff --git a/support/texlab/src/features/definition/entry.rs b/support/texlab/src/features/definition/entry.rs deleted file mode 100644 index a945b18c41..0000000000 --- a/support/texlab/src/features/definition/entry.rs +++ /dev/null @@ -1,43 +0,0 @@ -use rowan::ast::AstNode; - -use crate::{ - syntax::{ - bibtex::{self, HasName}, - latex, - }, - util::cursor::CursorContext, -}; - -use super::DefinitionResult; - -pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionResult>> { - let db = context.db; - - let word = context - .cursor - .as_tex() - .filter(|token| token.kind() == latex::WORD)?; - - let key = latex::Key::cast(word.parent()?)?; - - latex::Citation::cast(key.syntax().parent()?.parent()?)?; - - let origin_selection_range = latex::small_range(&key); - - for document in context.related() { - if let Some(data) = document.parse(db).as_bib() { - for entry in data.root(db).children().filter_map(bibtex::Entry::cast) { - if let Some(key) = entry.name_token().filter(|k| k.text() == word.text()) { - return Some(vec![DefinitionResult { - origin_selection_range, - target: document, - target_selection_range: key.text_range(), - target_range: entry.syntax().text_range(), - }]); - } - } - } - } - - None -} diff --git a/support/texlab/src/features/definition/label.rs b/support/texlab/src/features/definition/label.rs deleted file mode 100644 index a1cc4ed15b..0000000000 --- a/support/texlab/src/features/definition/label.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::{ - db::analysis::label, - util::{self, cursor::CursorContext}, -}; - -use super::DefinitionResult; - -pub(super) fn goto_definition(context: &CursorContext) -> Option<Vec<DefinitionResult>> { - let db = context.db; - let (name_text, origin_selection_range) = context - .find_label_name_key() - .or_else(|| context.find_label_name_command())?; - - for document in context.related() { - if let Some(data) = document.parse(db).as_tex() { - if let Some(label) = data - .analyze(db) - .labels(db) - .iter() - .filter(|label| matches!(label.origin(db), label::Origin::Definition(_))) - .find(|label| label.name(db).text(db) == name_text.as_str()) - { - let target_selection_range = label.range(db); - let target_range = util::label::render(db, document, *label) - .map_or(target_selection_range, |label| label.range); - - return Some(vec![DefinitionResult { - origin_selection_range, - target: document, - target_range, - target_selection_range, - }]); - } - } - } - - None -} diff --git a/support/texlab/src/features/formatting.rs b/support/texlab/src/features/formatting.rs deleted file mode 100644 index 4a98df3f88..0000000000 --- a/support/texlab/src/features/formatting.rs +++ /dev/null @@ -1,33 +0,0 @@ -mod bibtex_internal; -mod latexindent; - -use lsp_types::{FormattingOptions, TextEdit, Url}; - -use crate::{ - db::{Language, Workspace}, - Db, Formatter, -}; - -use self::{bibtex_internal::format_bibtex_internal, latexindent::format_with_latexindent}; - -pub fn format_source_code( - db: &dyn Db, - uri: &Url, - options: &FormattingOptions, -) -> Option<Vec<TextEdit>> { - let workspace = Workspace::get(db); - let document = workspace.lookup_uri(db, uri)?; - match document.language(db) { - Language::Tex => match db.config().formatting.tex_formatter { - Formatter::Null => None, - Formatter::Server => None, - Formatter::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/highlight.rs b/support/texlab/src/features/highlight.rs deleted file mode 100644 index 52746a040f..0000000000 --- a/support/texlab/src/features/highlight.rs +++ /dev/null @@ -1,10 +0,0 @@ -mod label; - -use lsp_types::{DocumentHighlight, Position, Url}; - -use crate::{util::cursor::CursorContext, Db}; - -pub fn find_all(db: &dyn Db, uri: &Url, position: Position) -> Option<Vec<DocumentHighlight>> { - let context = CursorContext::new(db, uri, position, ())?; - label::find_highlights(&context) -} diff --git a/support/texlab/src/features/highlight/label.rs b/support/texlab/src/features/highlight/label.rs deleted file mode 100644 index e362295b04..0000000000 --- a/support/texlab/src/features/highlight/label.rs +++ /dev/null @@ -1,32 +0,0 @@ -use lsp_types::{DocumentHighlight, DocumentHighlightKind}; - -use crate::{ - db::analysis::label, - util::{cursor::CursorContext, line_index_ext::LineIndexExt}, -}; - -pub fn find_highlights(context: &CursorContext) -> Option<Vec<DocumentHighlight>> { - let db = context.db; - let (name_text, _) = context.find_label_name_key()?; - let data = context.document.parse(db).as_tex()?; - - let mut highlights = Vec::new(); - let line_index = context.document.line_index(db); - for label in data - .analyze(db) - .labels(db) - .iter() - .filter(|label| label.name(db).text(db) == &name_text) - { - let range = line_index.line_col_lsp_range(label.range(db)); - let kind = Some(match label.origin(db) { - label::Origin::Definition(_) => DocumentHighlightKind::WRITE, - label::Origin::Reference(_) => DocumentHighlightKind::READ, - label::Origin::ReferenceRange(_) => DocumentHighlightKind::READ, - }); - - highlights.push(DocumentHighlight { range, kind }); - } - - Some(highlights) -} diff --git a/support/texlab/src/features/hover/component.rs b/support/texlab/src/features/hover/component.rs deleted file mode 100644 index 61a428a9ce..0000000000 --- a/support/texlab/src/features/hover/component.rs +++ /dev/null @@ -1,28 +0,0 @@ -use lsp_types::MarkupKind; - -use crate::{ - db::analysis::TexLinkKind, - util::{components::COMPONENT_DATABASE, cursor::CursorContext}, -}; - -use super::HoverResult; - -pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { - let db = context.db; - let links = context.document.parse(db).as_tex()?.analyze(db).links(db); - links - .iter() - .filter(|link| matches!(link.kind(db), TexLinkKind::Sty | TexLinkKind::Cls)) - .filter(|link| link.range(db).contains_inclusive(context.offset)) - .find_map(|link| { - let value = COMPONENT_DATABASE - .documentation(link.path(db).text(db))? - .value; - - Some(HoverResult { - value, - value_kind: MarkupKind::PlainText, - range: link.range(db), - }) - }) -} diff --git a/support/texlab/src/features/hover/label.rs b/support/texlab/src/features/hover/label.rs deleted file mode 100644 index eafc104de6..0000000000 --- a/support/texlab/src/features/hover/label.rs +++ /dev/null @@ -1,23 +0,0 @@ -use lsp_types::MarkupKind; - -use crate::{ - db::Word, - util::{self, cursor::CursorContext}, -}; - -use super::HoverResult; - -pub(super) fn find_hover(context: &CursorContext) -> Option<HoverResult> { - let (name_text, range) = context - .find_label_name_key() - .or_else(|| context.find_label_name_command())?; - - let db = context.db; - util::label::find_label_definition(db, context.document, Word::new(db, name_text)) - .and_then(|(document, label)| util::label::render(db, document, label)) - .map(|label| HoverResult { - range, - value: label.reference(db), - value_kind: MarkupKind::PlainText, - }) -} diff --git a/support/texlab/src/features/inlay_hint.rs b/support/texlab/src/features/inlay_hint.rs deleted file mode 100644 index 5d2f5d4e11..0000000000 --- a/support/texlab/src/features/inlay_hint.rs +++ /dev/null @@ -1,45 +0,0 @@ -mod label; - -use lsp_types::{InlayHint, InlayHintLabel, Range, Url}; -use rowan::TextSize; - -use crate::{ - db::Workspace, - util::{line_index::LineIndex, line_index_ext::LineIndexExt}, - Db, -}; - -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.line_index(db); - - let mut builder = InlayHintBuilder { - line_index, - hints: Vec::new(), - }; - - let range = line_index.offset_lsp_range(range); - label::find_hints(db, document, range, &mut builder); - Some(builder.hints) -} - -struct InlayHintBuilder<'db> { - line_index: &'db LineIndex, - hints: Vec<InlayHint>, -} - -impl<'db> InlayHintBuilder<'db> { - pub fn push(&mut self, offset: TextSize, text: String) { - let position = self.line_index.line_col_lsp(offset); - self.hints.push(InlayHint { - position, - label: InlayHintLabel::String(text), - kind: None, - text_edits: None, - tooltip: None, - padding_left: Some(true), - padding_right: None, - data: None, - }); - } -} diff --git a/support/texlab/src/features/inlay_hint/label.rs b/support/texlab/src/features/inlay_hint/label.rs deleted file mode 100644 index ca52433e7b..0000000000 --- a/support/texlab/src/features/inlay_hint/label.rs +++ /dev/null @@ -1,48 +0,0 @@ -use rowan::TextRange; - -use crate::{ - db::{analysis::label, Document}, - util::{self, label::LabeledObject}, - Db, -}; - -use super::InlayHintBuilder; - -pub(super) fn find_hints( - db: &dyn Db, - document: Document, - range: TextRange, - builder: &mut InlayHintBuilder, -) -> Option<()> { - let data = document.parse(db).as_tex()?; - for label in data - .analyze(db) - .labels(db) - .iter() - .copied() - .filter(|label| matches!(label.origin(db), label::Origin::Definition(_))) - .filter(|label| label.range(db).intersect(range).is_some()) - { - if let Some(rendered) = util::label::render(db, document, label) { - 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); - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/link.rs b/support/texlab/src/features/link.rs deleted file mode 100644 index c252fc4a91..0000000000 --- a/support/texlab/src/features/link.rs +++ /dev/null @@ -1,41 +0,0 @@ -mod include; - -use lsp_types::{DocumentLink, Url}; -use rowan::TextRange; - -use crate::{ - db::{Document, Workspace}, - util::{line_index::LineIndex, line_index_ext::LineIndexExt}, - Db, -}; - -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.line_index(db), - links: Vec::new(), - }; - - include::find_links(db, document, &mut builder); - Some(builder.links) -} - -struct LinkBuilder<'db> { - db: &'db dyn Db, - line_index: &'db LineIndex, - links: Vec<DocumentLink>, -} - -impl<'db> LinkBuilder<'db> { - pub fn push(&mut self, range: TextRange, target: Document) { - let range = self.line_index.line_col_lsp_range(range); - let target = Some(target.location(self.db).uri(self.db).clone()); - self.links.push(DocumentLink { - range, - target, - tooltip: None, - data: None, - }); - } -} diff --git a/support/texlab/src/features/link/include.rs b/support/texlab/src/features/link/include.rs deleted file mode 100644 index f0c9d147fb..0000000000 --- a/support/texlab/src/features/link/include.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::{ - db::{dependency_graph, Document, Workspace}, - Db, -}; - -use super::LinkBuilder; - -pub(super) fn find_links(db: &dyn Db, document: Document, builder: &mut LinkBuilder) -> Option<()> { - let workspace = Workspace::get(db); - let parent = workspace - .parents(db, document) - .iter() - .next() - .copied() - .unwrap_or(document); - - let graph = dependency_graph(db, parent); - for edge in graph.edges.iter().filter(|edge| edge.source == document) { - if let Some(origin) = edge.origin { - builder.push(origin.link.range(db), edge.target); - } - } - - Some(()) -} diff --git a/support/texlab/src/features/reference/label.rs b/support/texlab/src/features/reference/label.rs deleted file mode 100644 index 394542320c..0000000000 --- a/support/texlab/src/features/reference/label.rs +++ /dev/null @@ -1,36 +0,0 @@ -use lsp_types::ReferenceContext; - -use crate::util::cursor::CursorContext; - -use super::ReferenceResult; - -pub(super) fn find_all_references( - context: &CursorContext<&ReferenceContext>, - results: &mut Vec<ReferenceResult>, -) -> Option<()> { - let db = context.db; - let (name_text, _) = context - .find_label_name_key() - .or_else(|| context.find_label_name_command())?; - - for document in context.related() { - if let Some(data) = document.parse(db).as_tex() { - for label in data - .analyze(db) - .labels(db) - .iter() - .filter(|label| label.name(db).text(db) == &name_text) - .filter(|label| { - label.origin(db).as_definition().is_none() || context.params.include_declaration - }) - { - results.push(ReferenceResult { - document, - range: label.range(db), - }); - } - } - } - - Some(()) -} diff --git a/support/texlab/src/features/rename/command.rs b/support/texlab/src/features/rename/command.rs deleted file mode 100644 index 1e5f2ff0ca..0000000000 --- a/support/texlab/src/features/rename/command.rs +++ /dev/null @@ -1,37 +0,0 @@ -use rowan::{TextRange, TextSize}; -use rustc_hash::FxHashMap; - -use crate::{syntax::latex, util::cursor::CursorContext}; - -use super::{Indel, Params, RenameResult}; - -pub(super) fn prepare_rename<T>(context: &CursorContext<T>) -> Option<TextRange> { - context.cursor.command_range(context.offset) -} - -pub(super) fn rename(context: &CursorContext<Params>) -> Option<RenameResult> { - prepare_rename(context)?; - let name = context.cursor.as_tex()?.text(); - let mut changes = FxHashMap::default(); - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - let root = data.root(context.db); - let edits = root - .descendants_with_tokens() - .filter_map(|element| element.into_token()) - .filter(|token| token.kind() == latex::COMMAND_NAME && token.text() == name) - .map(|token| { - let range = token.text_range(); - Indel { - delete: TextRange::new(range.start() + TextSize::from(1), range.end()), - insert: context.params.new_name.clone(), - } - }) - .collect(); - - changes.insert(document, edits); - } - } - - Some(RenameResult { changes }) -} diff --git a/support/texlab/src/features/rename/label.rs b/support/texlab/src/features/rename/label.rs deleted file mode 100644 index 7e596209d8..0000000000 --- a/support/texlab/src/features/rename/label.rs +++ /dev/null @@ -1,76 +0,0 @@ -use rowan::{ast::AstNode, TextRange}; -use rustc_hash::FxHashMap; - -use crate::{syntax::latex, util::cursor::CursorContext}; - -use super::{Indel, Params, RenameResult}; - -pub(super) fn prepare_rename<T>(context: &CursorContext<T>) -> Option<TextRange> { - let (_, range) = context.find_label_name_key()?; - Some(range) -} - -pub(super) fn rename(context: &CursorContext<Params>) -> Option<RenameResult> { - prepare_rename(context)?; - let (name_text, _) = context.find_label_name_key()?; - - let mut changes = FxHashMap::default(); - for document in context.related() { - if let Some(data) = document.parse(context.db).as_tex() { - let mut edits = Vec::new(); - for node in data.root(context.db).descendants() { - if let Some(range) = latex::LabelDefinition::cast(node.clone()) - .and_then(|label| label.name()) - .and_then(|name| name.key()) - .filter(|name| name.to_string() == name_text) - .map(|name| latex::small_range(&name)) - { - edits.push(Indel { - delete: range, - insert: context.params.new_name.clone(), - }); - } - - latex::LabelReference::cast(node.clone()) - .and_then(|label| label.name_list()) - .into_iter() - .flat_map(|label| label.keys()) - .filter(|name| name.to_string() == name_text) - .for_each(|name| { - edits.push(Indel { - delete: latex::small_range(&name), - insert: context.params.new_name.clone(), - }); - }); - - if let Some(label) = latex::LabelReferenceRange::cast(node.clone()) { - if let Some(name_from) = label - .from() - .and_then(|name| name.key()) - .filter(|name| name.to_string() == name_text) - { - edits.push(Indel { - delete: latex::small_range(&name_from), - insert: context.params.new_name.clone(), - }); - } - - if let Some(name_to) = label - .to() - .and_then(|name| name.key()) - .filter(|name| name.to_string() == name_text) - { - edits.push(Indel { - delete: latex::small_range(&name_to), - insert: context.params.new_name.clone(), - }); - } - } - } - - changes.insert(document, edits); - } - } - - Some(RenameResult { changes }) -} diff --git a/support/texlab/src/features/symbol/project_order.rs b/support/texlab/src/features/symbol/project_order.rs deleted file mode 100644 index f4aeb63bca..0000000000 --- a/support/texlab/src/features/symbol/project_order.rs +++ /dev/null @@ -1,202 +0,0 @@ -use itertools::Itertools; -use lsp_types::Url; - -use crate::{ - db::{dependency_graph, Document, Workspace}, - Db, -}; - -#[derive(Debug, PartialEq, Eq, Clone)] -pub struct ProjectOrdering { - ordering: Vec<Document>, -} - -impl ProjectOrdering { - pub fn new(db: &dyn Db) -> Self { - let workspace = Workspace::get(db); - - let ordering: Vec<_> = workspace - .index_files(db) - .chain(workspace.documents(db).iter().copied()) - .flat_map(|document| { - dependency_graph(db, document) - .preorder() - .rev() - .collect_vec() - }) - .unique() - .collect(); - - Self { ordering } - } - - pub fn get(&self, db: &dyn Db, uri: &Url) -> usize { - self.ordering - .iter() - .position(|doc| doc.location(db).uri(db) == uri) - .unwrap_or(std::usize::MAX) - } -} - -#[cfg(test)] -mod tests { - use crate::{ - db::{Language, Owner}, - Database, - }; - - use super::*; - - #[test] - fn test_no_cycles() { - let mut db = Database::default(); - let workspace = Workspace::get(&db); - - let a = workspace.open( - &mut db, - Url::parse("http://example.com/a.tex").unwrap(), - String::new(), - Language::Tex, - Owner::Client, - ); - - let b = workspace.open( - &mut db, - Url::parse("http://example.com/b.tex").unwrap(), - String::new(), - Language::Tex, - Owner::Client, - ); - - let c = workspace.open( - &mut db, - Url::parse("http://example.com/c.tex").unwrap(), - r#"\documentclass{article}\include{b}\include{a}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - let ordering = ProjectOrdering::new(&db); - - assert_eq!(ordering.get(&db, a.location(&db).uri(&db)), 0); - assert_eq!(ordering.get(&db, b.location(&db).uri(&db)), 1); - assert_eq!(ordering.get(&db, c.location(&db).uri(&db)), 2); - } - - #[test] - fn test_two_layers() { - let mut db = Database::default(); - let workspace = Workspace::get(&db); - - let a = workspace.open( - &mut db, - Url::parse("http://example.com/a.tex").unwrap(), - String::new(), - Language::Tex, - Owner::Client, - ); - - let b = workspace.open( - &mut db, - Url::parse("http://example.com/b.tex").unwrap(), - r#"\include{a}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - let c = workspace.open( - &mut db, - Url::parse("http://example.com/c.tex").unwrap(), - r#"\documentclass{article}\include{b}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - let ordering = ProjectOrdering::new(&db); - - assert_eq!(ordering.get(&db, a.location(&db).uri(&db)), 0); - assert_eq!(ordering.get(&db, b.location(&db).uri(&db)), 1); - assert_eq!(ordering.get(&db, c.location(&db).uri(&db)), 2); - } - - #[test] - fn test_cycles() { - let mut db = Database::default(); - let workspace = Workspace::get(&db); - - let a = workspace.open( - &mut db, - Url::parse("http://example.com/a.tex").unwrap(), - r#"\documentclass{article}\include{b}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - workspace.open( - &mut db, - Url::parse("http://example.com/b.tex").unwrap(), - r#"\include{a}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - workspace.open( - &mut db, - Url::parse("http://example.com/c.tex").unwrap(), - r#"\include{a}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - let ordering = ProjectOrdering::new(&db); - assert_ne!(ordering.get(&db, a.location(&db).uri(&db)), 0); - } - - #[test] - fn test_multiple_roots() { - let mut db = Database::default(); - let workspace = Workspace::get(&db); - - let a = workspace.open( - &mut db, - Url::parse("http://example.com/a.tex").unwrap(), - r#"\documentclass{article}\include{b}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - let b = workspace.open( - &mut db, - Url::parse("http://example.com/b.tex").unwrap(), - String::new(), - Language::Tex, - Owner::Client, - ); - - let c = workspace.open( - &mut db, - Url::parse("http://example.com/c.tex").unwrap(), - String::new(), - Language::Tex, - Owner::Client, - ); - - let d = workspace.open( - &mut db, - Url::parse("http://example.com/d.tex").unwrap(), - r#"\documentclass{article}\include{c}"#.to_string(), - Language::Tex, - Owner::Client, - ); - - let ordering = ProjectOrdering::new(&db); - assert!( - ordering.get(&db, b.location(&db).uri(&db)) - < ordering.get(&db, a.location(&db).uri(&db)) - ); - assert!( - ordering.get(&db, c.location(&db).uri(&db)) - < ordering.get(&db, d.location(&db).uri(&db)) - ); - } -} diff --git a/support/texlab/src/features/workspace_command/dep_graph.rs b/support/texlab/src/features/workspace_command/dep_graph.rs deleted file mode 100644 index 84e87c4026..0000000000 --- a/support/texlab/src/features/workspace_command/dep_graph.rs +++ /dev/null @@ -1,57 +0,0 @@ -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 deleted file mode 100644 index d80375fa03..0000000000 --- a/support/texlab/src/lib.rs +++ /dev/null @@ -1,125 +0,0 @@ -#![allow(clippy::needless_lifetimes)] - -pub(crate) mod citation; -mod client; -mod config; -pub mod db; -pub(crate) mod distro; -pub mod features; -pub mod parser; -mod server; -pub mod syntax; -pub mod util; - -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::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, - db::parse::LogDocumentData, - db::analysis::TexLink, - db::analysis::label::Number, - db::analysis::label::Name, - db::analysis::TheoremEnvironment, - db::analysis::GraphicsPath, - db::analysis::TexAnalysis, - db::analysis::TexAnalysis_has_document_environment, - db::MissingDependencies, - db::hidden_dependency, - db::source_dependency, - db::dependency_graph, - db::Workspace, - db::Workspace_working_dir, - db::Workspace_output_dir, - db::Workspace_parents, - db::Workspace_related, - db::Workspace_number_of_label, - db::diagnostics::tex::collect, - db::diagnostics::bib::collect, - db::diagnostics::log::collect, - db::diagnostics::collect, - db::diagnostics::collect_filtered, -); - -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(), - ); - - db - } -} - -impl salsa::Database for Database {} - -impl salsa::ParallelDatabase for Database { - fn snapshot(&self) -> salsa::Snapshot<Self> { - salsa::Snapshot::new(Self { - storage: self.storage.snapshot(), - }) - } -} - -pub(crate) fn normalize_uri(uri: &mut lsp_types::Url) { - fn fix_drive_letter(text: &str) -> Option<String> { - if !text.is_ascii() { - return None; - } - - match &text[1..] { - ":" => Some(text.to_ascii_uppercase()), - "%3A" | "%3a" => Some(format!("{}:", text[0..1].to_ascii_uppercase())), - _ => None, - } - } - - if let Some(mut segments) = uri.path_segments() { - if let Some(mut path) = segments.next().and_then(fix_drive_letter) { - for segment in segments { - path.push('/'); - path.push_str(segment); - } - - uri.set_path(&path); - } - } - - uri.set_fragment(None); -} 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 deleted file mode 100644 index 6ae6cd50be..0000000000 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@generic_command_escape.txt.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: src/parser/latex.rs -expression: root -input_file: src/parser/test_data/latex/generic_command_escape.txt ---- -ROOT@0..2 - PREAMBLE@0..2 - GENERIC_COMMAND@0..2 - COMMAND_NAME@0..2 "\\#" - diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter.txt.snap deleted file mode 100644 index 333db9df78..0000000000 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter.txt.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: src/parser/latex.rs -expression: root -input_file: src/parser/test_data/latex/parameter.txt ---- -ROOT@0..2 - PREAMBLE@0..2 - TEXT@0..2 - WORD@0..2 "#1" - diff --git a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter_error.txt.snap b/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter_error.txt.snap deleted file mode 100644 index 8e3b45ad67..0000000000 --- a/support/texlab/src/parser/snapshots/texlab__parser__latex__tests__parse@parameter_error.txt.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: src/parser/latex.rs -expression: root -input_file: src/parser/test_data/latex/parameter_error.txt ---- -ROOT@0..1 - PREAMBLE@0..1 - TEXT@0..1 - WORD@0..1 "#" - diff --git a/support/texlab/src/server/query.rs b/support/texlab/src/server/query.rs deleted file mode 100644 index f19d15f85b..0000000000 --- a/support/texlab/src/server/query.rs +++ /dev/null @@ -1,32 +0,0 @@ -use salsa::{DbWithJar, ParallelDatabase}; -use threadpool::ThreadPool; - -use crate::{Database, Db}; - -#[derive(Default)] -pub struct Engine { - db: Database, - pool: ThreadPool, -} - -impl Engine { - pub fn read(&self) -> &dyn Db { - &self.db - } - - pub fn write(&mut self) -> &mut dyn Db { - self.pool.join(); - &mut self.db - } - - pub fn fork<F: FnOnce(&dyn Db) + Send + 'static>(&self, action: F) { - let snapshot = self.db.snapshot(); - self.pool.execute(move || { - action(snapshot.as_jar_db()); - }); - } - - pub fn finish(self) { - self.pool.join(); - } -} diff --git a/support/texlab/src/util/label.rs b/support/texlab/src/util/label.rs deleted file mode 100644 index 74c72b234a..0000000000 --- a/support/texlab/src/util/label.rs +++ /dev/null @@ -1,267 +0,0 @@ -use std::str::FromStr; - -use rowan::{ast::AstNode, TextRange}; - -use crate::{ - db::{analysis::label, Document, Word, Workspace}, - syntax::latex::{self, HasBrack, HasCurly}, - Db, -}; - -use self::LabeledObject::*; - -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -pub enum LabeledFloatKind { - Figure, - Table, - Listing, - Algorithm, -} - -impl LabeledFloatKind { - pub fn as_str(self) -> &'static str { - match self { - Self::Figure => "Figure", - Self::Table => "Table", - Self::Listing => "Listing", - Self::Algorithm => "Algorithm", - } - } -} - -impl FromStr for LabeledFloatKind { - type Err = (); - - fn from_str(s: &str) -> Result<Self, Self::Err> { - match s { - "figure" | "subfigure" => Ok(Self::Figure), - "table" | "subtable" => Ok(Self::Table), - "listing" | "lstlisting" => Ok(Self::Listing), - "algorithm" => Ok(Self::Algorithm), - _ => Err(()), - } - } -} - -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum LabeledObject { - Section { - prefix: &'static str, - text: String, - }, - Float { - kind: LabeledFloatKind, - caption: String, - }, - Theorem { - kind: Word, - description: Option<String>, - }, - Equation, - EnumItem, -} - -#[derive(Debug, PartialEq, Eq, Clone)] -pub struct RenderedLabel { - pub range: TextRange, - pub number: Option<Word>, - pub object: LabeledObject, -} - -impl RenderedLabel { - pub fn reference(&self, db: &dyn Db) -> String { - match &self.number { - Some(number) => match &self.object { - Section { prefix, text } => format!("{} {} ({})", prefix, number.text(db), text), - Float { kind, caption } => { - format!("{} {}: {}", kind.as_str(), number.text(db), caption) - } - Theorem { - kind, - description: None, - } => format!("{} {}", kind.text(db), number.text(db)), - Theorem { - kind, - description: Some(description), - } => format!("{} {} ({})", kind.text(db), number.text(db), description), - Equation => format!("Equation ({})", number.text(db)), - EnumItem => format!("Item {}", number.text(db)), - }, - None => match &self.object { - Section { prefix, text } => format!("{} ({})", prefix, text), - Float { kind, caption } => format!("{}: {}", kind.as_str(), caption), - Theorem { - kind, - description: None, - } => kind.text(db).into(), - Theorem { - kind, - description: Some(description), - } => format!("{} ({})", kind.text(db), description), - Equation => "Equation".into(), - EnumItem => "Item".into(), - }, - } - } - - pub fn detail(&self, db: &dyn Db) -> Option<String> { - match &self.object { - Section { .. } | Theorem { .. } | Equation | EnumItem => Some(self.reference(db)), - Float { kind, .. } => { - let result = match &self.number { - Some(number) => format!("{} {}", kind.as_str(), number.text(db)), - None => kind.as_str().to_owned(), - }; - Some(result) - } - } - } -} - -pub fn render(db: &dyn Db, document: Document, label_def: label::Name) -> Option<RenderedLabel> { - let workspace = Workspace::get(db); - let label_num = workspace.number_of_label(db, document, label_def.name(db)); - let root = document.parse(db).as_tex()?.root(db); - - label_def - .origin(db) - .as_definition()? - .to_node(&root) - .syntax() - .ancestors() - .find_map(|parent| { - 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(db, parent.clone(), label_num)) - .or_else(|| render_label_theorem(db, document, parent, label_num)) - }) -} - -pub fn find_label_definition( - db: &dyn Db, - child: Document, - name: Word, -) -> Option<(Document, label::Name)> { - Workspace::get(db) - .related(db, child) - .iter() - .find_map(|document| { - let data = document.parse(db).as_tex()?; - let label = data - .analyze(db) - .labels(db) - .iter() - .filter(|label| label.origin(db).as_definition().is_some()) - .find(|label| label.name(db) == name)?; - - Some((*document, *label)) - }) -} - -fn render_label_float(parent: latex::SyntaxNode, number: Option<Word>) -> Option<RenderedLabel> { - let environment = latex::Environment::cast(parent.clone())?; - let environment_name = environment.begin()?.name()?.key()?.to_string(); - let kind = LabeledFloatKind::from_str(&environment_name).ok()?; - let caption = find_caption_by_parent(&parent)?; - Some(RenderedLabel { - range: latex::small_range(&environment), - number, - object: LabeledObject::Float { caption, kind }, - }) -} - -fn render_label_section(parent: latex::SyntaxNode, number: Option<Word>) -> Option<RenderedLabel> { - let section = latex::Section::cast(parent)?; - let text_group = section.name()?; - let text = text_group.content_text()?; - - Some(RenderedLabel { - range: latex::small_range(§ion), - number, - object: LabeledObject::Section { - prefix: match section.syntax().kind() { - latex::PART => "Part", - latex::CHAPTER => "Chapter", - latex::SECTION => "Section", - latex::SUBSECTION => "Subsection", - latex::SUBSUBSECTION => "Subsubsection", - latex::PARAGRAPH => "Paragraph", - latex::SUBPARAGRAPH => "Subparagraph", - _ => unreachable!(), - }, - text, - }, - }) -} - -fn render_label_enum_item( - db: &dyn Db, - parent: latex::SyntaxNode, - number: Option<Word>, -) -> Option<RenderedLabel> { - let enum_item = latex::EnumItem::cast(parent)?; - Some(RenderedLabel { - range: latex::small_range(&enum_item), - number: enum_item - .label() - .and_then(|label| label.content_text()) - .map(|text| Word::new(db, text)) - .or(number), - object: LabeledObject::EnumItem, - }) -} - -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 !db.config().syntax.math_environments.contains(&env_name) { - return None; - } - - Some(RenderedLabel { - range: latex::small_range(&env), - number, - object: LabeledObject::Equation, - }) -} - -fn render_label_theorem( - db: &dyn Db, - document: Document, - parent: latex::SyntaxNode, - number: Option<Word>, -) -> Option<RenderedLabel> { - let environment = latex::Environment::cast(parent)?; - let begin = environment.begin()?; - let description = begin.options().and_then(|options| options.content_text()); - - let environment_name = begin.name()?.key()?.to_string(); - - let kind = Workspace::get(db) - .related(db, document) - .iter() - .filter_map(|document| document.parse(db).as_tex()) - .flat_map(|data| data.analyze(db).theorem_environments(db)) - .find(|env| env.name(db).text(db) == &environment_name) - .map(|env| env.description(db))?; - - Some(RenderedLabel { - range: latex::small_range(&environment), - number, - object: LabeledObject::Theorem { kind, description }, - }) -} - -pub fn find_caption_by_parent(parent: &latex::SyntaxNode) -> Option<String> { - parent - .children() - .filter_map(latex::Caption::cast) - .find_map(|node| node.long()) - .and_then(|node| node.content_text()) -} diff --git a/support/texlab/texlab.1 b/support/texlab/texlab.1 index 4f7196658d..a34e068d09 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" "March 2023" "texlab 5.4.1" "User Commands" +.TH TEXLAB "1" "April 2023" "texlab 5.4.2" "User Commands" .SH NAME -texlab \- manual page for texlab 5.4.1 +texlab \- manual page for texlab 5.4.2 .SH SYNOPSIS .B texlab [\fI\,OPTIONS\/\fR] diff --git a/support/texlab/texlab.pdf b/support/texlab/texlab.pdf Binary files differindex 42c4d34fe5..90d24c7a04 100644 --- a/support/texlab/texlab.pdf +++ b/support/texlab/texlab.pdf |