Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: extract to new file code action is not working #1223

Closed
1 of 6 tasks
kaiphat opened this issue May 29, 2024 · 4 comments
Closed
1 of 6 tasks

Bug: extract to new file code action is not working #1223

kaiphat opened this issue May 29, 2024 · 4 comments
Labels
upstream An issue upstream (neovim, fzf, etc)

Comments

@kaiphat
Copy link

kaiphat commented May 29, 2024

RTFM Checklist

  • I have searched exisiting issues / discussions
  • I have read the Wiki including the Advanced section
  • I have read man fzf / I am well versed in shell fzf

Operating system

MaxOs

Shell

fish

Neovim version (nvim --version)

NVIM v0.10.0

Fzf version (fzf --version)

0.52.1

Output of :lua print(os.getenv('FZF_DEFAULT_OPTS'))

nil

Is the problem reproducible with mini.sh?

  • My issue is reproducible with mini.sh
  • My issue IS NOT reproducible with mini.sh
  • I have not tested with mini.sh (not relevant, requires LSP, Windows, etc)

Fzf-lua configuration

require('fzf-lua').setup({
			lsp = {
				prompt_postfix = '', -- will be appended to the LSP label
				-- to override use 'prompt' instead
				prompt = build_prompt(),
				cwd_only = false, -- LSP/diagnostics for cwd only?
				async_or_timeout = 5000, -- timeout(ms) or 'true' for async calls
				file_icons = true,
				git_icons = false,
				-- The equivalent of using `includeDeclaration` in lsp buf calls, e.g:
				-- :lua vim.lsp.buf.references({includeDeclaration = false})
				includeDeclaration = false, -- include current declaration in LSP context
				-- settings for 'lsp_{document|workspace|lsp_live_workspace}_symbols'
				symbols = {
					prompt = build_prompt(),
					async_or_timeout = true, -- symbols are async by default
					symbol_style = 1, -- style for document/workspace symbols
					-- false: disable,    1: icon+kind
					--     2: icon only,  3: kind only
					-- NOTE: icons are extracted from
					-- vim.lsp.protocol.CompletionItemKind
					-- icons for symbol kind
					-- see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#symbolKind
					-- see https://github.com/neovim/neovim/blob/829d92eca3d72a701adc6e6aa17ccd9fe2082479/runtime/lua/vim/lsp/protocol.lua#L117
					symbol_icons = {
						File = '󰈙',
						Module = '',
						Namespace = '󰦮',
						Package = '',
						Class = '󰆧',
						Method = '󰊕',
						Property = '',
						Field = '',
						Constructor = '',
						Enum = '',
						Interface = '',
						Function = '󰊕',
						Variable = '󰀫',
						Constant = '󰏿',
						String = '',
						Number = '󰎠',
						Boolean = '󰨙',
						Array = '󱡠',
						Object = '',
						Key = '󰌋',
						Null = '󰟢',
						EnumMember = '',
						Struct = '󰆼',
						Event = '',
						Operator = '󰆕',
						TypeParameter = '󰗴',
					},
					-- colorize using Treesitter '@' highlight groups ("@function", etc).
					-- or 'false' to disable highlighting
					symbol_hl = function(s)
						return '@' .. s:lower()
					end,
					-- additional symbol formatting, works with or without style
					symbol_fmt = function(s, opts)
						return '[' .. s .. ']'
					end,
					-- prefix child symbols. set to any string or `false` to disable
					child_prefix = true,
					fzf_opts = {
						['--tiebreak'] = 'begin',
					},
				},
				code_actions = {
					async_or_timeout = 5000,
					-- when git-delta is installed use "codeaction_native" for beautiful diffs
					-- try it out with `:FzfLua lsp_code_actions previewer=codeaction_native`
					-- scroll up to `previewers.codeaction{_native}` for more previewer options
					previewer = 'codeaction',
				},
				finder = {
					file_icons = true,
					color_icons = true,
					git_icons = false,
					async = true, -- async by default
					silent = true, -- suppress "not found"
					separator = '| ', -- separator after provider prefix, `false` to disable
					includeDeclaration = false, -- include current declaration in LSP context
					-- by default display all LSP locations
					-- to customize, duplicate table and delete unwanted providers
					providers = {
						{ 'references', prefix = require('fzf-lua').utils.ansi_codes.blue 'ref ' },
						{ 'definitions', prefix = require('fzf-lua').utils.ansi_codes.green 'def ' },
						{ 'declarations', prefix = require('fzf-lua').utils.ansi_codes.magenta 'decl' },
						{ 'typedefs', prefix = require('fzf-lua').utils.ansi_codes.red 'tdef' },
						{ 'implementations', prefix = require('fzf-lua').utils.ansi_codes.green 'impl' },
						{ 'incoming_calls', prefix = require('fzf-lua').utils.ansi_codes.cyan 'in  ' },
						{ 'outgoing_calls', prefix = require('fzf-lua').utils.ansi_codes.yellow 'out ' },
					},
				},
			},

})

Describe the bug / steps to reproduce

Code action Move to a new file is not working when i use fzf like this:

		map({ 'n', 'v' }, '<space>la', function()
			require('fzf-lua').lsp_code_actions {}
		end)

When i select this action nothing happens.
When i use vim.lsp.buf.code_action() all is okay.
I tried it with typescript-tools and vtsls also.

@kaiphat kaiphat added the bug Something isn't working label May 29, 2024
@ibhagwan
Copy link
Owner

ibhagwan commented May 29, 2024

This is a bug in typescript-tools.nvim (which seems like an abandoned project btw):
pmizio/typescript-tools.nvim#231

Perhaps the same bug exists in vtsls? Can you try with the preview disabled and lmk if it works?

@ibhagwan ibhagwan added upstream An issue upstream (neovim, fzf, etc) and removed bug Something isn't working labels May 29, 2024
@kaiphat
Copy link
Author

kaiphat commented Jun 4, 2024

Can you try with the preview disabled

I tried and without preview action works.

@ibhagwan
Copy link
Owner

ibhagwan commented Jun 4, 2024

Can you try with the preview disabled

I tried and without preview action works.

That confirms my suspicion about this issue, unfortunately there is not much I can do about this, there is already an issue with typescript-tools, you can open one in vtsls using the information I provided in pmizio/typescript-tools.nvim#231 to understand why this happens.

@ibhagwan
Copy link
Owner

FYI, regarding vtsls, from yioneko/vtsls#26:

Features include completion, code action involve a hacky implementation for corresponding resolve method because some carrying data is not serializable for communication with client. It is likely completionItem/resolve and codeAction/resolve will fail in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream An issue upstream (neovim, fzf, etc)
Projects
None yet
Development

No branches or pull requests

2 participants