New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not try to parse embedded (asy
) code as TeX
#490
Comments
That's exactly what's happening at the moment. Simply stopping parsing is a bit difficult with our approach because there is no simple token that signals the end of the asy environment to the parser. However, I think we should disable the completion inside these environments and do not report diagnostics from these environments. |
That sounds reasonable. But wouldn't be enough (for this example) to just temporarily treat |
nothing new about this issue? |
The problem is that the current lexer is very simple (auto-generated using the |
That approach makes sense; I don't think anything is lost by skipping over these environments. #500 does not seem to fix the issue for me, though? |
Yeah, my bad. The diagnostics are still wrong for this case. Actually, the problem is much more difficult than I thought. Just not treating |
Yeah, language injection is hard... (But excited to hear about performance ideas for the tree-sitter parser; from what I've seen, people are using it heavily with Neovim!) |
Now with the new tree-sitter based parser, is this now possible (excluding At least for highlighting, injecting a C parser for |
Yeah, this is definitely possible now (the contents can be parsed as a Another problem at the moment is the performance regression with the parser. While incremental reparsing is very fast, traversing the tree is very slow (slower than parsing the entire document from scratch with the current parser). My previous strategy was to limit the depth by not traversing the |
## [4.0.0] - 25.05.2022 ### Added - Add `--version` command line flag - Provide pre-built binaries for `aarch64-apple-darwin` architecture ([#591](latex-lsp/texlab#591)) - Autocomplete files based on `\graphicspath` ([#590](latex-lsp/texlab#590)) - Release `texlab` on `crates.io` ([#399](latex-lsp/texlab#399)) ### Changed - _BREAKING_: Use client-side file watching instead of server-side notifications (`workspace/didChangeWatchedFiles`) - _BREAKING_: Bump minimum supported Rust version to 1.58.1 - _BREAKING_: Do not use `citeproc-rs` to render citations. Instead, use a custom approach that tries to resemble the `BibLaTeX` output ([#629](latex-lsp/texlab#629)) ### Fixed - Parse `\subinputfrom` command correctly ([#610](latex-lsp/texlab#610)) - Parse verbatim environments correctly ([#490](latex-lsp/texlab#490)) - Stop capturing stdout when build exits ([#588](latex-lsp/texlab#588)) - Fix parsing of key-value pairs ([#573](latex-lsp/texlab#573)) - Normalize `texlab.rootDirectory` when resolving includes ([#571](latex-lsp/texlab#571)) - Allow optional arguments in environment definitions ([#570](latex-lsp/texlab#570)) - Allow `=` in include paths ([#568](latex-lsp/texlab#568))
The texlab parser seems to try to parse embedded
asy
code as TeX, with the expected results:The problem here is the
i%3
-- the%
is seen as a comment marker, even thoughasy
is basically C code, so comments are marked with//
.I believe the best option is to just stop parsing known code environments (as
verbatim
already is?)Off the top of my head, these would be
asy
asydef
luacode
(for lualatex)minted
The text was updated successfully, but these errors were encountered: