Skip to content

feat(grammar): add +lsp flag to enable lsp-ltex#6683

Draft
abougouffa wants to merge 8 commits into
doomemacs:masterfrom
abougouffa:feat/add-ltex-grammar
Draft

feat(grammar): add +lsp flag to enable lsp-ltex#6683
abougouffa wants to merge 8 commits into
doomemacs:masterfrom
abougouffa:feat/add-ltex-grammar

Conversation

@abougouffa

@abougouffa abougouffa commented Aug 16, 2022

Copy link
Copy Markdown
Contributor

Enable fast grammar checking using lsp-ltex, which provides integration with the LTeX LS, this last uses LanguageTool to correct grammar. This is way faster and responsive than the currently used langtool package.

In addition, LTeX LS understands many formats and languages (like Org, Markdown, LaTeX...), so it produces less false positives related to the language keywords, tags, or commands.

The configuration can be used enabling +lsp for the grammar module.

Example Org document after enabling :checkers (grammar +lsp)

Screenshot_20220816_153750


@abougouffa abougouffa changed the title Feat/add ltex grammar feat(grammar): add +lsp flag to enable lsp-ltex Aug 16, 2022
@hlissner hlissner added is:feature Adds or requests new features, or extends existing ones :tools lsp Pertains to Doom's :tools lsp module :checkers grammar Pertains to Doom's :checkers grammar module labels Aug 16, 2022
@hlissner hlissner added this to the modules v22.08 milestone Aug 16, 2022
@abougouffa abougouffa force-pushed the feat/add-ltex-grammar branch from e25b34e to bed44b1 Compare August 16, 2022 14:34
When the user adds `lsp-ltex` to `lsp-disabled-clients`, or call
`+lsp-ltex-disable` in his config to disable `lsp-ltex` by default, this
predicate ensures loading `lsp-ltex` only if enabled.
@abougouffa abougouffa force-pushed the feat/add-ltex-grammar branch from fb0f00f to 044853c Compare August 16, 2022 14:44
First, this makes the function documentation matches the desired
behavior "Enable for the current buffer", and also, fixes some issues
when firing LSP automatically in some modes (as `org-msg-mode`).
@numkem

numkem commented Aug 24, 2022

Copy link
Copy Markdown

Is there a way to make this work when composing an email with mu4e?

@abougouffa

Copy link
Copy Markdown
Contributor Author

Is there a way to make this work when composing an email with mu4e?

@numkem In general, LSP servers try to load an entire workspace, which doesn't works with mails. I didn't dig deeper to figure out a workaround.

You can use flycheck-languagetool as an alternative, you can take a look at my config, you will find a configuration example there.

Comment thread modules/checkers/grammar/config.el Outdated
(+lsp-ltex-enable)))

(map! :localleader
:map (text-mode-map latex-mode-map org-mode-map markdown-mode-map)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abougouffa great stuff! I just tried this, and I believe we could also add LaTeX-mode-map here. wdyt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @regadas

Yep, it totally makes sens, I thought LaTeX-mode is an alias to latex-mode!

I will add it to the map list.

@hlissner hlissner marked this pull request as draft September 6, 2022 23:43
@abougouffa abougouffa force-pushed the feat/add-ltex-grammar branch 2 times, most recently from fcf51b5 to f783e8e Compare September 8, 2022 10:57
@abougouffa abougouffa force-pushed the feat/add-ltex-grammar branch from f783e8e to 9b42aa4 Compare September 8, 2022 11:01
@maikol-solis

Copy link
Copy Markdown
Contributor

Hi!

I just discovered the eglot counterpart for lsp-ltex called eglot-lsp (https://github.com/emacs-languagetool/eglot-ltex).

What do you think?

Is it worth include it in this PR or it could be in a future one?

Thanks.

@peterhoeg

Copy link
Copy Markdown
Contributor

When using ltex-ls with eglot, you don't actually need the mentioned 3rd party package. You can just call:

(set-eglot-client! 'text-mode '("ltex-ls"))

@npajkovsky

Copy link
Copy Markdown

Anybody know how to make it work in programming mode?

@peterhoeg

peterhoeg commented Feb 4, 2024 via email

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:checkers grammar Pertains to Doom's :checkers grammar module is:feature Adds or requests new features, or extends existing ones :tools lsp Pertains to Doom's :tools lsp module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants