valentjn/ltex-ls

restructuredText ltex.hiddenFalsePositive

koeppe-at-pdtec opened this issue · 3 comments

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
    }

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

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.

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 :(