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

Wrong underlining of words starting with markup #69

Closed
ed359 opened this issue Apr 26, 2021 · 7 comments
Closed

Wrong underlining of words starting with markup #69

ed359 opened this issue Apr 26, 2021 · 7 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

@ed359
Copy link
Contributor

ed359 commented Apr 26, 2021

Describe the bug
When spell checking a word with an accented character at the beginning, typed using a latex command, the initial accented letter is omitted in the rule reporting a misspelled word.

Steps to reproduce
Type the word \v{s}ekki (which is šekki) into a latex document, with spell checking for English enabled and observe that "ekki" gets underlined, but not the entire word.

Expected behavior
Since šekki is not an English word it should be underlined, including the first character

Sample document
If the bug occurs for a specific document (e.g. LaTeX), please paste it here. If your document is very long or confidential, please create and attach a smaller example for which the bug still occurs so that we can reproduce it.

\documentclass{minimal}
\usepackage[T1]{fontenc}

\begin{document}
Šekki Štefancovi\v{c}.
Štefancovi\v{c} šekki.

\v{S}ekki \v{S}tefancovi\v{c}.
\v{S}tefancovi\v{c} \v{s}ekki.
\end{document}

LTeX configuration
Please paste all configuration settings starting with ltex. from your settings.json. You can help us by temporarily removing some irrelevant settings from your settings.json and see if the bug still occurs.
N/A

LTeX LS log
Paste the log (output) of LTeX LS here:

FINE: Checking the following text in language 'en-US' via LanguageTool: " \n\n\u0160ekki \u0160tefancovi\u010D. \u0160tefancovi\u010D \u0161ekki.\n\n\u0160ekki \u0160tefancovi\u010D. \u0160tefancovi\u010D \u0161ekki. "

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

  • Operating system: Windows 10
  • ltex-ls: 12.1.0-alpha1 (built from source)
  • Java: openJDK 11 LTS

Additional context/information

The log appears to show the correct strings are being sent to the server: \u0160 is Š and \u0161 is š. So something is probably going wrong outside of the (new) latex accent command parsing.

@ed359 ed359 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 Apr 26, 2021
@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 Apr 26, 2021
@valentjn
Copy link
Owner

valentjn commented Apr 26, 2021

There is a bug in the computation of the length of the underlining (which also determines the word X in the message 'X': Possible spelling mistake found.). The checking itself is not affected (i.e., if you use a word LanguageTool knows, there won't be a diagnostic). The Use '...' quick fixes display the correct suggestions; however, the wrong word will be replaced when applying them. The Add 'X' to dictionary quick fix will add the wrong word (without the first letter) to the dictionary, but as the dictionary is compared against the underlined words, this will still result in the diagnostic to be resolved. The other quick fixes are working as intended.

@valentjn valentjn changed the title Words beginning with accented character are not handled correctly Wrong underlining of words starting with markup Apr 26, 2021
@ed359
Copy link
Contributor Author

ed359 commented Apr 26, 2021

Ok, it's good to know that the underlying spell checking is correct, but the user interface reporting 'X': Possible spelling mistake found. is where the error is. Thank you.

@valentjn valentjn self-assigned this Apr 27, 2021
@valentjn valentjn added this to the 12.1.0 milestone Apr 27, 2021
@valentjn
Copy link
Owner

Thanks for the report, this should be fixed.

@valentjn valentjn added the 3-fixed Issue resolution: Issue has been fixed on the develop branch label Apr 27, 2021
@ed359
Copy link
Contributor Author

ed359 commented Apr 27, 2021

The new tests in 6317adc do not pass for me:

[ERROR] Failures: 
[ERROR]   LatexAnnotatedTextBuilderTest.testMathMode:347 30 not smaller than 30 ==> expected: <true> but was: <false>
[ERROR]   LatexAnnotatedTextBuilderTest.testTextMode:207 expected: <0> but was: <5>
[ERROR]   DocumentCheckerTest.testLatex:182 expected: <?ekki> but was: <ekki>

@valentjn
Copy link
Owner

valentjn commented Apr 27, 2021

They pass in GitHub Actions (and for me), so it's definitely working.

Best guess is that you forgot to update your local installation of ltexls-languagetool-patch (see second task in .vscode/tasks.json).

@ed359
Copy link
Contributor Author

ed359 commented Apr 28, 2021

I wasn't using the tasks in tasks.json, so indeed that was the problem. Thank you for helping me run the tests. I'm on Windows and the build task fails with an error similar to the one described here: https://stackoverflow.com/questions/6347985/cannot-run-maven-using-mvn-d-argument-within-microsoft-powershell-but-works.

The issue is that powershell needs some quoting in the command string, namely '-Dmaven.test.skip=true' instead of -Dmaven.test.skip=true. If this change doesn't affect other OSes then it's probably a good idea in tasks.json.

valentjn added a commit that referenced this issue Apr 28, 2021
For Windows PowerShell, see #69.
@valentjn
Copy link
Owner

valentjn commented May 1, 2021

Fix released in 12.1.0.

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

2 participants