Coder Social home page Coder Social logo

denops-popup-preview.vim's Introduction

denops-popup-preview.vim

Show completion documentation

simplescreenrecorder-2021-10-07_00.32.13.mp4

features

  • works in both Vim and Neovim
  • support pum.vim
  • integration with other plugins
    • lsp documentation
    • vsnip snippets
    • ultisnips snippets
    • info data of Vim completion item

If you want to add integration with other plugins, please create issue and let me know.

Required

denops.vim

https://github.com/vim-denops/denops.vim

Install

Use your favorite plugin manager.

Configuration

For detail, please see help.

call popup_preview#enable()

denops-popup-preview.vim's People

Contributors

arrow2nd avatar matsui54 avatar milly avatar shougo avatar tani avatar uga-rosa avatar water-sucks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

denops-popup-preview.vim's Issues

window misalignment when using noice plugin

Problems summary

when I use this plugin with noice.vim, noice's completion window and this plugin window are not displayed well.

minimal init.vim/vimrc without plugin managers and other settings

here is minimum configuration.

set rtp+=path/to/folke/noice.nvim
set rtp+=path/to/MunifTanjim/nui.nvim
set rtp+=path/to/Shougo/ddc.vim
set rtp+=path/to/Shougo/ddc-ui-native
set rtp+=path/to/hrsh7th/vim-vsnip
set rtp+=path/to/hrsh7th/vim-vsnip-integ
set rtp+=path/to/matsui54/denops-popup-preview.vim
set rtp+=path/to/vim-denops/denops.vim

let s:ddc_config_json =<< trim MARK
	{
		"ui": "native",
		"sources": ["vsnip"]
	}
MARK
let s:ddc_config_json = s:ddc_config_json->join('')->json_decode()
call ddc#custom#patch_global(s:ddc_config_json)
call ddc#enable()

call popup_preview#enable()

lua  << EOF
require('noice').setup {}
EOF

and ~/.vsnip/global.json

{
  "hoge": {
    "prefix": ["hoge"],
    "body": [
      "class $1 ${2:extends ${3:Parent} }{",
      "\tconstructor() {",
      "\t\t$0",
      "\t}",
      "}"
    ],
    "description": "hoge"
  },
  "piyo": {
    "prefix": ["hoge_piyo"],
    "body": [
      "class $1 ${2:extends ${3:Parent} }{",
      "\tconstructor() {",
      "\t\t$0",
      "\t}",
      "}"
    ],
    "description": "piyo"
  }
}

Screenshot (if possible)

image

popup preview breaks undo state

When the popup preview is shown, an undo point is created. i.e., undo state is broken.
I use ddc-ui-pum with the use_complete option enabled so that keeps undo state.

steps to reproduce

  1. show completion popup
  2. press <C-n> several times to select items
  3. press <Esc> to exit insert mode
  4. u to undo shows the previously completed item.

versions

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

deno 1.34.1

pum.vim auto close and popup preview window automatically fills the tab

When I use denops-popup-preview.vim with nvim-lsp, it always dump when I select a lsp completion item.

Like this(a go project, similiarly for other language project ):

preivew-2022-06-12_22.04.53.mp4

neovim version:

~
❯ nvim --version
NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/builddir/build/BUILD/neovim-0.7.0/redhat-linux-build/config -I/builddir/build/BUILD/neovim-0.7.0/src -I/usr/include -I/usr/include/luajit-2.1 -I/builddir/build/BUILD/neovim-0.7.0/redhat-linux-build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.7.0/redhat-linux-build/include
编译者 mockbuild@koji

Features: +acl +iconv +tui
See ":help feature-compile"

     系统 vimrc 文件: "$VIM/sysinit.vim"
         $VIM 预设值: "/usr/share/nvim"

Run :checkhealth for more info
-- package manger list
use({
	"Shougo/ddc.vim",
	requires = {
		"vim-denops/denops.vim",
		"Shougo/ddc-nvim-lsp",
		"~/git/ddc-nvim-lsp-sort",
		"Shougo/ddc-matcher_head",
		"Shougo/ddc-sorter_rank",
		"Shougo/ddc-around",
		"matsui54/denops-popup-preview.vim",
		"matsui54/denops-signature_help",
		"Shougo/pum.vim",
		"tani/ddc-fuzzy",
		"hrsh7th/vim-vsnip-integ",
		"hrsh7th/vim-vsnip",
		"delphinus/ddc-treesitter",
		"matsui54/ddc-buffer",
		"ippachi/ddc-yank",
		"LumaKernel/ddc-file",
		"windwp/nvim-autopairs",
		"tani/ddc-onp",
	},
	config = function()
		require(_G.p("modules.ddc"))
	end,
})

-- ddc.lua
vim.o.completeopt = "menu,noinsert"
vim.g.vsnip_snippet_dir = vim.fn["stdpath"]("config") .. "/vsnip"
-- font link: https://github.com/microsoft/vscode-codicons/raw/main/dist/codicon.ttf
vim.call("ddc#custom#patch_global", {
	sources = { "file", "vsnip", "nvim-lsp", "around", "buffer", "yank" },
	sourceOptions = {
		["_"] = {
			matchers = { "matcher_fuzzy" },
			sorters = { "sorter_fuzzy", "sorter_lsp" },
			converters = { "converter_fuzzy" },
			-- matchers = { "matcher_head" },
			-- sorters = { "sorter_rank", "sorter_onp", "sorter_lsp" },
		},
		["nvim-lsp"] = {
			mark = "「LSP」",
			maxCandidates = 15,
			minAutoCompleteLength = 1,
			forceCompletionPattern = [[\.|:|->]],
			dup = true,
			ignoreCase = true,
		},
		around = {
			mark = "「AROUND」",
		},
		buffer = {
			mark = "「BUFFER」",
			-- limitBytes = 50,
		},
		vsnip = {
			mark = "「VSNIP」",
		},
		file = {
			mark = "「FILE」",
			forceCompletionPattern = "\\S/\\S*",
		},
		yank = {
			mark = "「YANK」",
		},
	},
	sourceParams = {
		["nvim-lsp"] = {
			kindLabels = {
				-- Text = "  ",
				-- Method = "  ",
				-- Function = "  ",
				-- Constructor = "  ",
				-- Field = "  ",
				-- Variable = "  ",
				-- Class = "  ",
				-- Interface = "  ",
				-- Module = "  ",
				-- Property = "  ",
				-- Unit = "  ",
				-- Value = "  ",
				-- Enum = "  ",
				-- Keyword = "  ",
				-- Snippet = "  ",
				-- Color = "  ",
				-- File = "  ",
				-- Reference = "  ",
				-- Folder = "  ",
				-- EnumMember = "  ",
				-- Constant = "  ",
				-- Struct = "  ",
				-- Event = "  ",
				-- Operator = "  ",
				-- TypeParameter = "  ",
			},
		},
		file = {
			displayFile = "",
			displayDir = "",
		},
	},
	completionMenu = "pum.vim",
	backspaceCompletion = true,
})

vim.call("popup_preview#enable")
vim.call("signature_help#enable")
vim.call("ddc#enable")
vim.call("pum#set_option", "setline_insert", false)

local npairs = require("nvim-autopairs")
npairs.setup({ map_bs = false, map_cr = false })
vim.keymap.set("i", "<tab>", function()
	if vim.fn["pum#visible"]() ~= 0 then
		vim.call("pum#map#insert_relative", 1)
		return
	elseif vim.fn["vsnip#available"](1) == 1 then
		return "<Plug>(vsnip-expand-or-jump)"
	else
		return "<TAB>"
	end
end, { expr = true, noremap = true })

vim.keymap.set("i", "<CR>", function()
	if vim.fn["pum#visible"]() ~= 0 then
		vim.call("pum#map#confirm")
		return
	else
		-- return "<CR>"
		return npairs.autopairs_cr()
	end
end, { expr = true })

vim.cmd([[
  inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>
  inoremap <C-n>   <Cmd>call pum#map#select_relative(+1)<CR>
  inoremap <C-p>   <Cmd>call pum#map#select_relative(-1)<CR>
  inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>
  inoremap <C-e>   <Cmd>call pum#map#cancel()<CR>
]])

vim.cmd([[autocmd User PumCompleteDone call vsnip_integ#on_complete_done(g:pum#completed_item)]])

Popup overlaps pum window when enabling border option on pum.vim

Problem

Popup overlaps pum window when enabling border option on pum.vim.

Screenshot_20220614_062741

Options

Enable pum.vim border.

call pum#set_option({ 'border': 'single' })

Environments

Thanks for great plugin!

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.