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
786 stars 38 forks source link

restructuredText ltex.hiddenFalsePositive #301

Open koeppe-at-pdtec opened 7 months ago

koeppe-at-pdtec commented 7 months ago

Hello,

i want to use ltex on rst files in vscode. As it lacks some linting capabilities for rst i want to add them myself to remove false positives.

i have a .vscode\ltex.hiddenFalsePositives.en-US.txt file that works for me except I fail to match code blocks via regex. Actually i even fail to match the first line. I'm out of clues what i'am doing wrong.

here is my example. example.zip

.vscode\ltex.hiddenFalsePositives.en-US.txt The last line does not match

{"rule":"DOUBLE_PUNCTUATION","sentence":"(\\.\\./)+"}
{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"^\\ *?\\.\\.\\ +\\w+\\:\\:.*?$"}
{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"(\\w+_)+\\w+"}
{"rule":"UPPERCASE_SENTENCE_START","sentence":"(\\w+_)+\\w+"}
{"rule":"MORFOLOGIK_RULE_EN_US","sentence":"\\|\\w+\\|"}
{"rule":"UPPERCASE_SENTENCE_START","sentence":"^\\ *\\.\\.\\ +code-block::.*?$"}

test.rst

.. code-block:: json

    {
        "test": 123
    }
koeppe-at-pdtec commented 7 months ago

Might be a bug:

the request to the LS is

Params: {
    "command": "_ltex.checkDocument",
    "arguments": [
        {
            "uri": "file:///c%3A/pdtec/gitlab/simdata-manager-reference-manual/test.rst",
            "codeLanguageId": "restructuredtext",
            "text": ".. code-block:: json\r\n\r\n    {\r\n        \"test\": 123\r\n    }\r\n"
        }
    ]
}

the configuration request result (only the important part):

        "hiddenFalsePositives": {
            "en-US": [
                "{\"rule\":\"DOUBLE_PUNCTUATION\",\"sentence\":\"(\\\\.\\\\./)+\"}",
                "{\"rule\":\"MORFOLOGIK_RULE_EN_US\",\"sentence\":\"(\\\\w+_)+\\\\w+\"}",
                "{\"rule\":\"MORFOLOGIK_RULE_EN_US\",\"sentence\":\"\\\\|\\\\w+\\\\|\"}",
                "{\"rule\":\"MORFOLOGIK_RULE_EN_US\",\"sentence\":\"^\\\\ *?\\\\.\\\\.\\\\ +\\\\w+\\\\:\\\\:.*?$\"}",
                "{\"rule\":\"UPPERCASE_SENTENCE_START\",\"sentence\":\"(\\\\w+_)+\\\\w+\"}",
                "{\"rule\":\"UPPERCASE_SENTENCE_START\",\"sentence\":\"^\\\\ *\\\\.\\\\.\\\\ +code-block::.*?$\"}"
            ],

the rule "{\"rule\":\"UPPERCASE_SENTENCE_START\",\"sentence\":\"^\\\\ *\\\\.\\\\.\\\\ +code-block::.*?$\"}"

results, after parsed twice, in this regex ^\ *\.\.\ +code-block::.*?$ that matches this string ".. code-block:: json\r\n\r\n {\r\n \"test\": 123\r\n }\r\n"

So either the regexp is wrong escaped or the server does apply the regex differently than i think

pickled-dict commented 3 months ago

Is this repo dead? I haven't seen any maintainers answering questions and the last commit was about a year ago... This is the exact problem I'm having but no one will answer issue threads.

koeppe-at-pdtec commented 3 months ago

Hi @pickled-dict, i fear you are right.

The owner activities across all of his projects is nearly zero. So i guess we can only help ourselfs. Unfortunately i'm a Python guy and have no clue of Kotlin :(