windwp / nvim-autopairs

autopairs for neovim written in lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React compatabilty?

jasper-at-windswept opened this issue · comments

Is your feature request related to a problem? Please describe.
My issue is when I have a useState hook the setter value is use with () brackets so I want it to automatically add those when I autocomplete the name with nvim-cmp. The problem is if I set the below kind of config for Field, (which is what the setter is) it causes alot of problems when just trying to use lots of other normal variables.

Describe the solution you'd like
Can there be some kind of compat added for these sorts of setter functions or some other alternative to fix this problem?

Describe alternatives you've considered
I have tried using mini.pairs plugin but it lacks alot of configuration and general usability compared to this plugin.

Additional context
The config mentioned:

	{
		"windwp/nvim-autopairs",
		opts = {
			fast_wrap = {},
			disable_filetype = { "TelescopePrompt", "vim" },
			enable_check_bracket_line = false,
		},
		config = function(_, opts)
			require("nvim-autopairs").setup(opts)

			-- setup cmp for autopairs
			local cmp_autopairs = require("nvim-autopairs.completion.cmp")
			local cmp = require("cmp")
			local handlers = require("nvim-autopairs.completion.handlers")
			cmp.event:on(
				"confirm_done",
				cmp_autopairs.on_confirm_done({
					filetypes = {
						["*"] = {
							["("] = {
								kind = {
									cmp.lsp.CompletionItemKind.Function,
									cmp.lsp.CompletionItemKind.Method,
                                                                        -- This is not good
                                                                        cmp.lsp.CompletionItemKind.Field,
								},
								handler = handlers["*"],
							},
						},
					},
				})
			)
		end,
	},