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

Ability to disable rules inline or for a section of text #280

Closed dvaerum closed 8 months ago

dvaerum commented 8 months ago

Is your feature request related to a problem? Please describe. I frustrated me that I cannot disable simple rules for sections of text. Occasionally, I would like to be able to disable/enable some rules while keeping others.

\begin{enumerate}
    \item Turn on the AP host (laptop).

    \item Login with \todo{Add the missing name and password} the username
    % LTeX: enabled=false
    \textbf{cisco}
    % LTeX: enabled=true
    and password \textbf{Password01}.

    \item Enter the folder
\end{enumerate}

In this example, LTeX keeps saying that and in and password is breaking the rule UPPERCASE_SENTENCE_START and that the sentence should start with an uppercase letter.

Describe the solution you'd like Can we implement a “Magic Comments” which allow one to disable and enable rules, something like this?

% LTeX: disabledRules=[UPPERCASE_SENTENCE_START]
% LTeX: enableRules=[UPPERCASE_SENTENCE_START]

Describe alternatives you've considered The only other alternative I know of is to mark it as a false positive

Additional context It would also be nice if the “Magic Comments” could work on X number of lines following the “Magic Comments”.

Example: I want to disable LTeX for the next line, so I write LTeX(1):. If I wanted it to be disabled for the next 3 lines, I would write it as LTeX(3):

Here is a sample of my previous example rewrite as it would have been if this feature existed

% LTeX(1): enabled=false
\textbf{cisco}
and password \textbf{Password01}.
dvaerum commented 8 months ago

Just found this feature request https://github.com/valentjn/ltex-ls/issues/271 and mine is basically a duplication of it