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

Disable JSX snippets #71

Closed
nikitarevenco opened this issue Jun 24, 2024 · 1 comment
Closed

Disable JSX snippets #71

nikitarevenco opened this issue Jun 24, 2024 · 1 comment

Comments

@nikitarevenco
Copy link

nikitarevenco commented Jun 24, 2024

Is it possible to disable this feature where it suggests the <tag></tag> whenever I enter "tag" or any other word?

image

image

Config:

{
		-- !cmp
		"hrsh7th/nvim-cmp",
		event = "InsertEnter",
		dependencies = {
			"hrsh7th/cmp-buffer", -- source for text in buffer
			"hrsh7th/cmp-path", -- source for file system paths
			{
				"L3MON4D3/LuaSnip",
				-- follow latest release.
				version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
				-- install jsregexp (optional!).
				build = "make install_jsregexp",
				opts = { updateevents = "TextChanged,TextChangedI" },
				keys = {},
			},
			"saadparwaiz1/cmp_luasnip", -- for autocompletion
			"rafamadriz/friendly-snippets", -- useful snippets
			"onsails/lspkind.nvim", -- vs-code like pictograms
			{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
		},
		config = function()
			local cmp = require("cmp")

			-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
			require("luasnip.loaders.from_vscode").lazy_load()

			cmp.setup({
				performance = {
					max_view_entries = 3,
				},
				completion = {
					completeopt = "menu,menuone,preview,noselect",
				},
				-- snippet = { -- configure how nvim-cmp interacts with snippet engine
				-- 	expand = function(args)
				-- 		require("luasnip").lsp_expand(args.body)
				-- 	end,
				-- },

				mapping = cmp.mapping.preset.insert({
					-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),
					-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
					[keymaps.cmp_abort] = cmp.mapping.abort(),
					[keymaps.cmp_confirm] = cmp.mapping.confirm({ select = true }),
				}),

				-- sources for autocompletion
				sources = cmp.config.sources({
					{ name = "nvim_lsp" }, -- language-specific completion
					{ name = "luasnip" }, -- snippets
					{ name = "buffer" }, -- text within current buffer
					{ name = "path" }, -- file system paths
				}),

				-- configure lspkind for vs-code like pictograms in completion menu
				formatting = {
					format = function(entry, item)
						-- Apply the original lspkind formatting
						item = require("lspkind").cmp_format({
							maxwidth = 50, -- specifies the maximum width of the text part
							ellipsis_char = "...", -- specifies the characters added when the text part is truncated
						})(entry, item)

						-- Then apply the Tailwind CSS colorizer formatting
						return require("tailwindcss-colorizer-cmp").formatter(entry, item)
					end,
				},
			})
		end,
	}
@nikitarevenco
Copy link
Author

Update, fixed this

image

Here are the changes I need to make:

					{
						name = "nvim_lsp",
					},

Replaced to:

					{
						name = "nvim_lsp",
						entry_filter = function(entry, ctx)
							return require("cmp").lsp.CompletionItemKind.Snippet ~= entry:get_kind()
						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