lspsaga.nvim icon indicating copy to clipboard operation
lspsaga.nvim copied to clipboard

fix: replace deprecated LSP client method calls with colon syntax

Open leeguooooo opened this issue 7 months ago • 3 comments

Summary

This PR fixes deprecation warnings in Neovim 0.11+ by replacing deprecated LSP client method calls with the new colon syntax.

Changes

  • Replace client.supports_method() with client:supports_method()
  • Replace client.request() with client:request()
  • Replace client.request_sync() with client:request_sync()

Backwards Compatibility ✅

This change is fully backwards compatible and requires no version checks:

  • Lua syntax sugar: client:method() is identical to client.method(client, ...) - just cleaner syntax
  • Neovim support: Colon syntax has been supported since Neovim 0.5+
  • Plugin requirements: lspsaga.nvim requires Neovim 0.9+, which fully supports colon syntax
  • No breaking changes: All functionality remains identical, only the syntax is modernized

Files Modified

  • lua/lspsaga/codeaction/lightbulb.lua
  • lua/lspsaga/symbol/head.lua
  • lua/lspsaga/symbol/init.lua
  • lua/lspsaga/util.lua
  • lua/lspsaga/typehierarchy.lua
  • lua/lspsaga/codeaction/init.lua
  • lua/lspsaga/callhierarchy.lua
  • lua/lspsaga/implement/init.lua

Background

In Neovim 0.11+, the LSP client API has deprecated the dot notation for client methods in favor of colon notation. This change maintains the same functionality while using the modern API and eliminates deprecation warnings like:

client.supports_method is deprecated. Feature will be removed in Nvim 0.13
ADVICE: use client:supports_method instead.

Test Plan

  • [x] All existing functionality remains unchanged
  • [x] No more deprecation warnings in Neovim 0.11+
  • [x] All modified files verified to use new syntax consistently
  • [x] Backwards compatibility verified on Neovim 0.11.1

Closes #1543

leeguooooo avatar Jun 17 '25 06:06 leeguooooo

any news on this? would be nice to get rid of the deprecation warnings every time i boot nvim @glepnir :). the error started showing up for me when I updated nvim to 0.12 dev

HendrikPetertje avatar Aug 06 '25 07:08 HendrikPetertje

Same for me the error started in nightly build NVIM v0.12.0-dev-949+g5f9f706462 a temporary solution for now @HendrikPetertje

-- temp error with nvim.progress and nvim.lspsaga [to be updated ]
vim.deprecate = function() end

Ghasak avatar Aug 08 '25 05:08 Ghasak

turning off deprecations warnings, defeats the entire purpose of running with neovim:master builds.

HendrikPetertje avatar Aug 12 '25 06:08 HendrikPetertje