ojroques / nvim-lspfuzzy Goto Github PK
View Code? Open in Web Editor NEWA Neovim plugin to make the LSP client use FZF
License: BSD 2-Clause "Simplified" License
A Neovim plugin to make the LSP client use FZF
License: BSD 2-Clause "Simplified" License
preview works well on fzf's built-in function, what debug info do you need to help
For instance, I'd like to use the preview window for the textDocument/references
method, but not for textDocument/codeAction
, since there is nothing to preview in that case. Thanks!
First of all, thanks for the great plugin!
I am trying to improve the document symbol window, right now it depends on showing the entire file path to move to the correct position so when my editor is small-ish it stops being useful:
Is there a way to get around that limitation? Changing the modifier eventually ends up breaking and opening new buffers with names which makes sense but hasn't gotten me any closer. :p:t
for example looks great but falls into these (which to be fair the read me mentions)
Any suggestions?
๐๐ผ
I just noted that I'm no longer getting the actions in fzf
on the latest neovim nightly. It works on 0.5.1
but fails on latest nightly (v0.6.0-dev+368-g9337fff8a
).
Gimme a ping if you need any further information.
@ojroques okay I am noticing that even after calling the action function, it automatically sets the qflist and opens that split, which defeats the purpose of my qf_list function. I we can let action take complete control over what happens with the selections, which makes it more like the last callback.
I suggest letting the call return after calling functional action. What do you think?
Originally posted by @ViRu-ThE-ViRuS in #27 (comment)
Issue:
Open a file with active LSP and call references
. FZF window with references will pop up, but when you change the selected reference, the preview window shows the file in its current position (0 line for a closed file or current cursor position for an open file).
Expected behavior:
FZF window will scroll to a line with the selected reference.
Environment:
LSP clangd
and pyls
(the issue is reproducable on both LSPs)
Ubuntu 20.04
NeoVim 0.6.0
nvim-lspfuzzy
- latest
fzf
and fzf.vim
installed, latest version
List all the workspace symbols, and searching on the fly.
okay I am noticing that if we use a action which is a lua function, lspfuzzy
will automatically set the qflist
and open qflist, which might defeat the purpose fo the action
argument. We can let action
take complete control over what happens with the selections, which makes it more like the last callback.
I suggest letting the call return
after calling functional action.
builds on #27
Is it possible to reopen the window with the last command results?
E.g. If I do find usages, and go to the first usage, I might want to go to another usage, after I reviewed the first one. Would it be possible to save the results and have an option to reopen the window?
Or another way to implement something like that would be to duplicate results into the QuickFix window; so you can run copen
and look at them later.
BTW, thanks for the great plugin.
Do you plan to support those handlers in the near future or are they out of scope?
I've updated everything and I am on neovim master but I get
|| E5108: Error executing lua ...to/.local/share/nvim/site/nvim-lspfuzzy/lua/lspfuzzy.lua:95: bad argument #1 to 'unpack' (table expected, got string)
|| E5108: Error executing lua ...to/.local/share/nvim/site/nvim-lspfuzzy/lua/lspfuzzy.lua:95: bad argument #1 to 'unpack' (table expected, got string)
on
:LspDiagnosticAll
was wondering if this project plans to ever switch over to using vijaymarupudi/nvim-fzf
? The importance of doing this will become greater as lua support in neovim improves (and performance)
codeAction doesn't seem to work for me. Here is the config.
vim.api.nvim_buf_set_keymap('n', 'gca', [[<cmd>lua vim.lsp.buf.code_action()<CR>]], { silent = true, noremap = true })
hey, I have a setup using fzf.vim
and nvim-lspfuzzy
, with a custom function to send fzf selections to q qflist.
qf_populate = function(lines, mode)
if mode == nil then
lines = core.foreach(lines, function(item) return { filename = item, lnum = 1, col = 1 } end)
mode = "r"
end
vim.fn.setqflist(lines, mode)
vim.cmd [[
copen
setlocal statusline=%!v:lua.StatusLine('QuickFix')
setlocal nobuflisted
wincmd p
echo hello
]]
end
and my fzf_actions
is set as:
vim.g.fzf_action = {
["ctrl-q"] = qf_populate,
["ctrl-x"] = "split",
["ctrl-v"] = "vsplit"
}
this setup works for fzf.vim
, and a few custom LSP handlers I wrote (using qf_populate for multi-file refactors). How can I get lspfuzzy
to call this function, with the first param as the lines. ?
5 fix set_qlist(a nil val)
6
7 diff --git a/lua/lspfuzzy.lua b/lua/lspfuzzy.lua
8 index fac5c6c..76a8937 100644
9 --- a/lua/lspfuzzy.lua
10 +++ b/lua/lspfuzzy.lua
11 @@ -92,7 +92,7 @@ local function jump(entries)
12
13 -- Use the quickfix list to store remaining locations
14 if #locations > 1 then
15 - vim.lsp.util.set_qflist(vim.lsp.util.locations_to_items(locations, offset_encoding))
16 + vim.fn.setqflist(vim.lsp.util.locations_to_items(locations, offset_encoding))
17 vim.cmd 'copen'
18 vim.cmd 'wincmd p'
19 end
Hi, in README, the supported LSP functions are:
callHierarchy/incomingCalls
callHierarchy/outgoingCalls
textDocument/declaration
textDocument/definition
textDocument/documentSymbol
textDocument/implementation
textDocument/references
textDocument/typeDefinition
workspace/symbol
So textDocument/codeAction not support?
I have defaulted fzf to show preview in the bottom ('down') but it keeps showing on right, so I think that you are probably overriding this settings somehow.
Is there any plans for adding the option to choose between Telescope and FZF ?
At the moment, Telescope seems to be the most extensible fuzzy finder (and in consequence, probably the best one), it is written entirely in lua (unlike the FZF plugin for vim) and it has become the most popular fuzzy finder for users moving their configuration over to lua, and those users usually only want lua plugins.
It just makes sense adding support for telescope. How difficult would it be to implement ? Both plugins are written in lua so maybe that would make it a little bit easier.
๐๐ผ
I mainly use the tsserver
LSP and I'm seeing two issues when triggering codeAction
with this plugin:
[lspfuzzy] json: cannot unmarshal number into Go struct field Diagnostic.context.diagnostics.code of t
ype string
Sometimes, maybe 1 out of 10, the text of the actions are missing. As soon as I input text and then remove it the text renders correctly. Do note that the count is correct though.
Thank you for an otherwise awesome plugin ๐๐ผ Just ping if you need further input/information.
Hey there, first of all thanks for this: #36
I just wanna ask if it's possible to get color for the severity text. It doesn't need to set it according Diagnostic highlight, but maybe common diagnostic color. eg.
path/to/file: ansi.red [ERROR] ansi.reset error message bla bla
This would increase clarity.
Hi,
I like your plugin, and it's very useful.
I found fzf
can jump to the window/tab where the buffer is open(set ['ctrl-t'] = 'tab drop'
), can nvim-lspfuzzy
do this?
The option to set fzf_layout is missing. Unable to use fzf_layout = { 'down' : '30%' }
to get the fzf window down rather than in the middle.
Is it there and I am missing something?
If not, please add that support.
My configuration is -
-- Lsp fuzzy seach setup
local g = vim.g
local map = vim.api.nvim_set_keymap
require('lspfuzzy').setup {
methods = 'all', -- either 'all' or a list of LSP methods (see below)
fzf_layout = 'down:30%',
fzf_preview = { -- arguments to the FZF '--preview-window' option
'right:+{2}-/2' -- preview on the right and centered on entry
},
fzf_action = { -- FZF actions
['ctrl-t'] = 'tabedit', -- go to location in a new tab
['ctrl-v'] = 'vsplit', -- go to location in a vertical split
['ctrl-x'] = 'split', -- go to location in a horizontal split
},
fzf_modifier = ':~:.', -- format FZF entries, see |filename-modifiers|
fzf_trim = true, -- trim FZF entries
}
map('n', '<A-g>', ':GFiles<cr>', {})
map('n', '<A-p>', ':Files<cr>', {})
I have added the option for layout as down but still the window is coming as floating window in the center.
I will probably pick this up when I have a bit of time. I have migrated to fzf-lua and would like to be able to use that for previews.
Hi,
I'm running neovim NVIM v0.6.0-dev+1551-g0e22a40b6
, and just updated a all of my plugins with Packer.
I am also using gopls
, built-in LSP, and nvim-lspfuzzy
. Previously, I would call vim.lsp.buf.definition()
via a keybinding when hovering over a keyword in go. Often, there is only a single definition location, so my buffer would be moved automatically to that location. Further, if there were multiple definitions, I would get the fuzzy complete pop-up and could choose my definition.
For some reason, after upgrading, when I make a vim.lsp.buf.definition()
call, I am getting the following error:
Error executing vim.schedule lua callback: vim/shared.lua:199: Expected table, got string
I also get this same error when calling vim.lsp.buf.implementation()
and vim.lsp.buf.references()
.
I know that this is a nvim-lspfuzzy
related issue, since when I disable nvim-lspfuzzy
, these same function calls work as expected (except I don't get the pretty fuzzy pop-up!)
I am wondering if I am missing some configuration item here, or if this is an actual bug.
Please let me know if you would like additional information for re-producability.
This plugin is very good, but it doesn't seem to support codeaction.
Hi,
Thanks for the awesome plugin, I've been using it and I'm super happy!
I have a question:
When executing the lsp function to go to definition in a typescript project, it always lists the definition from dir node_modules
I've tried to ignore that and it works when I use Rg
and fzf commands but it doesn't work when using the plugin. Which leads me to think that customizing the FZF_DEFAULT_COMMAND
in either nvim or my .zshrc file don't have an effect on the fzf command used for the lsp functions.
Is there a way to exclude files or directories for the plugin's supported commands?
If you need any more input let me know :)
Cheers!
I'm a bit new to lua configuration but this is about as far as I got...
My setup is basic e.g. require('lspfuzzy').setup {}
and when running vim.lsp.buf.declaration()
is giving me this error. The result
parameter in the returned handler in make_location_handler
is of type number for some reason ๐คทโโ๏ธ
local debug = require("debug")
xpcall(function() vim.lsp.buf.declaration() end, function() print(debug.traceback()) end)
EOF
stack traceback:
^I[string ":lua"]:2: in function <[string ":lua"]:2>
^I[C]: in function 'assert'
^Ivim/shared.lua:199: in function 'tbl_isempty'
^I...im/site/pack/packer/start/nvim-lspfuzzy/lua/lspfuzzy.lua:135: in function 'handler' <-------------
^I/usr/share/nvim/runtime/lua/vim/lsp.lua:1276: in function 'request'
^I/usr/share/nvim/runtime/lua/vim/lsp/buf.lua:69: in function 'declaration'
^I[string ":lua"]:2: in function <[string ":lua"]:2>
^I[C]: in function 'xpcall'
^I[string ":lua"]:2: in main chunk
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.