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

LSP not compatible with Kate #6000

Closed
3 tasks done
nishanthkarthik opened this issue Nov 7, 2024 · 4 comments
Closed
3 tasks done

LSP not compatible with Kate #6000

nishanthkarthik opened this issue Nov 7, 2024 · 4 comments
Labels
awaiting-author Waiting for PR author to address issues bug Something isn't working

Comments

@nishanthkarthik
Copy link

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

Lean4 LSP does not work with Kate's LSP plugin. I understand Lean does not officially support all text editors, but I expected using lean --server to work. Kate works with about 20 other LSP servers, so I assume something's odd here.

Watchdog error: Cannot read LSP request: Unexpected param '{"workspaceFolders":[],"rootUri":"file:///home/user","rootPath":"/home/user","processId":13066,"capabilities":{"workspace":{"workspaceFolders":true},"window":{"workDoneProgress":true,"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}}},"textDocument":{"synchronization":{"didSave":true},"semanticTokens":{"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":[],"requests":{"range":true,"full":{"delta":true}},"formats":["relative"]},"selectionRange":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":true},"inlayHint":{"dynamicRegistration":false},"hover":{"contentFormat":["markdown","plaintext"]},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true},"completion":{"completionItem":{"snippetSupport":true,"resolveSupport":{"properties":["additionalTextEdits","documentation"]}}},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","source"]}}}}}}' for method 'initialize'

Context

I am trying to use Lean LSP with new text editors

Steps to Reproduce

  1. Add a custom file type called Lean for *.lean
  2. Configure a LSP backend for Lean using the LSP plugin in Kate
    "lean": {
      "command": ["lean", "--server"],
      "highlightingModeRegex": "^Lean$"
    }
  1. Open a Lean file

Expected behavior: LSP server works and highlights code

Actual behavior: LSP server crashes

Versions

Lean (version 4.13.0, x86_64-unknown-linux-gnu, commit 6d22e0e, Release)

@nishanthkarthik nishanthkarthik added the bug Something isn't working label Nov 7, 2024
@nishanthkarthik
Copy link
Author

The LSP spec supports most of the parameters used in initialization. Does lean lsp not like a particular field in the payload?

@mhuisi
Copy link
Contributor

mhuisi commented Nov 7, 2024

Could you try this on v4.14.0-rc2 as well?

@Kha Kha added the awaiting-author Waiting for PR author to address issues label Nov 8, 2024
@nishanthkarthik
Copy link
Author

nishanthkarthik commented Nov 8, 2024

I think I see what's wrong. rootPath is not supported anymore, so I am not sure if the Lean LSP throws an error instead of silently discarding unknown keys. The following commit is almost HEAD on master.

structure InitializeParams where

/- Many of these params can be null instead of not present.
    For ease of implementation, we're liberal:
    missing params, wrong json types and null all map to none,
    even if LSP sometimes only allows some subset of these.
    In cases where LSP makes a meaningful distinction
    between different kinds of missing values, we'll
    follow accordingly. -/

I'll try the binary build from https://github.com/leanprover/lean4/releases/tag/v4.14.0-rc2 and post an update

@nishanthkarthik
Copy link
Author

4.14 rc2 works for me!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author Waiting for PR author to address issues bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants