LunarVim icon indicating copy to clipboard operation
LunarVim copied to clipboard

hitting <cr> does not insert second closing parenthesis for two consecutive completions

Open chuan137 opened this issue 2 years ago • 4 comments

Problem description

  1. type fmt.Sprin and hit enter to complete the function Sprintf -> fmt.Sprintf()
  2. type fmt.Spritf(strings.Jo) and hit enter to complete the function Join -> fmt.Sprintf(strings.Join()

It happens only when using <CR>. <C-y> inserts correct number of closing parentheses. Also I have noticed that there is always one less closing parenthesis for multiple completions done by <CR>.

LunarVim version

e6ecece (grafted, HEAD, tag: 1.1.2) Merge branch 'rolling'

Neovim version (>= 0.7)

NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by [email protected]

Operating system/version

macOS 12.3.1

Relevant log output

null-ls: require("null-ls.health").check()
========================================================================
  - INFO: no sources registered

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='tmux'
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 0
  - INFO: Checking stuff
  - WARNING: `focus-events` is not enabled. |'autoread'| may not work.
    - ADVICE:
      - (tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:
          set-option -g focus-events on
  - INFO: $TERM: tmux-256color
  - WARNING: Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
    - ADVICE:
      - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
          set-option -sa terminal-overrides ',XXX:RGB'
      - For older tmux versions use this instead:
          set-option -ga terminal-overrides ',XXX:Tc'

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - WARNING: **java**: not available
  - WARNING: **javac**: not available
  - OK: **python3**: `Python 3.9.12`
  - OK: **node**: `v18.0.0`
  - OK: **Ruby**: `ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]`
  - OK: **Go**: `go version go1.17.6 darwin/arm64`
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
  - OK: **sh**: `Ok`
  - OK: **RubyGem**: `3.0.3.1`
  - OK: **npm**: `8.6.0`
  - OK: **pip3**: `pip 22.0.4 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)`

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.4 (714bfd47a744ab44b904375c177a24c0614ef49c) (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v18.0.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: Apple clang version 13.1.6 (clang-1316.0.21.2.3)
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - yaml           ✓ ✓ ✓ ✓ ✓ 
  - rust           ✓ ✓ ✓ ✓ ✓ 
  - json           ✓ ✓ ✓ ✓ . 
  - java           ✓ ✓ . ✓ ✓ 
  - css            ✓ . ✓ ✓ ✓ 
  - lua            ✓ ✓ ✓ ✓ ✓ 
  - c              ✓ ✓ ✓ ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ ✓ 
  - go             ✓ ✓ ✓ ✓ ✓ 
  - typescript     ✓ ✓ ✓ ✓ ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - tsx            ✓ ✓ ✓ ✓ ✓ 
  - python         ✓ ✓ ✓ ✓ ✓ 

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /opt/homebrew/bin/python3
  - INFO: Other python executable: /usr/bin/python3
  - INFO: Python version: 3.9.12
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.
      - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim

## Node.js provider (optional)
  - INFO: Node.js: v18.0.0
  - INFO: Nvim node.js host: /opt/homebrew/lib/node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn package is installed: 4.10.1

## Perl provider (optional)
  - WARNING: "Neovim::Ext" cpan module is not installed
    - ADVICE:
      - See :help |provider-perl| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.3.2

## ===== Installed extensions =====

## Telescope Extension: `fzf`
  - INFO: No healthcheck provided

## Telescope Extension: `notify`
  - INFO: No healthcheck provided

## Telescope Extension: `projects`
  - INFO: No healthcheck provided

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /Users/xxx/.cache/nvim/lsp.log
  - INFO: Log size: 1359 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 14
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for css: ABI version 13
  - OK: Loaded parser for go: ABI version 13
  - OK: Loaded parser for java: ABI version 13
  - OK: Loaded parser for javascript: ABI version 13
  - OK: Loaded parser for json: ABI version 13
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for python: ABI version 13
  - OK: Loaded parser for rust: ABI version 13
  - OK: Loaded parser for tsx: ABI version 13
  - OK: Loaded parser for typescript: ABI version 13
  - OK: Loaded parser for yaml: ABI version 13

which_key: health#which_key#check
========================================================================
## WhichKey: checking conflicting keymaps
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"gc"**
  - INFO: rhs: `<Cmd>lua require("Comment.api").call("toggle_linewise_op")<CR>g@`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"gb"**
  - INFO: rhs: `<Cmd>lua require("Comment.api").call("toggle_blockwise_op")<CR>g@`

Screenshots

No response

chuan137 avatar Apr 30 '22 10:04 chuan137

it might be because of how we've mapped <CR> https://github.com/LunarVim/LunarVim/blob/42529e1c4f55824534184ec0658f0eefb328ac3d/lua/lvim/core/cmp.lua#L294-L305

you can change this behavior by adding this to your config

local cmp = require("cmp")
lvim.builtin.cmp.mapping['<CR>'] =cmp.mapping.preset.insert(cmp.mapping.confirm({ select = true }))

abzcoding avatar May 16 '22 14:05 abzcoding

Got the same problem as chuan137. abzcoding's code above fixed it. Thanks!

skyris avatar Jun 17 '22 14:06 skyris

It is not only that CR removes the last ), it seems to consume whatever is on the right side of the cursor. Take a look at the following video:

https://user-images.githubusercontent.com/2270425/187661442-8eef4dc8-ecda-407c-8bfe-8598ced558b8.mov

As opposed to what @abzcoding suggested, I don't want to remove the ability to do luasnip jump. The current CR mapping is a bit messy, probably needs a big refactor, maybe do less things

danielo515 avatar Aug 31 '22 10:08 danielo515

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 16 '22 02:10 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Oct 31 '22 02:10 github-actions[bot]