Skip to content

Commit f5624e3

Browse files
committed
feat!: remove all code supporting Neovim v0.10
1 parent 2d8a982 commit f5624e3

File tree

4 files changed

+11
-74
lines changed

4 files changed

+11
-74
lines changed

lua/astrolsp/file_operations.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
---@class astrolsp.file_operations
1313
local M = {}
1414

15-
local utils = require "astrolsp.utils"
16-
1715
local config = vim.tbl_get(require "astrolsp", "config", "file_operations") or {}
1816

1917
---@class AstroLSPFileOperationsRename
@@ -56,8 +54,7 @@ function M.didCreateFiles(fnames)
5654
local filters = did_create.filters or {}
5755
local filtered = vim.tbl_filter(function(fname) return match_filters(filters, fname) end, fnames)
5856
if next(filtered) then
59-
utils.notify(
60-
client,
57+
client:notify(
6158
"workspace/didCreateFiles",
6259
{ files = vim.tbl_map(function(fname) return { uri = vim.uri_from_fname(fname) } end, filtered) }
6360
)
@@ -77,8 +74,7 @@ function M.didDeleteFiles(fnames)
7774
local filters = did_delete.filters or {}
7875
local filtered = vim.tbl_filter(function(fname) return match_filters(filters, fname) end, fnames)
7976
if next(filtered) then
80-
utils.notify(
81-
client,
77+
client:notify(
8278
"workspace/didDeleteFiles",
8379
{ files = vim.tbl_map(function(fname) return { uri = vim.uri_from_fname(fname) } end, filtered) }
8480
)
@@ -101,7 +97,7 @@ function M.didRenameFiles(renames)
10197
renames
10298
)
10399
if next(filtered) then
104-
utils.notify(client, "workspace/didRenameFiles", {
100+
client:notify("workspace/didRenameFiles", {
105101
files = vim.tbl_map(
106102
function(rename) return { oldUri = vim.uri_from_fname(rename.from), newUri = vim.uri_from_fname(rename.to) } end,
107103
filtered
@@ -116,7 +112,7 @@ end
116112
---@param req string
117113
---@param params table
118114
local function getWorkspaceEdit(client, req, params)
119-
local resp = utils.request_sync(client, req, params, config.timeout)
115+
local resp = client:request_sync(req, params, config.timeout)
120116
if resp and resp.result then return resp.result end
121117
end
122118

lua/astrolsp/init.lua

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
---@class astrolsp
1010
local M = {}
1111

12-
local utils = require "astrolsp.utils"
13-
1412
local tbl_contains = vim.tbl_contains
1513
local tbl_isempty = vim.tbl_isempty
1614

@@ -29,7 +27,7 @@ local function lsp_event(name) vim.api.nvim_exec_autocmds("User", { pattern = "A
2927
local function check_cond(cond, client, bufnr)
3028
local cond_type = type(cond)
3129
if cond_type == "function" then return cond(client, bufnr) end
32-
if cond_type == "string" then return utils.supports_method(client, cond, bufnr) end
30+
if cond_type == "string" then return client:supports_method(cond, bufnr) end
3331
if cond_type == "boolean" then return cond end
3432
return true
3533
end
@@ -60,13 +58,13 @@ end
6058
---@param client vim.lsp.Client The LSP client details when attaching
6159
---@param bufnr integer The buffer that the LSP client is attaching to
6260
function M.on_attach(client, bufnr)
63-
if utils.supports_method(client, "textDocument/codeLens", bufnr) and M.config.features.codelens then
61+
if client:supports_method("textDocument/codeLens", bufnr) and M.config.features.codelens then
6462
vim.lsp.codelens.refresh { bufnr = bufnr }
6563
end
6664

6765
local formatting_disabled = vim.tbl_get(M.config, "formatting", "disabled")
6866
if
69-
utils.supports_method(client, "textDocument/formatting", bufnr)
67+
client:supports_method("textDocument/formatting", bufnr)
7068
and (formatting_disabled ~= true and not tbl_contains(formatting_disabled, client.name))
7169
then
7270
local autoformat = assert(M.config.formatting.format_on_save)
@@ -78,7 +76,7 @@ function M.on_attach(client, bufnr)
7876
end
7977
end
8078

81-
if utils.supports_method(client, "textDocument/semanticTokens/full", bufnr) and vim.lsp.semantic_tokens then
79+
if client:supports_method("textDocument/semanticTokens/full", bufnr) and vim.lsp.semantic_tokens then
8280
if M.config.features.semantic_tokens then
8381
if vim.b[bufnr].semantic_tokens == nil then vim.b[bufnr].semantic_tokens = true end
8482
else
@@ -257,7 +255,7 @@ function M.setup(opts)
257255
desc = "Add signature help triggers as language servers attach",
258256
callback = function(args)
259257
local client = vim.lsp.get_client_by_id(args.data.client_id)
260-
if client and utils.supports_method(client, "textDocument/signatureHelp", args.buf) then
258+
if client and client:supports_method("textDocument/signatureHelp", args.buf) then
261259
for _, set in ipairs { "triggerCharacters", "retriggerCharacters" } do
262260
local set_var = "signature_help_" .. set
263261
local triggers = vim.b[args.buf][set_var] or {}
@@ -276,9 +274,7 @@ function M.setup(opts)
276274
if not vim.api.nvim_buf_is_valid(args.buf) then return end
277275
local triggers, retriggers = {}, {}
278276
for _, client in pairs(vim.lsp.get_clients { bufnr = args.buf }) do
279-
if
280-
client.id ~= args.data.client_id and utils.supports_method(client, "textDocument/signatureHelp", args.buf)
281-
then
277+
if client.id ~= args.data.client_id and client:supports_method("textDocument/signatureHelp", args.buf) then
282278
for _, trigger in ipairs(client.server_capabilities.signatureHelpProvider.triggerCharacters or {}) do
283279
triggers[trigger] = true
284280
end

lua/astrolsp/toggles.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
---@class astrolsp.toggles
1010
local M = {}
1111

12-
local utils = require "astrolsp.utils"
13-
1412
local config = require("astrolsp").config
1513
local features = config.features --[[@as AstroLSPFeatureOpts]]
1614
local format_on_save = config.formatting.format_on_save --[[@as AstroLSPFormatOnSaveOpts]]
@@ -67,7 +65,7 @@ function M.buffer_semantic_tokens(bufnr, silent)
6765
vim.b[bufnr].semantic_tokens = not vim.b[bufnr].semantic_tokens
6866
local toggled = false
6967
for _, client in ipairs(vim.lsp.get_clients { bufnr = bufnr }) do
70-
if utils.supports_method(client, "textDocument/semanticTokens/full", bufnr) then
68+
if client:supports_method("textDocument/semanticTokens/full", bufnr) then
7169
-- HACK: `semantic_tokens.start/stop` don't support 0 for current buffer
7270
local real_bufnr = bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr
7371
vim.lsp.semantic_tokens[vim.b[bufnr].semantic_tokens and "start" or "stop"](real_bufnr, client.id)

lua/astrolsp/utils.lua

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)