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 config (settings) interface #24054

Open
justinmk opened this issue Jun 17, 2023 · 4 comments
Open

LSP config (settings) interface #24054

justinmk opened this issue Jun 17, 2023 · 4 comments
Milestone

Comments

@justinmk
Copy link
Member

justinmk commented Jun 17, 2023

Problem

Discussion in #23984 (comment) and other LSP work indicates we need a full story for configuring LSP clients...

  1. globally ("default")
    • per-filetype
  2. dynamically (on-demand)
    • for all clients attached to current buffer
    • for specific client?
  3. per-buffer (this is low-priority, avoid much complexity to support this)

#22598 (comment)

Expected behavior

  • vim.lsp.config : feat(lsp): add vim.lsp.config #18506
    • potential blockers:
      • should we adopt workspaceFolder instead of "root markers"
      • "multi-server" conflicts with per-server configs.
        • how far can we get with the "obvious" approach of per-server config?

Rejected ideas

  • Flags in vim.lsp.start(), e.g. start({ ..., formatting = false, semantic_tokens = false, inlay_hints = true, ... })
  • vim.lsp.start({capabilities={...}})
@justinmk justinmk added enhancement feature request lsp labels Jun 17, 2023
@justinmk justinmk added this to the 0.10 milestone Jun 17, 2023
@T-727
Copy link
Contributor

T-727 commented Jun 18, 2023

This is probably too big of a rework and/or doesn't work as well as it does in my head, but it's interesting to think about imo so I'll throw it out here:
What if instead of using lua wrappers you used the vim option + variable systems 🤔

@glepnir
Copy link
Member

glepnir commented Jun 18, 2023

should we adopt workspaceFolder instead of "root markers"

also need consider file is library file. in this case usually need attach to a exist client . provide a field islibrary function type to validate fname is library or not is needed

@mfussenegger
Copy link
Member

flags in vim.lsp.start(), e.g. start({ ..., formatting = false, semantic_tokens = false, inlay_hints = true, ... })

It could also be an option to overload those to boolean|table. Then you could still disable the functionality with <option> = false, or enable it with its defaults with <option> = true, but also have more granular control if needed. For example semantic_tokens = { debounce = 500 }

Although this would still only address the "per client" (static) configuration.


Regarding vim.lsp.config:

should we adopt workspaceFolder instead of "root markers"

I think this is a bit of a red herring. We've lsp.start and lsp.start_client both which support setting workspaceFolders. To use more than one workspaceFolders you always need some heuristic to make that decision and you need to know that the language server actually supports it in a meaningful way (many don't). So imho this is out of scope for core, and unrelated to having a global configuration skeleton. (What we could do is extend vim.lsp.start to automatically extend the workspaceFolders if reuse_client returns true, to make it easier to use)

I think if we do a vim.lsp.config, it should act as a template/skeleton for vim.lsp.start - basically take care of the "global" part, while the config argument of vim.lsp.start takes care of the per-client settings.

@justinmk
Copy link
Member Author

So imho [workspaceFolder instead of "root markers"] is out of scope for core, and unrelated to having a global configuration skeleton. (What we could do is extend vim.lsp.start to automatically extend the workspaceFolders if reuse_client returns true, to make it easier to use)

I think if we do a vim.lsp.config, it should act as a template/skeleton for vim.lsp.start - basically take care of the "global" part, while the config argument of vim.lsp.start takes care of the per-client settings.

Nice. So #18506 is unblocked @gpanders

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

No branches or pull requests

5 participants