Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restructuredText ltex.hiddenFalsePositive #301

Open
koeppe-at-pdtec opened this issue Apr 16, 2024 · 1 comment
Open

restructuredText ltex.hiddenFalsePositive #301

koeppe-at-pdtec opened this issue Apr 16, 2024 · 1 comment
Labels
1-question ❓ Issue type: General or specific question about LTeX

Comments

@koeppe-at-pdtec
Copy link

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 koeppe-at-pdtec added the 1-question ❓ Issue type: General or specific question about LTeX label Apr 16, 2024
@koeppe-at-pdtec
Copy link
Author

koeppe-at-pdtec commented Apr 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-question ❓ Issue type: General or specific question about LTeX
Projects
None yet
Development

No branches or pull requests

1 participant