refactor(lsp): unify capability checks and registration #36781

Problem:
Our LSP type system didnt have a concept of RegistrationMethods, this is where the method to dynamically register for a capability is sent to a different method endpoint then is used to call it. Eg `textDocument/semanticTokens` rather than the specific full/range/delta methods

Solution:
Extended generator to create `vim.lsp.protocol.Methods.Registration` with these registration methods. Also extend `_request_name_to_client_capability` to cover these methods. Adjust typing to suit
This commit is contained in:
Tristan Knight
2025-12-06 23:31:11 +00:00
committed by GitHub
parent 4e1644d4d3
commit 9e9cdcaa18
6 changed files with 61 additions and 32 deletions

View File

@@ -21,7 +21,7 @@ local all_capabilities = {}
---@field name vim.lsp.capability.Name
---
--- Static field records the method this capability requires.
---@field method vim.lsp.protocol.Method.ClientToServer
---@field method vim.lsp.protocol.Method.ClientToServer | vim.lsp.protocol.Method.Registration
---
--- Static field for retrieving the instance associated with a specific `bufnr`.
---