Skip to content

Commit

Permalink
refactor!: remove lsp_util (nvim 0.9.0 compatibility)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This commit removes the `lsp_util` module, which was
used to provide compatibility with Neovim 0.9.0. We now only support
nvim 0.10.0 and later.

This was announced before, but I forgot to use `!` in the commit message.

This is probably the first breaking change for nvim 0.9.0.
  • Loading branch information
mikavilpas committed May 21, 2024
1 parent 3dd8fd4 commit 6f27462
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
12 changes: 8 additions & 4 deletions lua/yazi/lsp/delete.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
local lsp_util = require('yazi.lsp.lsp_util')

local M = {}

---@param path string
local function notify_file_was_deleted(path)
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_willDeleteFiles
local method = 'workspace/willDeleteFiles'

local clients = lsp_util.get_clients(method, vim.api.nvim_get_current_buf())
local clients = vim.lsp.get_clients({
method = method,
bufnr = vim.api.nvim_get_current_buf(),
})

for _, client in ipairs(clients) do
local resp = client.request_sync(method, {
Expand All @@ -29,7 +30,10 @@ local function notify_delete_complete(path)
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didDeleteFiles
local method = 'workspace/didDeleteFiles'

local clients = lsp_util.get_clients(method, vim.api.nvim_get_current_buf())
local clients = vim.lsp.get_clients({
method = method,
bufnr = vim.api.nvim_get_current_buf(),
})

for _, client in ipairs(clients) do
-- NOTE: this returns nothing, so no need to do anything with the response
Expand Down
15 changes: 0 additions & 15 deletions lua/yazi/lsp/lsp_util.lua

This file was deleted.

12 changes: 8 additions & 4 deletions lua/yazi/lsp/rename.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local lsp_util = require('yazi.lsp.lsp_util')

local M = {}

---@param from string
Expand All @@ -8,7 +6,10 @@ local function notify_file_was_renamed(from, to)
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_willRenameFiles
local method = 'workspace/willRenameFiles'

local clients = lsp_util.get_clients(method)
local clients = vim.lsp.get_clients({
method = method,
bufnr = vim.api.nvim_get_current_buf(),
})

for _, client in ipairs(clients) do
local resp = client.request_sync(method, {
Expand All @@ -32,7 +33,10 @@ local function notify_rename_complete(from, to)
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didRenameFiles
local method = 'workspace/didRenameFiles'

local clients = lsp_util.get_clients(method)
local clients = vim.lsp.get_clients({
method = method,
bufnr = vim.api.nvim_get_current_buf(),
})

for _, client in ipairs(clients) do
-- NOTE: this returns nothing, so no need to do anything with the response
Expand Down

0 comments on commit 6f27462

Please sign in to comment.