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

Single character prepended to a math expression ($...$) make LTeX failing to check a document #442

Closed
laclouis5 opened this issue Oct 25, 2021 · 6 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

@laclouis5
Copy link

laclouis5 commented Oct 25, 2021

Describe the bug
A single character prefixing a math expression ($...$) makes LTeX to crash under certain circonstances. I narrowed the bug down to an expression such as:

some sentence 5$\times$5

In those cases LTeX stops working. The bug is not present if there is no command used inside the math expression (I did not tested all combinations):

some sentence 5$a$5

Also, the bug is not present if the prepended item has length > 1:

some sentence 55$\times$5

It works with numbers and also characters. A simple workaround is to put a space after:

some sentence 5 $\times$5

Expected behavior
No LTeX crash.

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.

{
  "enabled": [
    "bibtex",
    "html",
    "latex",
    "markdown",
    "org",
    "restructuredtext",
    "rsweave"
  ],
  "language": "fr",
  "dictionary": {},
  "disabledRules": {},
  "enabledRules": {},
  "hiddenFalsePositives": {},
  "bibtex": {
    "fields": {
      "title": false,
      "journal": false,
      "abstract": false,
      "shorttitle": false,
      "booktitle": false,
      "language": false,
      "eprinttype": false,
      "primaryclass": false,
      "address": false,
      "type": false,
      "institution": false,
      "annotation": false,
      "copyright": false,
      "series": false,
      "ids": false
    }
  },
  "latex": {
    "commands": {},
    "environments": {}
  },
  "markdown": {
    "nodes": {}
  },
  "configurationTarget": {
    "dictionary": "workspaceFolderExternalFile",
    "disabledRules": "workspaceFolderExternalFile",
    "hiddenFalsePositives": "workspaceFolderExternalFile"
  },
  "additionalRules": {
    "enablePickyRules": false,
    "motherTongue": "fr",
    "languageModel": "",
    "neuralNetworkModel": "",
    "word2VecModel": ""
  },
  "languageToolHttpServerUri": "",
  "languageToolOrg": {
    "username": "",
    "apiKey": ""
  },
  "ltex-ls": {
    "path": "",
    "logLevel": "fine",
    "languageToolHttpServerUri": "",
    "languageToolOrgUsername": "",
    "languageToolOrgApiKey": ""
  },
  "java": {
    "path": "",
    "initialHeapSize": 64,
    "maximumHeapSize": 512
  },
  "sentenceCacheSize": 2000,
  "diagnosticSeverity": "information",
  "checkFrequency": "edit",
  "clearDiagnosticsWhenClosingFile": true,
  "statusBarItem": false,
  "trace": {
    "server": "off"
  }
}

"LTeX Language Server" log file
First, reproduce the bug. Then, go to ViewOutput and select LTeX Language Server in the drop-down list. Paste this log here:

[... truncated]
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:260)
	at org.bsplines.ltexls.server.LtexTextDocumentService.didChange$lambda-3(LtexTextDocumentService.kt:219)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0 et Jimmy-1 sont des multiples de 32, donc leurs ratios respectifs avec Jimmy-2 sont des vale"... (truncated to 100 characters)
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.LtexTextDocumentItem raiseExceptionIfCanceled
FINE: Canceling check due to incoming check request...
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0 et Jimmy-1 sont des multiples de 32, donc leurs ratios respectifs avec Jimmy-2 sont des vale"... (truncated to 100 characters)
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0"
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "\n\n\n\n\n\nCette seconde approche vise \u00E0 mod\u00E9liser plus formellement la d\u00E9finition de la structure d'obje"... (truncated to 100 characters)
Oct 25, 2021 12:06:50 PM org.bsplines.ltexls.server.LtexTextDocumentItem raiseExceptionIfCanceled
FINE: Canceling check due to incoming check request...
Oct 25, 2021 12:06:51 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0 et Jimmy-1 sont des multiples de 32, donc leurs ratios respectifs avec Jimmy-2 sont des vale"... (truncated to 100 characters)
Oct 25, 2021 12:06:51 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:51 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0"
Oct 25, 2021 12:06:51 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:51 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "\n\n\n\n\n\nCette seconde approche vise \u00E0 mod\u00E9liser plus formellement la d\u00E9finition de la structure d'obje"... (truncated to 100 characters)
Oct 25, 2021 12:06:52 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 57 rule matches
Oct 25, 2021 12:06:52 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 38
Oct 25, 2021 12:06:53 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0 et Jimmy-1 sont des multiples de 32, donc leurs ratios respectifs avec Jimmy-2 sont des vale"... (truncated to 100 characters)
Oct 25, 2021 12:06:53 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:53 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0"
Oct 25, 2021 12:06:53 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:53 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "\n\n\n\n\n\nCette seconde approche vise \u00E0 mod\u00E9liser plus formellement la d\u00E9finition de la structure d'obje"... (truncated to 100 characters)
Oct 25, 2021 12:06:53 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 56 rule matches
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0 et Jimmy-1 sont des multiples de 32, donc leurs ratios respectifs avec Jimmy-2 sont des vale"... (truncated to 100 characters)
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0"
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "\n\n\n\n\n\nCette seconde approche vise \u00E0 mod\u00E9liser plus formellement la d\u00E9finition de la structure d'obje"... (truncated to 100 characters)
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.LtexTextDocumentItem raiseExceptionIfCanceled
FINE: Canceling check due to incoming check request...
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0 et Jimmy-1 sont des multiples de 32, donc leurs ratios respectifs avec Jimmy-2 sont des vale"... (truncated to 100 characters)
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Jimmy-0"
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 0 rule matches
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "\n\n\n\n\n\nCette seconde approche vise \u00E0 mod\u00E9liser plus formellement la d\u00E9finition de la structure d'obje"... (truncated to 100 characters)
Oct 25, 2021 12:06:55 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
SEVERE: LanguageTool failed. The following exception occurred:
java.lang.StringIndexOutOfBoundsException: begin 16985, end 16984, length 19842
	at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
	at java.base/java.lang.String.substring(Unknown Source)
	at org.bsplines.ltexls.parsing.AnnotatedTextFragment.getSubstringOfPlainText(AnnotatedTextFragment.kt:34)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:94)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:44)
	at org.bsplines.ltexls.languagetool.LanguageToolJavaInterface.checkInternal(LanguageToolJavaInterface.kt:127)
	at org.bsplines.ltexls.languagetool.LanguageToolInterface.check(LanguageToolInterface.kt:22)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragment(DocumentChecker.kt:128)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragments(DocumentChecker.kt:81)
	at org.bsplines.ltexls.server.DocumentChecker.check(DocumentChecker.kt:241)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.check(LtexTextDocumentItem.kt:404)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndGetDiagnostics(LtexTextDocumentItem.kt:289)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.kt:266)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.kt:261)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:260)
	at org.bsplines.ltexls.server.LtexTextDocumentService.didChange$lambda-3(LtexTextDocumentService.kt:219)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)


"LTeX Language Client" log file
First, set the ltex.trace.server setting in your settings.json to "verbose". Then, reload the VS Code window and reproduce the bug. Go to ViewOutput and select LTeX Language Client in the drop-down list. Paste this log here (note: it will contain your checked document):

2021-10-25T10:04:44.511Z Info: Setting LTeX UI language to 'en-us'.
2021-10-25T10:04:44.511Z Info: Loading i18n messages...
2021-10-25T10:04:44.538Z Info: Loading default i18n messages...
2021-10-25T10:04:44.540Z Info: 
2021-10-25T10:04:44.540Z Info: ltex.ltex-ls.path not set.
2021-10-25T10:04:44.540Z Info: Searching for ltex-ls in '/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib'...
2021-10-25T10:04:44.542Z Info: ltex-ls found in '/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0'.
2021-10-25T10:04:44.542Z Info: 
2021-10-25T10:04:44.542Z Info: Using ltex-ls from '/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0'.
2021-10-25T10:04:44.542Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2021-10-25T10:04:44.567Z Info: Testing ltex-ls...
2021-10-25T10:04:44.567Z Info:   Command: "/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0/bin/ltex-ls"
2021-10-25T10:04:44.567Z Info:   Arguments: ["--version"]
2021-10-25T10:04:44.567Z Info:   env['JAVA_HOME']: undefined
2021-10-25T10:04:44.567Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2021-10-25T10:04:51.798Z Info: Test successful!
2021-10-25T10:04:51.803Z Info: 
2021-10-25T10:04:51.813Z Info: Starting ltex-ls...
2021-10-25T10:04:51.813Z Info:   Command: "/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0/bin/ltex-ls"
2021-10-25T10:04:51.813Z Info:   Arguments: []
2021-10-25T10:04:51.813Z Info:   env['JAVA_HOME']: undefined
2021-10-25T10:04:51.813Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2021-10-25T10:04:51.813Z Info: 
2021-10-25T10:05:09.547Z Info: Started watching external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:05:09.565Z Info: Started watching external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.disabledRules.fr.txt'.
2021-10-25T10:05:09.681Z Info: Started watching external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.hiddenFalsePositives.fr.txt'.
2021-10-25T10:07:08.165Z Info: Creating bug report...

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

  • Operating system: Darwin (darwin), x64, 20.6.0
  • VS Code: 1.61.2
  • vscode-ltex: 12.2.0
  • ltex-ls: 14.1.0
  • Java: 11.0.12

Additional context/information
You can add any other context or information about the problem here.

@laclouis5 laclouis5 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 Oct 25, 2021
@valentjn
Copy link
Owner

  • Are you using LATEX or Markdown? Your examples would be valid for both.
  • I can't reproduce this when pasting some sentence 5$\times$5 in a new document and changing the language mode to latex or markdown (via Change Language Mode). Your server log shows that a different document was used to trigger the bug than the example you provided. Can you please reproduce the bug with a short example sentence and paste the actual corresponding log?

@valentjn valentjn added the 2-needs-info Issue status: We need more information (usually) from the submitter before continuing label Oct 25, 2021
@laclouis5
Copy link
Author

laclouis5 commented Oct 25, 2021

I'm using LATEX.

Note that I'm using the French language (FR).

Here is a document that reproduces the error. Removing one item (either the equation, a sentence, the references, etc.) makes the bug to disappear.

I manually added grammar errors that should be caught by LTEX.

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.

\subsubsection{Fonction de coût}
\begin{equation}
    L = \frac{\lambda_y}{N_y} \left\|Y - \mathrm{sig}(\hat{Y}) \right\|^2 + \frac{\lambda_o}{N_p} \sum_{\tilde{p}}{\left| O_{\tilde{p}} - \hat{O}_{\tilde{p}} \right|} + \frac{\lambda_e}{N_e} \sum_{\tilde{e}}{\left| E_{\tilde{e}} - \hat{E}_{\tilde{e}} \right|}
\end{equation}

\subsubsection{Un titres}
\label{sec:une-section}
Le post-traitement des données (parfois appelé décodage) désigne l'algorithme qui étant donné des tenseurs de sortie du réseau $\hat{Y}$, $\hat{O}$ et $\hat{E}$ produit un ensemble $\mathcal{S}$ de graphes étoilés représentant la structure des objets présents dans l'image d'entrée. Ce post-traitement est réalisé en deux étapes : (i) les ancres $\mathcal{A}$ et parties d'objet $\mathcal{P}$ sont prédites et (ii) les ancres et les parties sont associées pour former les structures d'objets.

Dans un premier temps la carte de chaleur $\mathrm{sig}(\hat{Y})$ est filtrée afin d'extraire la position et le type des ancre et parties d'objets. Cette carte de chaleure a une valleur proche de 1 aux localisations où le réseau prédit une forte probabilité de présence de point d'intérêt et une valeur de 0 aux endroits où la probabilitée est faible. Une représentation de la carte de chaleur pour les ancres est donnée en figures \ref{fig:sdnet-decoder}b et en \ref{fig:sdnet-decoder}c pour les parties d'objets. Ce filtrage consist en l'application d'une opérassion de max-pooling de taille de fenêtre 5$\times$5 permettant de supprimer les maximums local éventuels de la carte de chaleur (NMS) afin d'extraire uniquement les pics principaux.

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.

{
  "enabled": [
    "bibtex",
    "html",
    "latex",
    "markdown",
    "org",
    "restructuredtext",
    "rsweave"
  ],
  "language": "fr",
  "dictionary": {},
  "disabledRules": {},
  "enabledRules": {},
  "hiddenFalsePositives": {},
  "bibtex": {
    "fields": {
      "title": false,
      "journal": false,
      "abstract": false,
      "shorttitle": false,
      "booktitle": false,
      "language": false,
      "eprinttype": false,
      "primaryclass": false,
      "address": false,
      "type": false,
      "institution": false,
      "annotation": false,
      "copyright": false,
      "series": false,
      "ids": false
    }
  },
  "latex": {
    "commands": {},
    "environments": {}
  },
  "markdown": {
    "nodes": {}
  },
  "configurationTarget": {
    "dictionary": "workspaceFolderExternalFile",
    "disabledRules": "workspaceFolderExternalFile",
    "hiddenFalsePositives": "workspaceFolderExternalFile"
  },
  "additionalRules": {
    "enablePickyRules": false,
    "motherTongue": "fr",
    "languageModel": "",
    "neuralNetworkModel": "",
    "word2VecModel": ""
  },
  "languageToolHttpServerUri": "",
  "languageToolOrg": {
    "username": "",
    "apiKey": ""
  },
  "ltex-ls": {
    "path": "",
    "logLevel": "fine",
    "languageToolHttpServerUri": "",
    "languageToolOrgUsername": "",
    "languageToolOrgApiKey": ""
  },
  "java": {
    "path": "",
    "initialHeapSize": 64,
    "maximumHeapSize": 512
  },
  "sentenceCacheSize": 2000,
  "diagnosticSeverity": "information",
  "checkFrequency": "edit",
  "clearDiagnosticsWhenClosingFile": true,
  "statusBarItem": false,
  "trace": {
    "server": "off"
  }
}

"LTeX Language Server" log file
First, reproduce the bug. Then, go to ViewOutput and select LTeX Language Server in the drop-down list. Paste this log here:

[... truncated]
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.kt:266)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.kt:261)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:260)
	at org.bsplines.ltexls.server.LtexTextDocumentService.didChange$lambda-3(LtexTextDocumentService.kt:219)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Oct 25, 2021 1:56:45 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Fonction de co\u00FBt. Jimmy-0 \n\nUn titres. Le post-traitement des donn\u00E9es (parfois appel\u00E9 d\u00E9codage) d\u00E9si"... (truncated to 100 characters)
Oct 25, 2021 1:56:45 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
SEVERE: LanguageTool failed. The following exception occurred:
java.lang.StringIndexOutOfBoundsException: begin 1067, end 1066, length 1207
	at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
	at java.base/java.lang.String.substring(Unknown Source)
	at org.bsplines.ltexls.parsing.AnnotatedTextFragment.getSubstringOfPlainText(AnnotatedTextFragment.kt:34)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:94)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:44)
	at org.bsplines.ltexls.languagetool.LanguageToolJavaInterface.checkInternal(LanguageToolJavaInterface.kt:127)
	at org.bsplines.ltexls.languagetool.LanguageToolInterface.check(LanguageToolInterface.kt:22)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragment(DocumentChecker.kt:128)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragments(DocumentChecker.kt:81)
	at org.bsplines.ltexls.server.DocumentChecker.check(DocumentChecker.kt:241)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.check(LtexTextDocumentItem.kt:404)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndGetDiagnostics(LtexTextDocumentItem.kt:289)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.kt:266)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.kt:261)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:260)
	at org.bsplines.ltexls.server.LtexTextDocumentService.didChange$lambda-3(LtexTextDocumentService.kt:219)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Oct 25, 2021 1:56:46 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Fonction de co\u00FBt. Jimmy-0 \n\nUn titres. Le post-traitement des donn\u00E9es (parfois appel\u00E9 d\u00E9codage) d\u00E9si"... (truncated to 100 characters)
Oct 25, 2021 1:56:46 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
SEVERE: LanguageTool failed. The following exception occurred:
java.lang.StringIndexOutOfBoundsException: begin 1066, end 1065, length 1206
	at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
	at java.base/java.lang.String.substring(Unknown Source)
	at org.bsplines.ltexls.parsing.AnnotatedTextFragment.getSubstringOfPlainText(AnnotatedTextFragment.kt:34)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:94)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:44)
	at org.bsplines.ltexls.languagetool.LanguageToolJavaInterface.checkInternal(LanguageToolJavaInterface.kt:127)
	at org.bsplines.ltexls.languagetool.LanguageToolInterface.check(LanguageToolInterface.kt:22)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragment(DocumentChecker.kt:128)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragments(DocumentChecker.kt:81)
	at org.bsplines.ltexls.server.DocumentChecker.check(DocumentChecker.kt:241)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.check(LtexTextDocumentItem.kt:404)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndGetDiagnostics(LtexTextDocumentItem.kt:289)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.kt:266)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.kt:261)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:260)
	at org.bsplines.ltexls.server.LtexTextDocumentService.didChange$lambda-3(LtexTextDocumentService.kt:219)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Oct 25, 2021 1:56:48 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Fonction de co\u00FBt. Jimmy-0 \n\nUn titres. Le post-traitement des donn\u00E9es (parfois appel\u00E9 d\u00E9codage) d\u00E9si"... (truncated to 100 characters)
Oct 25, 2021 1:56:48 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
FINE: Obtained 8 rule matches
Oct 25, 2021 1:56:49 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked
FINE: Checking the following text in language 'fr' via LanguageTool: "Fonction de co\u00FBt. Jimmy-0 \n\nUn titres. Le post-traitement des donn\u00E9es (parfois appel\u00E9 d\u00E9codage) d\u00E9si"... (truncated to 100 characters)
Oct 25, 2021 1:56:49 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment
SEVERE: LanguageTool failed. The following exception occurred:
java.lang.StringIndexOutOfBoundsException: begin 1066, end 1065, length 1206
	at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
	at java.base/java.lang.String.substring(Unknown Source)
	at org.bsplines.ltexls.parsing.AnnotatedTextFragment.getSubstringOfPlainText(AnnotatedTextFragment.kt:34)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:94)
	at org.bsplines.ltexls.languagetool.LanguageToolRuleMatch$Companion.fromLanguageTool(LanguageToolRuleMatch.kt:44)
	at org.bsplines.ltexls.languagetool.LanguageToolJavaInterface.checkInternal(LanguageToolJavaInterface.kt:127)
	at org.bsplines.ltexls.languagetool.LanguageToolInterface.check(LanguageToolInterface.kt:22)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragment(DocumentChecker.kt:128)
	at org.bsplines.ltexls.server.DocumentChecker.checkAnnotatedTextFragments(DocumentChecker.kt:81)
	at org.bsplines.ltexls.server.DocumentChecker.check(DocumentChecker.kt:241)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.check(LtexTextDocumentItem.kt:404)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndGetDiagnostics(LtexTextDocumentItem.kt:289)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.kt:266)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.kt:261)
	at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:260)
	at org.bsplines.ltexls.server.LtexTextDocumentService.didChange$lambda-3(LtexTextDocumentService.kt:219)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)


"LTeX Language Client" log file
First, set the ltex.trace.server setting in your settings.json to "verbose". Then, reload the VS Code window and reproduce the bug. Go to ViewOutput and select LTeX Language Client in the drop-down list. Paste this log here (note: it will contain your checked document):

2021-10-25T10:04:44.511Z Info: Setting LTeX UI language to 'en-us'.
2021-10-25T10:04:44.511Z Info: Loading i18n messages...
2021-10-25T10:04:44.538Z Info: Loading default i18n messages...
2021-10-25T10:04:44.540Z Info: 
2021-10-25T10:04:44.540Z Info: ltex.ltex-ls.path not set.
2021-10-25T10:04:44.540Z Info: Searching for ltex-ls in '/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib'...
2021-10-25T10:04:44.542Z Info: ltex-ls found in '/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0'.
2021-10-25T10:04:44.542Z Info: 
2021-10-25T10:04:44.542Z Info: Using ltex-ls from '/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0'.
2021-10-25T10:04:44.542Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2021-10-25T10:04:44.567Z Info: Testing ltex-ls...
2021-10-25T10:04:44.567Z Info:   Command: "/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0/bin/ltex-ls"
2021-10-25T10:04:44.567Z Info:   Arguments: ["--version"]
2021-10-25T10:04:44.567Z Info:   env['JAVA_HOME']: undefined
2021-10-25T10:04:44.567Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2021-10-25T10:04:51.798Z Info: Test successful!
2021-10-25T10:04:51.803Z Info: 
2021-10-25T10:04:51.813Z Info: Starting ltex-ls...
2021-10-25T10:04:51.813Z Info:   Command: "/Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0/lib/ltex-ls-14.1.0/bin/ltex-ls"
2021-10-25T10:04:51.813Z Info:   Arguments: []
2021-10-25T10:04:51.813Z Info:   env['JAVA_HOME']: undefined
2021-10-25T10:04:51.813Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2021-10-25T10:04:51.813Z Info: 
2021-10-25T10:05:09.547Z Info: Started watching external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:05:09.565Z Info: Started watching external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.disabledRules.fr.txt'.
2021-10-25T10:05:09.681Z Info: Started watching external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.hiddenFalsePositives.fr.txt'.
2021-10-25T10:07:08.165Z Info: Creating bug report...
2021-10-25T10:07:08.232Z Info: LTeX Status
2021-10-25T10:07:08.232Z Info: ----------------------------------------
2021-10-25T10:07:08.232Z Info: Info about vscode-ltex:
2021-10-25T10:07:08.232Z Info: - Path to extension directory: /Users/louislac/.vscode/extensions/valentjn.vscode-ltex-12.2.0
2021-10-25T10:07:08.232Z Info: - Path to directory with LTeX user settings (global storage directory): /Users/louislac/Library/Application Support/Code/User/globalStorage/valentjn.vscode-ltex
2021-10-25T10:07:08.232Z Info: - Path to directory with LTeX workspace settings (for the currently opened workspace): /Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode
2021-10-25T10:07:08.232Z Info: - Path to directory with LTeX workspace folder settings (for the workspace folder of the currently active text editor): /Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode
2021-10-25T10:07:08.232Z Info: - Version: 12.2.0
2021-10-25T10:07:08.232Z Info: Info about ltex-ls:
2021-10-25T10:07:08.232Z Info: - Version: 14.1.0
2021-10-25T10:07:08.232Z Info: - Process ID: 12734
2021-10-25T10:07:08.232Z Info: - Wall clock duration: 2m00s.453
2021-10-25T10:07:08.232Z Info: - CPU duration: 1m19s.718
2021-10-25T10:07:08.232Z Info: - CPU usage: 0.0%
2021-10-25T10:07:08.232Z Info: - Total allocated memory: 251.66MB
2021-10-25T10:07:08.232Z Info: - Used memory: 160.16MB
2021-10-25T10:07:08.232Z Info: - Is busy checking: false
2021-10-25T10:07:08.232Z Info: - Document URI being checked: n/a
2021-10-25T10:07:08.232Z Info: Currently watched external setting files:
2021-10-25T10:07:08.232Z Info: - /Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt
2021-10-25T10:07:08.232Z Info: - /Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.disabledRules.fr.txt
2021-10-25T10:07:08.232Z Info: - /Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.hiddenFalsePositives.fr.txt
2021-10-25T10:07:08.233Z Info: ----------------------------------------
2021-10-25T10:25:56.068Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:25:56.071Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:03.970Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:03.973Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:07.071Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:07.078Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:12.026Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:12.030Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:14.298Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:14.305Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:16.890Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:16.897Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:29.105Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:29.107Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:49.557Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:49.560Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T10:27:52.703Z Info: Appended new entries to external setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt'.
2021-10-25T10:27:52.705Z Info: External setting file '/Users/louislac/Documents/Etudes/PhD/Projet BIPBIP/Manuscrit/Manuscrit/.vscode/ltex.dictionary.fr.txt' changed, re-reading.
2021-10-25T11:59:33.725Z Info: Creating bug report...

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

  • Operating system: Darwin (darwin), x64, 20.6.0
  • VS Code: 1.61.2
  • vscode-ltex: 12.2.0
  • ltex-ls: 14.1.0
  • Java: 11.0.12

@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) 2-needs-info Issue status: We need more information (usually) from the submitter before continuing labels Oct 25, 2021
@valentjn
Copy link
Owner

Minimum example:

\begin{equation}
  X
\end{equation}
$a$ $b$ $c$ $d$ $e$ $f$ $g$ \ref{foo} \ref{bar} 5$\times$5

@valentjn valentjn self-assigned this Oct 28, 2021
@valentjn valentjn added this to the 13.0.0 milestone Oct 28, 2021
@valentjn
Copy link
Owner

valentjn commented Oct 28, 2021

Should be fixed now.

Edit: Fix released in 13.0.0.

@valentjn valentjn added the 3-fixed Issue resolution: Issue has been fixed on the develop branch label Oct 28, 2021
@rschinkoeth
Copy link

it's not. got the same w latest versions.

@valentjn
Copy link
Owner

@rschinkoeth Please open a new full bug report. I always test via unit tests and manual E2E tests that all reported issues are indeed solved, so your issue is probably unrelated to this one.

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
Archived in project
Development

No branches or pull requests

3 participants