vim-LanguageTool
vim-LanguageTool copied to clipboard
Run checker only on code comments / strings (feature request)
Love the plugin, thanks for the work!
When writing code with verbose comments and/or in-code documentation (docstrings), it would help to be able to run the tool only on some configurable sections of the file.
I've tried a few things:
- use a macro to select next relevant comment section and run
:'<,'>LanguageToolCheck
on the selection- need a different macro for every comment / string syntax / programming language combination
- checking some entire file takes a long time (2s / request * 100 comment sections in some file) and is a manual process
- using
global
like:g/pattern/LanguageToolCheck
- runs one request for every line
- but the output buffer is scrapped every time, so it's not usable
- use some external script to replace irrelevant pieces of the file with spaces before running LanguageTool on it
- replace LanguageTool executable with this script in
g:languagetool_cmd
- didn't actually try this one yet, is this the simplest fix?
- replace LanguageTool executable with this script in
On selecting what sections to be checked and what not to be, we pretty much have two options:
- include/exclude list of regex
- include/exclude list of syntax highlight types
With one of these available, the user would be able to set up different rule sets for different programming languages using autocmd FileType
.
Edit: I see people trying to do this specifically for LaTeX: https://github.com/dpelle/vim-LanguageTool/pull/4
What do you think?