Skip to content

Conversation

@NotAShelf
Copy link
Owner

@NotAShelf NotAShelf commented Feb 16, 2025

Converts all language modules to a newer, more robust lsp.options format that allows seamless overrides. This should be considered the first step of the grand language rework, where other options (diagnostics, formatters) will follow.

Adds lib.lspOptions to expose an extensible attribute set to provide the option table for each
LSP server template via lspconfig.

Converted languages:

  • Assembly (asm-lsp)
  • Astro
  • Bash
  • Clang
  • Csharp
  • CSS
  • Cue
  • Dart
  • Gleam
  • Go
  • Haskell
  • HCL
  • Helm
  • HTML
  • Java
  • Julia
  • Kotlin
  • Lua
  • Markdown
  • Nim
  • Nix
  • Nu
  • OCaml
  • Odin
  • PHP
  • Python
  • R
  • Ruby
  • Rust
  • Scala
  • SQL
  • Svelte
  • Tailwind
  • Terraform
  • TS
  • Typst
  • Vala
  • YAML
  • Zig

github-actions bot pushed a commit that referenced this pull request Feb 16, 2025
@github-actions
Copy link

github-actions bot commented Feb 16, 2025

🚀 Live preview deployed from 99f1200

View it here:

Debug Information

Triggered by: NotAShelf

HEAD at: lsp-configuration-opts

Reruns: 813

@NotAShelf NotAShelf changed the title lib/languages: add lspOptions submodule type for freeform LSP config languages: inherit lspconfig options from language options Feb 16, 2025
@NotAShelf NotAShelf force-pushed the lsp-configuration-opts branch from 0a00dd5 to d827ac8 Compare February 16, 2025 09:59
github-actions bot pushed a commit that referenced this pull request Feb 20, 2025
@NotAShelf NotAShelf self-assigned this Mar 15, 2025
@NotAShelf NotAShelf added enhancement New feature or request TBD More discussion and research is in order labels Mar 15, 2025
@NotAShelf NotAShelf added this to the 0.8 milestone Mar 15, 2025
github-actions bot pushed a commit that referenced this pull request Mar 15, 2025
@NotAShelf NotAShelf force-pushed the lsp-configuration-opts branch from 20deb1a to c670c27 Compare March 15, 2025 22:43
Comment on lines +47 to +53
{
offsetEncoding = { "utf-8", "utf-16" },
textDocument = {
completion = {
editsNearCursor = true
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't extend default capabilities does it? should do so otherwise snippets/other stuff won't work

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default value in lspconfig.

The situation is a bit annoying; since option values are converted verbatim using variables is out of the question, lest they turned into the following:

capabilities = local ccap = capabilities
               capabilities = ccap.extend

(Bad representation, but the point is that it has to be inline.)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capabilities = vim.tbl_deep_extend("force", capabilities, { offsetEncoding = { "utf-8", "utf-16" }, textDocument = { completion = { editsNearCursor = true } } })

Maybe like this? lmao

@NotAShelf NotAShelf force-pushed the main branch 5 times, most recently from 02ee4cc to bc978c4 Compare March 17, 2025 11:42
github-actions bot pushed a commit that referenced this pull request Mar 17, 2025
@NotAShelf NotAShelf force-pushed the lsp-configuration-opts branch from 6e6c9dd to 00ef9a6 Compare March 17, 2025 14:09
github-actions bot pushed a commit that referenced this pull request Mar 18, 2025
@NotAShelf NotAShelf force-pushed the lsp-configuration-opts branch from 5b69869 to 077a27d Compare March 18, 2025 13:24
@NotAShelf NotAShelf force-pushed the lsp-configuration-opts branch from 077a27d to 0376d8d Compare March 19, 2025 07:13
github-actions bot pushed a commit that referenced this pull request Mar 19, 2025
@NotAShelf NotAShelf mentioned this pull request Mar 27, 2025
1 task
dependabot bot and others added 20 commits March 27, 2025 14:11
Bumps [beatlabs/delete-old-branches-action](https://github.com/beatlabs/delete-old-branches-action) from 0.0.10 to 0.0.11.
- [Release notes](https://github.com/beatlabs/delete-old-branches-action/releases)
- [Commits](beatlabs/delete-old-branches-action@v0.0.10...v0.0.11)

---
updated-dependencies:
- dependency-name: beatlabs/delete-old-branches-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* eslint_d: added conditions for launching eslint_d

* eslint_d: documented changes to docs/release-notes/rl-0.8.md

---------

Co-authored-by: raf <[email protected]>
Add missing word in sentence: `let`.
github-actions bot pushed a commit that referenced this pull request Mar 27, 2025
Comment on lines +81 to +86
vim.lsp.lspconfig = {
enable = true;
sources.asm-lsp = ''
lspconfig.${toLuaObject cfg.lsp.server}.setup(${toLuaObject cfg.lsp.options})
'';
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could something like this be handled directlly in the lspconfig module? Example from personal configuration: https://github.com/LilleAila/nvf-config/blob/main/config/languages/lspconfig.nix

, rather than having raw lua code in the modules themselves?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what I have in mind, instead of making LSP setups a part of language modules I intend to create a lower-level API to configure LSPs, possibly as vim.lsp or something similar. I would appreciate your feedback or/and proposals here

Comment on lines +28 to +31
cmd =
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ["${getExe cfg.lsp.package}"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to make this be possibly null? When cmd is unset, it picks the LSP directly from PATH, which allows for installing them directly in devshells, but in this configuration, it is necessary to specify it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a good idea. The current idea was to set a ["lsp-cmd"] to execute from PATH, but null might work if we filter those.

@horriblename
Copy link
Collaborator

horriblename commented Mar 27, 2025

  • with nvim-0.11 additions, we should provide default capabilities via vim.lsp.config('*', {capabilities = ...})
  • same thing for on_attach

EDIT: turns out nvim supports on_attach natively

with this I think we can get rid of lspconfig for configuring LSPs, we still keep lspconfig for default server configs, but we don't use their API anymore (oh my god I can already feel the amount of plugins breakages because of this)

@sjcobb2022
Copy link

Is there anything i can do to help move this along?

I would love to have this configurability in my config

@NotAShelf
Copy link
Owner Author

Is there anything i can do to help move this along?

I would love to have this configurability in my config

I should've closed this PR, as it's superseded by #801 in its entirety. The new vim.lsp.servers option is already in main branch if you're interested in configuring your own LSPs, but feel free to submit PRs to convert LSPs not covered by #801 if you would like to contribute

@NotAShelf NotAShelf closed this May 8, 2025
@github-actions
Copy link

github-actions bot commented May 8, 2025

✅ Preview has been deleted successfully!

github-actions bot pushed a commit that referenced this pull request May 8, 2025
@github-actions github-actions bot deleted the lsp-configuration-opts branch May 15, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request TBD More discussion and research is in order

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants