Skip to content

Instantly share code, notes, and snippets.

@d-miketa
Created September 28, 2021 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-miketa/1a44ca54c0c6abf5685b746b763eac03 to your computer and use it in GitHub Desktop.
Save d-miketa/1a44ca54c0c6abf5685b746b763eac03 to your computer and use it in GitHub Desktop.
Efm breaks vim.lsp.buf.rename()?
def main():
a_string = 'rename me!'
return a_string
if __name__ == "__main__":
main()
-- install packer
local fn = vim.fn
local cmd = vim.cmd
local install_path = '/tmp/nvim/site/pack/packer/start/packer.nvim'
cmd('set packpath=/tmp/nvim/site')
local function load_plugins()
local packer = require('packer')
local use = packer.use
packer.reset()
packer.init {package_root = '/tmp/nvim/site/pack', git = {clone_timeout = -1}}
use 'wbthomason/packer.nvim'
use 'neovim/nvim-lspconfig'
use 'kabouzeid/nvim-lspinstall'
packer.sync()
end
_G.load_config = function()
cmd('set termguicolors')
-- Replace this part of the config with whatever configuration you're using
require'lspinstall'.setup()
require'lspinstall'.install_server('efm')
require'lspinstall'.install_server('python')
require'lspconfig'.python.setup {}
require'lspconfig'.efm.setup {filetypes = {'python'}}
vim.api.nvim_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', {noremap = true, silent = true})
end
if fn.isdirectory(install_path) == 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
end
load_plugins()
cmd('autocmd User PackerComplete ++once lua load_config()')
load_config()
@d-miketa
Copy link
Author

d-miketa commented Sep 28, 2021

Run with nvim --noplugin -u minimal_init.lua main.py. Once both pyright and efm are downloaded, attempt to rename a_string using <space>rn. The dialogue will repeat itself. Afterwards, two changes are recorded.

It appears both language servers (pyright and efm) are being asked to rename the string, or that pyright is being asked twice? Removing efm fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment