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

Error when checking LaTeX documents ending with specific commands #341

Closed
JSchmiegel opened this issue Jul 3, 2021 · 2 comments
Closed
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

@JSchmiegel
Copy link

JSchmiegel commented Jul 3, 2021

Describe the bug
I am currently working on my bachelor thesis. Unfortunately I have the problem that one of my LaTeX documents is not checked by the Ltex plugin. After a bit of trial and error, I think I can reduce the problem to the command \cites{test}.
But strangely enough, this does not apply to all LaTeX documents in which I have the \cites{} command. But if I use an empty LaTeX document only with the content \cites{test}, then I get the error. Very strange!

Please give me feedback if anyone can reproduce this error.

Steps to reproduce

  1. Use a blank .tex file with \cites{test}
  2. Try to run the LTeX: Check Current Document Command

Expected behavior
Normal marking of spelling mistakes by LTeX.

LTeX configuration

{
    "ltex.additionalRules.motherTongue": "de-DE",
    "ltex.language": "de-DE",
    "ltex.sentenceCacheSize": 50000,
    "ltex.java.maximumHeapSize": 8192
}

"LTeX Language Server" log file

[Info  - 12:29:10 PM] Starting ltex-ls...
Jul 03, 2021 12:29:11 PM org.bsplines.ltexls.server.LtexLanguageServer initialize
INFO: ltex-ls 12.2.0 - initializing...
Jul 03, 2021 12:29:11 PM org.bsplines.ltexls.server.LtexLanguageServer initialize
INFO: Setting locale to 'en'
Jul 03, 2021 12:29:11 PM org.bsplines.ltexls.settings.SettingsManager logDifferentSettings
FINE: Reinitializing LanguageTool due to different settings for language 'de-DE': setting 'settings', old 'null', new 'non-null'
Jul 03, 2021 12:29:18 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.StringIndexOutOfBoundsException: String index out of range: 12
java.util.concurrent.CompletionException: java.lang.StringIndexOutOfBoundsException: String index out of range: 12
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 12
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
	at java.base/java.lang.String.charAt(String.java:711)
	at org.bsplines.ltexls.parsing.latex.LatexCommandSignature.matchArgumentFromPosition(LatexCommandSignature.java:135)
	at org.bsplines.ltexls.parsing.latex.LatexCommandSignature.matchFromPosition(LatexCommandSignature.java:219)
	at org.bsplines.ltexls.parsing.latex.LatexCommandSignature.matchFromPosition(LatexCommandSignature.java:204)
	at org.bsplines.ltexls.parsing.latex.LatexAnnotatedTextBuilder.processBackslash(LatexAnnotatedTextBuilder.java:600)
	at org.bsplines.ltexls.parsing.latex.LatexAnnotatedTextBuilder.addCode(LatexAnnotatedTextBuilder.java:309)
	at org.bsplines.ltexls.parsing.latex.LatexAnnotatedTextBuilder.addCode(LatexAnnotatedTextBuilder.java:30)
	at org.bsplines.ltexls.server.DocumentChecker.buildAnnotatedTextFragments(DocumentChecker.java:64)
	at org.bsplines.ltexls.server.DocumentChecker.check(DocumentChecker.java:215)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.check(LtexTextDocumentItem.java:466)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndGetDiagnostics(LtexTextDocumentItem.java:342)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.java:319)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.java:313)
	at org.bsplines.ltexls.server.LtexWorkspaceService.lambda$executeCheckDocumentCommand$2(LtexWorkspaceService.java:156)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
	... 7 more

"LTeX Language Client" log file

2021-07-03T10:29:09.875Z Info: Setting LTeX UI language to 'en-us'.
2021-07-03T10:29:09.876Z Info: Loading i18n messages...
2021-07-03T10:29:09.876Z Info: Loading default i18n messages...
2021-07-03T10:29:09.877Z Info: 
2021-07-03T10:29:09.877Z Info: ltex.ltex-ls.path not set.
2021-07-03T10:29:09.877Z Info: Searching for ltex-ls in '/home/jonas/.vscode/extensions/valentjn.vscode-ltex-10.4.0/lib'...
2021-07-03T10:29:09.878Z Info: ltex-ls found in '/home/jonas/.vscode/extensions/valentjn.vscode-ltex-10.4.0/lib/ltex-ls-12.2.0'.
2021-07-03T10:29:09.878Z Info: 
2021-07-03T10:29:09.878Z Info: ltex.java.path not set.
2021-07-03T10:29:09.878Z Info: Using ltex-ls from '/home/jonas/.vscode/extensions/valentjn.vscode-ltex-10.4.0/lib/ltex-ls-12.2.0'.
2021-07-03T10:29:09.878Z Info: Using Java from PATH or JAVA_HOME (may fail if not installed).
2021-07-03T10:29:09.888Z Info: Testing ltex-ls...
2021-07-03T10:29:09.888Z Info:   Command: "/home/jonas/.vscode/extensions/valentjn.vscode-ltex-10.4.0/lib/ltex-ls-12.2.0/bin/ltex-ls"
2021-07-03T10:29:09.888Z Info:   Arguments: ["--version"]
2021-07-03T10:29:09.888Z Info:   env['JAVA_HOME']: undefined
2021-07-03T10:29:09.888Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx8192m"
2021-07-03T10:29:10.141Z Info: Test successful!
2021-07-03T10:29:10.142Z Info: 
2021-07-03T10:29:10.144Z Info: Starting ltex-ls...
2021-07-03T10:29:10.144Z Info:   Command: "/home/jonas/.vscode/extensions/valentjn.vscode-ltex-10.4.0/lib/ltex-ls-12.2.0/bin/ltex-ls"
2021-07-03T10:29:10.144Z Info:   Arguments: []
2021-07-03T10:29:10.144Z Info:   env['JAVA_HOME']: undefined
2021-07-03T10:29:10.144Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx8192m"
2021-07-03T10:29:10.144Z Info: 

Version information

  • Operating system: Linux (Fedora/34 Kernel: 5.12.12-300-fc34-x86_)
  • VS Code: 1.57.1
  • vscode-ltex: v10.4.0
@JSchmiegel JSchmiegel 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 3, 2021
@valentjn valentjn changed the title Problem with \cites{test}?!? Error when checking LaTeX documents ending with specific commands Jul 4, 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 Jul 4, 2021
@valentjn valentjn self-assigned this Jul 4, 2021
@valentjn valentjn added this to the 10.4.1 milestone Jul 4, 2021
@valentjn valentjn added the 3-fixed Issue resolution: Issue has been fixed on the develop branch label Jul 4, 2021
@valentjn
Copy link
Owner

valentjn commented Jul 4, 2021

Thanks for the report. FWIW, the error occurred when the document ends with specific commands (like \cites{...}) without any final newline.

@valentjn
Copy link
Owner

Fix released in 10.5.0.

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

2 participants