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

Empty JSON objects in LSP responses interpreted as null when lsp-use-plists is non-nil #4325

Open
3 tasks done
ProjectFrank opened this issue Feb 6, 2024 · 1 comment
Open
3 tasks done
Labels

Comments

@ProjectFrank
Copy link
Contributor

ProjectFrank commented Feb 6, 2024

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

Responses sent by a language server containing {} are interpreted as null. When interpreting the capabilities field of the initialize response, this causes lsp-mode to think that a capability is not supported when it actually is.

In my own use case, the language server is responding with the following:

{
  "capabilities": {
    "textDocumentSync": {
      "openClose": true,
      "change": 2
    },
    "completionProvider": {}
  },
  "serverInfo": {
    "name": "tabby-agent",
    "version": "1.3.3"
  }
}

lsp-mode interprets the value under the completionProvider field as null, which prevents lsp-mode from asking the language server for completion suggestions.

Steps to reproduce

  1. Follow these steps to use plists for deserialization.
  2. Use a language server that sends back a {} in its initialization response.
  3. Set lsp-log-io to t.
  4. Start the language server via lsp-mode.
  5. Use lsp-workspace-show-log to show the log.
  6. Inspect the initialize response and confirm that a null appears instead of {}.

Expected behavior

Rather than null appearing, the io log should show {}. This is the case when lsp-use-plists is nil.

Which Language Server did you use?

This happens when using tabby-agent. The language server's initialize response is:

{
  "capabilities": {
    "textDocumentSync": {
      "openClose": true,
      "change": 2
    },
    "completionProvider": {}
  },
  "serverInfo": {
    "name": "tabby-agent",
    "version": "1.3.3"
  }
}

OS

MacOS

Error callstack

No response

Anything else?

No response

Souheab added a commit to Souheab/dotfiles that referenced this issue Mar 9, 2024
@Souheab
Copy link

Souheab commented Mar 9, 2024

Can confirm that I am experiencing this issue as well on Arch Linux on emacs 29.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants