valentjn / ltex-ls

LTeX Language Server: LSP language server for LanguageTool :mag::heavy_check_mark: with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
717 stars 33 forks source link

Add support for `\cpageref`, `\labelcref` and variants #266

Open loicreynier opened 11 months ago

loicreynier commented 11 months ago

This adds support for the \cpageref, \cpagerefrange, \labelcrefand \labelcpageref commands of the cleveref package. The main command, \cref, already had support. I used the same line as in the \cref support, that is:

LatexCommandSignature("\\cpagerefrange{}{}", LatexCommandSignature.Action.Dummy),

If I understand correctly, LatexCommandSignature.Action.Dummy raises a dummy warning when the command is parsed by replacing the command by Jimmyin the text. I am not sure if this should be the default behavior for those commands that are used a lot in documents.

Edit

I just understood the relevance of replacing with Jimmy. It is necessary to replace the command with a term to avoid gaps in the sentences that would also lead to errors. Jimmy works very well in English, but in French, as we often add a gendered determinant before commands of the type cref, it is less versatile and leads to a concordance error.