neo-ltex / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
16 stars 1 forks source link

Ltex does not start! #79

Open Flo2410 opened 3 months ago

Flo2410 commented 3 months ago

Describe the bug The extension does not start. It always shows Starting LTeX... in the status bar of VS Code.

Steps to reproduce Just install the extension, set the ltex-ls and java paths and see that it does not work

Expected behavior I would expect the extension to start.

Sample document There is no file required for the bug to occur, but the extension only loads if it sees a latex file.

```latex \documentclass[12pt]{article} \begin{document} Test \end{document} ```

LTeX configuration

``` { "ltex.additionalRules.enablePickyRules": true, "ltex.additionalRules.motherTongue": "de-AT", "ltex.completionEnabled": true, "ltex.configurationTarget": { "dictionary": "workspaceFolder", "disabledRules": "workspaceFolder", "hiddenFalsePositives": "workspaceFolder" }, "ltex.disabledRules": { "de-AT": [ "WHITESPACE_RULE" ] }, "ltex.java.path": "/nix/store/0sdci48ka81y5y6ska71xgn70k1h3gki-temurin-bin-20.0.2", "ltex.language": "de-AT", "ltex.ltex-ls.logLevel": "finest", "ltex.ltex-ls.path": "/nix/store/cwk309izc25mqrb76wxn3ybwksk6pj0l-ltex-ls-16.0.0", "ltex.trace.server": "verbose", } ```
``` { "enabled": [ "bibtex", "context", "context.tex", "html", "latex", "markdown", "org", "restructuredtext", "rsweave" ], "language": "de-AT", "dictionary": {}, "disabledRules": { "de-AT": [ "WHITESPACE_RULE" ] }, "enabledRules": {}, "hiddenFalsePositives": {}, "bibtex": { "fields": {} }, "latex": { "commands": {}, "environments": {} }, "markdown": { "nodes": {} }, "configurationTarget": { "dictionary": "workspaceFolder", "disabledRules": "workspaceFolder", "hiddenFalsePositives": "workspaceFolder" }, "additionalRules": { "enablePickyRules": true, "motherTongue": "de-AT", "languageModel": "", "neuralNetworkModel": "", "word2VecModel": "" }, "languageToolHttpServerUri": "", "languageToolOrg": { "username": "", "apiKey": "" }, "ltex-ls": { "path": "/nix/store/cwk309izc25mqrb76wxn3ybwksk6pj0l-ltex-ls-16.0.0", "logLevel": "finest", "languageToolHttpServerUri": "", "languageToolOrgUsername": "", "languageToolOrgApiKey": "" }, "java": { "path": "/nix/store/0sdci48ka81y5y6ska71xgn70k1h3gki-temurin-bin-20.0.2", "initialHeapSize": 64, "maximumHeapSize": 512 }, "sentenceCacheSize": 2000, "completionEnabled": true, "diagnosticSeverity": "information", "checkFrequency": "edit", "clearDiagnosticsWhenClosingFile": true, "statusBarItem": false, "trace": { "server": "verbose" } } ```

"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:

``` [Info - 10:53:45 AM] Starting ltex-ls... SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Apr 14, 2024 10:53:49 AM org.bsplines.ltexls.server.LtexLanguageServer initialize INFO: ltex-ls 16.0.0 - initializing... Apr 14, 2024 10:53:49 AM org.bsplines.ltexls.tools.I18n setLocale INFO: Setting locale to 'en' ```

"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):

``` 2024-04-14T08:53:45.326Z Info: Setting LTeX UI language to 'en'. 2024-04-14T08:53:45.326Z Info: Loading i18n messages... 2024-04-14T08:53:45.326Z Info: Loading default i18n messages... 2024-04-14T08:53:45.328Z Info: 2024-04-14T08:53:45.328Z Info: ltex.ltex-ls.path set to '/nix/store/cwk309izc25mqrb76wxn3ybwksk6pj0l-ltex-ls-16.0.0'. 2024-04-14T08:53:45.328Z Info: 2024-04-14T08:53:45.328Z Info: Using ltex-ls from '/nix/store/cwk309izc25mqrb76wxn3ybwksk6pj0l-ltex-ls-16.0.0'. 2024-04-14T08:53:45.328Z Info: Using Java from '/nix/store/0sdci48ka81y5y6ska71xgn70k1h3gki-temurin-bin-20.0.2' (set in ltex.java.path). 2024-04-14T08:53:45.329Z Info: Testing ltex-ls... 2024-04-14T08:53:45.329Z Info: Command: "/nix/store/cwk309izc25mqrb76wxn3ybwksk6pj0l-ltex-ls-16.0.0/bin/ltex-ls" 2024-04-14T08:53:45.329Z Info: Arguments: ["--version"] 2024-04-14T08:53:45.329Z Info: env['JAVA_HOME']: "/nix/store/0sdci48ka81y5y6ska71xgn70k1h3gki-temurin-bin-20.0.2" 2024-04-14T08:53:45.329Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-04-14T08:53:45.542Z Info: Test successful! 2024-04-14T08:53:45.542Z Info: 2024-04-14T08:53:45.546Z Info: Starting ltex-ls... 2024-04-14T08:53:45.546Z Info: Command: "/nix/store/cwk309izc25mqrb76wxn3ybwksk6pj0l-ltex-ls-16.0.0/bin/ltex-ls" 2024-04-14T08:53:45.546Z Info: Arguments: [] 2024-04-14T08:53:45.546Z Info: env['JAVA_HOME']: "/nix/store/0sdci48ka81y5y6ska71xgn70k1h3gki-temurin-bin-20.0.2" 2024-04-14T08:53:45.546Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-04-14T08:53:45.546Z Info: [Trace - 10:53:45 AM] Sending request 'initialize - (0)'. Params: { "processId": 1133718, "clientInfo": { "name": "Visual Studio Code", "version": "1.88.0" }, "locale": "en", "rootPath": "/home/florian/syncthing/FHWN/AERO/2_Semester_SS24/JTP_Solar_Cells/report", "rootUri": "file:///home/florian/syncthing/FHWN/AERO/2_Semester_SS24/JTP_Solar_Cells/report", "capabilities": { "workspace": { "applyEdit": true, "workspaceEdit": { "documentChanges": true, "resourceOperations": [ "create", "rename", "delete" ], "failureHandling": "textOnlyTransactional", "normalizesLineEndings": true, "changeAnnotationSupport": { "groupsOnLabel": true } }, "didChangeConfiguration": { "dynamicRegistration": true }, "didChangeWatchedFiles": { "dynamicRegistration": true }, "symbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ] }, "tagSupport": { "valueSet": [ 1 ] } }, "codeLens": { "refreshSupport": true }, "executeCommand": { "dynamicRegistration": true }, "configuration": true, "workspaceFolders": true, "semanticTokens": { "refreshSupport": true }, "fileOperations": { "dynamicRegistration": true, "didCreate": true, "didRename": true, "didDelete": true, "willCreate": true, "willRename": true, "willDelete": true } }, "textDocument": { "publishDiagnostics": { "relatedInformation": true, "versionSupport": false, "tagSupport": { "valueSet": [ 1, 2 ] }, "codeDescriptionSupport": true, "dataSupport": true }, "synchronization": { "dynamicRegistration": true, "willSave": true, "willSaveWaitUntil": true, "didSave": true }, "completion": { "dynamicRegistration": true, "contextSupport": true, "completionItem": { "snippetSupport": true, "commitCharactersSupport": true, "documentationFormat": [ "markdown", "plaintext" ], "deprecatedSupport": true, "preselectSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "insertReplaceSupport": true, "resolveSupport": { "properties": [ "documentation", "detail", "additionalTextEdits" ] }, "insertTextModeSupport": { "valueSet": [ 1, 2 ] } }, "completionItemKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 ] } }, "hover": { "dynamicRegistration": true, "contentFormat": [ "markdown", "plaintext" ] }, "signatureHelp": { "dynamicRegistration": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ], "parameterInformation": { "labelOffsetSupport": true }, "activeParameterSupport": true }, "contextSupport": true }, "definition": { "dynamicRegistration": true, "linkSupport": true }, "references": { "dynamicRegistration": true }, "documentHighlight": { "dynamicRegistration": true }, "documentSymbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ] }, "hierarchicalDocumentSymbolSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "labelSupport": true }, "codeAction": { "dynamicRegistration": true, "isPreferredSupport": true, "disabledSupport": true, "dataSupport": true, "resolveSupport": { "properties": [ "edit" ] }, "codeActionLiteralSupport": { "codeActionKind": { "valueSet": [ "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" ] } }, "honorsChangeAnnotations": false }, "codeLens": { "dynamicRegistration": true }, "formatting": { "dynamicRegistration": true }, "rangeFormatting": { "dynamicRegistration": true }, "onTypeFormatting": { "dynamicRegistration": true }, "rename": { "dynamicRegistration": true, "prepareSupport": true, "prepareSupportDefaultBehavior": 1, "honorsChangeAnnotations": true }, "documentLink": { "dynamicRegistration": true, "tooltipSupport": true }, "typeDefinition": { "dynamicRegistration": true, "linkSupport": true }, "implementation": { "dynamicRegistration": true, "linkSupport": true }, "colorProvider": { "dynamicRegistration": true }, "foldingRange": { "dynamicRegistration": true, "rangeLimit": 5000, "lineFoldingOnly": true }, "declaration": { "dynamicRegistration": true, "linkSupport": true }, "selectionRange": { "dynamicRegistration": true }, "callHierarchy": { "dynamicRegistration": true }, "semanticTokens": { "dynamicRegistration": true, "tokenTypes": [ "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator" ], "tokenModifiers": [ "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" ], "formats": [ "relative" ], "requests": { "range": true, "full": { "delta": true } }, "multilineTokenSupport": false, "overlappingTokenSupport": false }, "linkedEditingRange": { "dynamicRegistration": true } }, "window": { "showMessage": { "messageActionItem": { "additionalPropertiesSupport": true } }, "showDocument": { "support": true }, "workDoneProgress": true }, "general": { "regularExpressions": { "engine": "ECMAScript", "version": "ES2020" }, "markdown": { "parser": "marked", "version": "1.1.0" } } }, "initializationOptions": { "locale": "en", "customCapabilities": { "workspaceSpecificConfiguration": true } }, "trace": "verbose", "workspaceFolders": [ { "uri": "file:///home/florian/syncthing/FHWN/AERO/2_Semester_SS24/JTP_Solar_Cells/report", "name": "report" } ] } 2024-04-14T08:53:52.496Z Info: Creating bug report... 2024-04-14T08:53:52.496Z Info: LTeX Status 2024-04-14T08:53:52.496Z Info: ---------------------------------------- 2024-04-14T08:53:52.496Z Info: Info about vscode-ltex: 2024-04-14T08:53:52.496Z Info: - Path to extension directory: /home/florian/.vscode/extensions/neo-ltex.ltex-13.1.1 2024-04-14T08:53:52.496Z Info: - Path to directory with LTeX user settings (global storage directory): /home/florian/.config/Code/User/globalStorage/neo-ltex.ltex 2024-04-14T08:53:52.496Z Info: - Path to directory with LTeX workspace settings (for the currently opened workspace): /home/florian/syncthing/FHWN/AERO/2_Semester_SS24/JTP_Solar_Cells/report/.vscode 2024-04-14T08:53:52.496Z Info: - Path to directory with LTeX workspace folder settings (for the workspace folder of the currently active text editor): /home/florian/syncthing/FHWN/AERO/2_Semester_SS24/JTP_Solar_Cells/report/.vscode 2024-04-14T08:53:52.496Z Info: - Version: 13.1.1 2024-04-14T08:53:52.496Z Info: Info about ltex-ls: 2024-04-14T08:53:52.496Z Info: - Version: 16.0.0 2024-04-14T08:53:52.496Z Info: - Process ID: n/a 2024-04-14T08:53:52.496Z Info: - Wall clock duration: n/a 2024-04-14T08:53:52.496Z Info: - CPU duration: n/a 2024-04-14T08:53:52.496Z Info: - CPU usage: n/a 2024-04-14T08:53:52.496Z Info: - Total allocated memory: n/a 2024-04-14T08:53:52.496Z Info: - Used memory: n/a 2024-04-14T08:53:52.496Z Info: - Is busy checking: n/a 2024-04-14T08:53:52.496Z Info: - Document URI being checked: n/a 2024-04-14T08:53:52.496Z Info: Currently watched external setting files: n/a 2024-04-14T08:53:52.496Z Info: ---------------------------------------- ```

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

Actual Java version I have installed:

openjdk 20.0.2 2023-07-18
OpenJDK Runtime Environment Temurin-20.0.2+9 (build 20.0.2+9)
OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (build 20.0.2+9, mixed mode, sharing)

Additional context/information I had to install ltex-ls manually from nixpkgs, as it does not get installed automatically by the extension. Furthermore, I don't understand why it says it is using Java 19, when I set the java path to a Java 20 version.

glanch commented 3 weeks ago

I experience the same issue on my NixOS installation.

I think this is a problem with the packaged ltex-ls in nixpkgs, since it works with the FHS build of VS Codium and the downloaded FHS-compliant binary that the extension downloads when the path of ltex-ls is not set.

Therefore, a temporary fix is to use FHS build of the VS Code flavor of your choice, e.g. codium-fhs and let the extension manage the ltex-ls binary. For this, unset the ltex-ls path, but keep the Java path. Afterwards, use the LTeX: Reset and Restart command in the FHS build VS Code flavor. Note that you must use a FHS build as the binary that the extensions automatically downloads links to libraries that are not located in well-known places on NixOS.

Flo2410 commented 3 weeks ago

Oh... I completely forgot to post the workaround I found for this...

I got it to work using the with the offline vsix and the normal (non-fhs) stable version of vscode. I install the ltex using the following code-snippet:

  ltex-vsxi = pkgs.vscode-utils.buildVscodeMarketplaceExtension rec {
    version = "13.1.1";
    mktplcRef = {
      inherit version;
      name = "ltex";
      publisher = "neo-ltex";
    };
    vsix = builtins.fetchurl {
      url = "https://github.com/neo-ltex/vscode-ltex/releases/download/${version}/ltex-${version}-offline-linux-x64.vsix";
      sha256 = "sha256:0wlcndwax4d68b29k2kmagv3vm01ill4dix9d8cljdnwfvzaapr8";
    };

    unpackPhase = ''
      unzip ${vsix}
    '';
  };

I don't know why it works without the FHS, but it does.

glanch commented 3 weeks ago

Thanks for this! Do you use the ltex-ls from nixpkgs or do you use the built-in, downloaded binary of the extension?

Flo2410 commented 3 weeks ago

I use the bundled ltex-ls binary from the offline vsix (First Alternative: Download the Offline Version of ltex). So, I do not set the ltex.ltex-ls.path, but do set the java option "ltex.java.path" = "${pkgs.temurin-bin-20}";