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

Compatibility Issue with lspsaga: Error codeaction/init.lua:265 attempt to index a nil value #308

Open
xinghe98 opened this issue Nov 7, 2024 · 0 comments

Comments

@xinghe98
Copy link

xinghe98 commented Nov 7, 2024

Description

I'm encountering an error when using typescript-tool.nvim with lspsaga for code actions. The error message I receive is:
lspsaga error executing lua callback: codeaction/init.lua:265: attempt to index a nil value
微信截图_20241107112914

This issue only occurs when I use typescript-tool.nvim as the LSP plugin for TypeScript. When I switch to vscode-typescript-language-server (vtsls), the error does not appear, and everything works as expected.

Steps to Reproduce

  1. Install typescript-tool.nvim and lspsaga plugins.
  2. Configure Neovim to use typescript-tool.nvim as the LSP for TypeScript.
  3. Trigger a code action via lspsaga (e.g., select a piece of code and run Lspsaga code_action).
  4. Observe the error.

Expected Behavior

Code actions should work without any errors.

Actual Behavior

When triggering a code action, the following error appears:

lspsaga error executing lua callback: codeaction/init.lua:265: attempt to index a nil value

Environment

  • Neovim Version: NVIM v0.10.1
  • typescript-tool.nvim Version: (latest)
  • lspsaga Version: (latest)
  • Operating System: Windows 11

Configuration Snippet

Here is the relevant part of my Neovim configuration:

-- typescript-tool.nvim configuration
return {
	{
		-- "pmizio/typescript-tools.nvim",
		-- dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
		-- build = "yarn add global @vue/typescript-plugin",
		-- opts = {
		-- 	filetypes = {
		-- 		"javascript",
		-- 		"javascriptreact",
		-- 		"typescript",
		-- 		"typescriptreact",
		-- 		"vue",
		-- 	},
		-- 	settings = {
		-- 		tsserver_plugins = {
		-- 			"@vue/typescript-plugin",
		-- 			"@styled/typescript-styled-plugin",
		-- 		},
		-- 		tsserver_locale = "zh-CN",
		-- 		tsserver_file_preferences = {
		-- 			includeInlayParameterNameHints = "all",
		-- 			includeCompletionsForModuleExports = true,
		-- 			quotePreference = "auto",
		-- 			includeInlayParameterNameHintsWhenArgumentMatchesName = true,
		-- 			includeInlayFunctionParameterTypeHints = true,
		-- 			includeInlayVariableTypeHints = true,
		-- 			includeInlayVariableTypeHintsWhenTypeMatchesName = true,
		-- 			includeInlayPropertyDeclarationTypeHints = true,
		-- 			includeInlayFunctionLikeReturnTypeHints = true,
		-- 			includeInlayEnumMemberValueHints = true,
		-- 		},
		-- 	},
		-- },
	},
}

-- lspsaga configuration
return {
	{
		"nvimdev/lspsaga.nvim",
		-- after = "nvim-lspconfig",
		event = "LspAttach",
		init = function()
			require("lspsaga").setup({
				ui = {
					code_action = "",
				},
				scroll_preview = {
					scroll_down = "<C-e>",
					scroll_up = "<C-u>",
				},
				code_action = {
					-- show_server_name = true,
					keys = {
						quit = "<esc>",
						exec = "<CR>",
					},
				},
				rename = {
					keys = {
						quit = "<esc>",
					},
				},
			})
		end,
	},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant