Giter VIP home page Giter VIP logo

Comments (11)

kevinhwang91 avatar kevinhwang91 commented on August 22, 2024 1

can't reproduce it.

from nvim-ufo.

kevinhwang91 avatar kevinhwang91 commented on August 22, 2024 1

Solved by ufo.

from nvim-ufo.

kevinhwang91 avatar kevinhwang91 commented on August 22, 2024

what's error msg?

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

what's error msg?

No error message, just scroll_docs causes strange behavior, cmp.scroll_docs() moves my cursor forward one character, and the autocomplete window goes back to its original state

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

I did more testing, and it turns out that the problem has nothing to do with vim.o.foldenable, but with ufo itself!

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

can't reproduce it.

Okay, I'll try to make a minimal configuration. There may be other conflicts.

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

I'm sorry, using ufo and nvim-cmp minimal configuration did not cause the problem. It should be other plugins and ufo that caused the problem, because if I disable ufo, everything works fine.
I will continue testing.

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

In fact, reactive.nvim and ufo have some conflicts, which will cause this problem when they exist at the same time.
I don't know who is the source of the problem.
The minimum configuration is as follows:

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	{
		"rasulomaroff/reactive.nvim",

		config = function()
			require("reactive").setup({
				builtin = {
					cursorline = true,
					cursor = true,
					modemsg = true,
				},
			})
		end,
	},

	{
		"williamboman/mason.nvim",

		config = function()
			require("mason").setup()
		end,
	},
	{
		"WhoIsSethDaniel/mason-tool-installer.nvim",

		config = function()
			require("mason-tool-installer").setup({
				ensure_installed = {
					"lua-language-server",
				},
			})
		end,
	},
	{
		"neovim/nvim-lspconfig",

		config = function()
			require("lspconfig").lua_ls.setup({})
		end,
	},
	{
		"hrsh7th/nvim-cmp",
		dependencies = {
			"hrsh7th/cmp-nvim-lsp",
		},

		config = function()
			local cmp = require("cmp")

			cmp.setup({
				mapping = {
					["<C-u>"] = cmp.mapping(function(fallback)
						if cmp.visible() then
							cmp.select_prev_item()
						else
							fallback()
						end
					end),
					["<C-e>"] = cmp.mapping(function(fallback)
						if cmp.visible() then
							cmp.select_next_item()
						else
							fallback()
						end
					end),

					["<C-h>"] = cmp.mapping(function(fallback)
						if cmp.visible_docs() then
							cmp.scroll_docs(-5)
						else
							fallback()
						end
					end),
					["<C-b>"] = cmp.mapping(function(fallback)
						if cmp.visible_docs() then
							cmp.scroll_docs(5)
						else
							fallback()
						end
					end),
				},
				sources = cmp.config.sources({
					{ name = "nvim_lsp" },
				}),
			})
		end,
	},

	{
		"nvim-treesitter/nvim-treesitter",

		config = function()
			require("nvim-treesitter.configs").setup({
				ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
			})
		end,
	},
	{
		"kevinhwang91/nvim-ufo",
		dependencies = {
			"kevinhwang91/promise-async",
		},

		config = function()
			vim.o.foldcolumn = "1" -- '0' is not bad
			vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
			vim.o.foldlevelstart = 99
			vim.o.foldenable = true

			-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
			vim.keymap.set("n", "zR", require("ufo").openAllFolds)
			vim.keymap.set("n", "zM", require("ufo").closeAllFolds)

			require("ufo").setup({
				provider_selector = function(bufnr, filetype, buftype)
					return { "treesitter", "indent" }
				end,
			})
		end,
	},
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

from nvim-ufo.

kevinhwang91 avatar kevinhwang91 commented on August 22, 2024

The issue is complex. reactive.nvim fires a redraw, and then ufo invokes vim.api.nvim_win_call to make the floating window of nvim-cmp broken.

I'm not sure if there's an issue of vim.api.nvim_set_decoration_provider used by ufo.

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

In which repository do you think this problem would be more simple and elegant to solve? Or should it be solved in conjunction with the reactive.nvim contributors?

from nvim-ufo.

b1nhack avatar b1nhack commented on August 22, 2024

Ha ha ha, let me know if you need any help.

from nvim-ufo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.