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

Quick fix removes latex commands #349

Closed
t-huyeng opened this issue Jul 6, 2021 · 4 comments
Closed

Quick fix removes latex commands #349

t-huyeng opened this issue Jul 6, 2021 · 4 comments
Assignees
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-confirmed Issue status: Confirmed, reproducible bug in LTeX 3-fixed Issue resolution: Issue has been fixed on the develop branch
Milestone

Comments

@t-huyeng
Copy link

t-huyeng commented Jul 6, 2021

Hey,

thanks for this great extension. I could not finde an issue that fits my problem.

Describe the bug
Quick fix is replacing other words or commands instead of only the wrong word. This happens for example to me with items or sections.

Steps to reproduce
Steps to reproduce the behavior:

  1. Create an itemize environment
  2. write something wrong
  3. Click on "Quick Fix"
  4. Choose a correct word
  5. See bug that not only the word but also /item gets replaced

Expected behavior
Only the wrong word should be replaced

Sample document

\documentclass{article}
    % General document formatting

\begin{document}


\begin{itemize}
\item test % this should be replaced with Test - but the quick fix is replacing "\item test" with "Test"
\end{itemize}

\end{document}

LTeX configuration

"ltex.language": "de-DE",

"LTeX Language Server" log file

Juli 06, 2021 7:51:34 NACHM. org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FEIN: Obtained 0 rule matches

"LTeX Language Client" log file

[Trace - 19:53:33] Sending request 'textDocument/codeAction - (55)'.
Params: {
    "textDocument": {
        "uri": "file:..../document.tex"
    },
    "range": {
        "start": {
            "line": 7,
            "character": 10
        },
        "end": {
            "line": 7,
            "character": 10
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 6,
                        "character": 0
                    },
                    "end": {
                        "line": 7,
                        "character": 10
                    }
                },
                "message": "Dieser Satz fängt nicht mit einem großgeschriebenen Wort an. – UPPERCASE_SENTENCE_START",
                "severity": 3,
                "source": "LTeX"
            }
        ]
    }
}


[Trace - 19:53:33] Received response 'textDocument/codeAction - (55)' in 2ms.
Result: [
    {
        "title": "Use 'Test'",
        "kind": "quickfix.ltex.acceptSuggestions",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 6,
                        "character": 0
                    },
                    "end": {
                        "line": 7,
                        "character": 10
                    }
                },
                "severity": 3,
                "source": "LTeX",
                "message": "Dieser Satz fängt nicht mit einem großgeschriebenen Wort an. – UPPERCASE_SENTENCE_START"
            }
        ],
        "edit": {
            "documentChanges": [
                {
                    "textDocument": {
                        "version": 83,
                        "uri": "file:..../document.tex"
                    },
                    "edits": [
                        {
                            "range": {
                                "start": {
                                    "line": 6,
                                    "character": 0
                                },
                                "end": {
                                    "line": 7,
                                    "character": 10
                                }
                            },
                            "newText": "Test"
                        }
                    ]
                }
            ]
        }
    },
    {
        "title": "Hide false positive",
        "kind": "quickfix.ltex.hideFalsePositives",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 6,
                        "character": 0
                    },
                    "end": {
                        "line": 7,
                        "character": 10
                    }
                },
                "severity": 3,
                "source": "LTeX",
                "message": "Dieser Satz fängt nicht mit einem großgeschriebenen Wort an. – UPPERCASE_SENTENCE_START"
            }
        ],
        "command": {
            "title": "Hide false positive",
            "command": "_ltex.hideFalsePositives",
            "arguments": [
                {
                    "uri": "...../document.tex",
                    "falsePositives": {
                        "de-DE": [
                            "{\"rule\":\"UPPERCASE_SENTENCE_START\",\"sentence\":\"^\\\\Qtest\\\\E$\"}"
                        ]
                    }
                }
            ]
        }
    },
    {
        "title": "Disable rule",
        "kind": "quickfix.ltex.disableRules",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 6,
                        "character": 0
                    },
                    "end": {
                        "line": 7,
                        "character": 10
                    }
                },
                "severity": 3,
                "source": "LTeX",
                "message": "Dieser Satz fängt nicht mit einem großgeschriebenen Wort an. – UPPERCASE_SENTENCE_START"
            }
        ],
        "command": {
            "title": "Disable rule",
            "command": "_ltex.disableRules",
            "arguments": [
                {
                    "uri": "file:..../document.tex",
                    "ruleIds": {
                        "de-DE": [
                            "UPPERCASE_SENTENCE_START"
                        ]
                    }
                }
            ]
        }
    }
]

Version information
List here the version information of the relevant software.

  • Windows_NT x64 10.0.19042
  • VS Code: 1.57,1
  • vscode-ltex: 10.4.0

Small gif: https://imgur.com/a/LqcOzae

@t-huyeng t-huyeng added 1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Jul 6, 2021
@hpvd
Copy link

hpvd commented Jul 7, 2021

same here using v10.4.0 on 1.57.1

@valentjn valentjn added 2-confirmed Issue status: Confirmed, reproducible bug in LTeX and removed 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Jul 7, 2021
valentjn added a commit to valentjn/ltex-ls that referenced this issue Jul 9, 2021
@valentjn valentjn self-assigned this Jul 9, 2021
@valentjn valentjn added this to the 10.5.0 milestone Jul 9, 2021
valentjn added a commit to valentjn/ltex-ls that referenced this issue Jul 9, 2021
@valentjn
Copy link
Owner

valentjn commented Jul 9, 2021

I think this got introduced in valentjn/ltex-ls#69. It should be fixed now.

@valentjn valentjn added the 3-fixed Issue resolution: Issue has been fixed on the develop branch label Jul 9, 2021
@valentjn
Copy link
Owner

Fix released in 10.5.0.

@t-huyeng
Copy link
Author

Thanks @valentjn for the fast fix, with version 10.5.0. it works for me.

me-johnomar added a commit to me-johnomar/ltex-ls that referenced this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-confirmed Issue status: Confirmed, reproducible bug in LTeX 3-fixed Issue resolution: Issue has been fixed on the develop branch
Projects
None yet
Development

No branches or pull requests

3 participants