LaTeX Support
Just a reminder that we'll eventually have to make changes to the Mason Registry, nvim-lspconfig and mason-lspconfig.nvim for this to work properly once it's merged.
For anyone wondering, progress on this stalled because of how weird LaTeX is as a language, but if anyone wants to take it on, feel free to. Here's the old draft pr for this feature: https://github.com/elijah-potter/harper/pull/100
Hi @grantlemons I understand that there is not much one can do because TeX is a substitution based language. However, LTeX somehow gets it working. One does not need a perfect solution, but a good enough one. For instance, just extracting the text and using it, considering all formulae like jsut single numbers would be a start. It is a bit sad to see the depelopment stopped. How can I help?
I am also interested in making this work for LaTeX. It seems to me that LTeX ignores some user-defined macros, which results in some false positives, but is nonetheless very useful. Would that be an option here?
I tried installing the harper-ls version in the branch #100 but due to my limited rust skills, I would either need to move harper-latex and the tree-sitter inside harper-core to avoid a circular import :(
I echo the support and interest in this feature. I've been looking for an integrated grammar checker after the VS Code Grammarly Extension was sunset. Is the current work now in the latex-parsing branch? What are the current blockers?
Reading the PR and this thread, it appears the issues were around:
- How to handle macros in the middle of paragraphs, i.e. macro expansion
- How to consider the inputs to macros
- Giving lints about capitalisation
- And linting the package import configuration (which probably produces false negatives external to the actual text/document/file?)
Is there more behind the scenes that hasn't been discussed? Perhaps we can task up some of this so others can chip. Or at least restart discussion on some of these more fundamental issues. Without knowing the scope of work required to get this over the line, it's a hard ask for someone to pick this up.
Personally, I'm not too fussed if the parsing is imperfect or limited and fails around complex macros. I'm a C++ developer by trade, I'm used to Visual Studio falling over and giving up when handling macros. Developers write terribly complex and convoluted macros all the time, and there's a limit to how far intellisense-like parsing can go before it's basically just reimplementing the compiler.
The latex-parsing branch is extremely out of date.
The main blocker is just that parsing LaTeX sucks. I did find a project called unified-latex, which has (unofficial?) Rust bindings in the unlatex crate.
The unified-latex folks explain that it will never be perfect:
Though parsing LaTeX isn't possible since it effectively has no grammar, unified-latex makes some practical assumptions. It should work on your code, unless you do complicated things like redefine control sequences or embed complicated TeX-style macros.
I don't know any technical details, but TexLab's parser might provide some aid (If you haven't looked into it before). It is an LSP for LaTeX written in Rust.
https://github.com/latex-lsp/texlab/tree/master/crates/parser
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 14 days. Thank you for your contribution!
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 14 days. Thank you for your contribution!
Progress is chugging along. #2073 is almost feature-complete, and I'll mark it as 'ready for review' after some refactoring.
Progress is chugging along. #2073 is almost feature-complete, and I'll mark it as 'ready for review' after some refactoring.
加油!화이팅!がんばって!ສຸກດີ!
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 14 days. Thank you for your contribution!
Progress is chugging along. #2073 is almost feature-complete, and I'll mark it as 'ready for review' after some refactoring.
YAY \o/ I will have a look and see how I can help.
Quick update:
It looks like #2073 is infeasible because it relies on an incompatibly-licensed dependency. However, I've drafted #2689, which includes a parser build from scratch for LaTeX documents. Since it's quite customized to our setup, we'll be able to ship it in harper.js and then downstream in our Chrome extension. From there, we can add support to Overleaf, the most popular LaTeX editor there is.
This issue was solved with #2689. Any further work needed is out of the scope of this issue and should be filed separately.