valentjn / ltex-ls

LTeX Language Server: LSP language server for LanguageTool :mag::heavy_check_mark: with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
775 stars 35 forks source link

Using ltex-ls with kate #209

Open maximilian-heeg opened 1 year ago

maximilian-heeg commented 1 year ago

Hello,

First, thanks for creating this fantastic tool. I am trying to get ltex-ls working together with Kate. I installed the ltex-ls-bin package from AUR the language server is working. I was able to successfully use it with the helix editor.

Next, I was trying to configure kate to use ltex-ls for markdown documents. I added this to Configure -> LSP Client -> User Server Settings.

{
    "servers": {
        "ltex": {
            "command": ["/usr/share/ltex-ls/bin/ltex-ls"],
            "highlightingModeRegex": "^Markdown$"
        }
    }
}

When opening a markdown document, Kate asks if I want to start the LSP server (which I confirmed):

Do you want the LSP server to be started?

The full command line is:

/usr/share/ltex-ls/bin/ltex-ls

The choice can be altered via the config page of the plugin

Thereafter, I am unfortunately getting an error, and I am not sure where this is coming from:

[11:02:56  LSP Client Log] Started server ltex@/home/max: /usr/share/ltex-ls/bin/ltex-ls
[11:02:59  LSP Server Log] ltex@/home/max
    Dec 31, 2022 11:02:59 AM org.bsplines.ltexls.server.LtexLanguageServer initialize
    INFO: ltex-ls 15.2.0 - initializing...
    [11:02:59  LSP Server Info] Checking document [100%]
[11:02:59  LSP Server Log] ltex@/home/max
Dec 31, 2022 11:02:59 AM org.bsplines.ltexls.server.LtexTextDocumentService didOpen$lambda-1
WARNING: The following exception occurred:
java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: workspace/configuration
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
at org.bsplines.ltexls.server.LtexTextDocumentItem.check(LtexTextDocumentItem.kt:390)
at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndGetDiagnostics(LtexTextDocumentItem.kt:295)
at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnostics(LtexTextDocumentItem.kt:272)
at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache(LtexTextDocumentItem.kt:267)
at org.bsplines.ltexls.server.LtexTextDocumentItem.checkAndPublishDiagnosticsWithoutCache$default(LtexTextDocumentItem.kt:266)
at org.bsplines.ltexls.server.LtexTextDocumentService.didOpen$lambda-1(LtexTextDocumentService.kt:155)
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:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: workspace/configuration
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
... 6 more

Do you have any idea where this error is originating from and how to solve that? Thanks for your help. Max

PhamAlexT commented 1 year ago

Hello, Did you manage to find a solution?

Best,

dvaerum commented 1 year ago

I can also not get it to work 😭

Configure -> LSP Client -> User

{
    "servers": {
        "ltex": {
            "command": ["ltex-ls", "--log-file=/tmp/ltex-ls.log"],
            "url": "https://github.com/valentjn/ltex-ls/",
            "highlightingModeRegex": "^(Markdown)$"
        }
    }
}

Something is failing in the 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.
Content-Length: 3159

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "initialize",
    "params": {
        "capabilities": {
            "textDocument": {
                "codeAction": {
                    "codeActionLiteralSupport": {
                        "codeActionKind": {
                            "valueSet": [
                                "quickfix",
                                "refactor",
                                "source"
                            ]
                        }
                    }
                },
                "completion": {
                    "completionItem": {
                        "resolveSupport": {
                            "properties": [
                                "additionalTextEdits"
                            ]
                        },
                        "snippetSupport": true
                    }
                },
                "documentSymbol": {
                    "hierarchicalDocumentSymbolSupport": true
                },
                "hover": {
                    "contentFormat": [
                        "markdown",
                        "plaintext"
                    ]
                },
                "inlayHint": {
                    "dynamicRegistration": false
                },
                "publishDiagnostics": {
                    "relatedInformation": true
                },
                "selectionRange": {
                    "dynamicRegistration": false
                },
                "semanticTokens": {
                    "formats": [
                        "relative"
                    ],
                    "requests": {
                        "full": {
                            "delta": true
                        },
                        "range": true
                    },
                    "tokenModifiers": [
                    ],
                    "tokenTypes": [
                        "namespace",
                        "type",
                        "class",
                        "enum",
                        "interface",
                        "struct",
                        "typeParameter",
                        "parameter",
                        "variable",
                        "property",
                        "enumMember",
                        "event",
                        "function",
                        "method",
                        "macro",
                        "keyword",
                        "modifier",
                        "comment",
                        "string",
                        "number",
                        "regexp",
                        "operator"
                    ]
                },
                "synchronization": {
                    "didSave": true
                }
            },
            "window": {
                "workDoneProgress": true
            },
            "workspace": {
                "workspaceFolders": true
            }
        },
        "processId": 48117,
        "rootPath": "/home/dvv",
        "rootUri": "file:///home/dvv",
        "workspaceFolders": [
        ]
    }
}
Jun 13, 2023 1:16:19 PM org.bsplines.ltexls.server.LtexLanguageServer initialize
INFO: ltex-ls 16.0.0 - initializing...
Content-Length: 260

{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"textDocumentSync":1,"completionProvider":{},"codeActionProvider":{"codeActionKinds":["quickfix.ltex.acceptSuggestions"]},"executeCommandProvider":{"commands":["_ltex.checkDocument","_ltex.getServerStatus"]}}}}Content-Length: 77

{
    "jsonrpc": "2.0",
    "method": "initialized",
    "params": {
    }
}
Content-Length: 316

{
    "jsonrpc": "2.0",
    "method": "textDocument/didOpen",
    "params": {
        "textDocument": {
            "languageId": "ltex",
            "text": "Test is this workking? I would like to know\n\n",
            "uri": "file:///home/dvv/Notes/Linux/wireshark.md",
            "version": 0
        }
    }
}
Content-Length: 205

{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "textDocument/documentSymbol",
    "params": {
        "textDocument": {
            "uri": "file:///home/dvv/Notes/Linux/wireshark.md"
        }
    }
}
Jun 13, 2023 1:16:20 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
        at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
        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:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
        ... 12 more
Caused by: java.lang.UnsupportedOperationException
        at org.eclipse.lsp4j.services.TextDocumentService.documentSymbol(TextDocumentService.java:252)
        ... 17 more

Content-Length: 227

{"jsonrpc":"2.0","id":"1","method":"window/workDoneProgress/create","params":{"token":"{\"uri\":\"file:///home/dvv/Notes/Linux/wireshark.md\",\"operation\":\"checkDocument\",\"uuid\":\"317ad303-abfd-ab8b-7458-32a36d91b5f2\"}"}}Content-Length: 2049