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

Strange behavior in c++ when semantic_token_resolution is enabled #1168

Open
2 tasks done
stevalkr opened this issue Feb 7, 2025 · 1 comment
Open
2 tasks done

Strange behavior in c++ when semantic_token_resolution is enabled #1168

stevalkr opened this issue Feb 7, 2025 · 1 comment
Labels
accept Applying a completion item to the buffer bug Something isn't working

Comments

@stevalkr
Copy link

stevalkr commented Feb 7, 2025

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

class Class {
 public:
  void fn(int);
  void fn_a(int);
};

int main() {
  int a;
  auto cc = Class{};
  cc.fn_a(a()); // `()` is auto added after `a`
}

cc.fn(|): accept a doesn't add brackets
c.fn_a(|) (rename cc): accept a doesn't add brackets
cc.fn_a(|): accept a does add brackets

The behavior is strange. If you can’t reproduce the issue, try renaming the variable cc to a longer name.

Disabling the semantic_token_resolution option could resolve this problem.

clangd --version
clangd version 16.0.6
Features: mac
Platform: aarch64-apple-darwin24.2.0
minimal init:
-- Run with `nvim -u repro.lua`

vim.env.LAZY_STDPATH = '.repro'
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()

---@diagnostic disable-next-line: missing-fields
require('lazy.minit').repro({
  spec = {
    {
      'saghen/blink.cmp',
      -- build = 'cargo build --release',
      version = '*',
      opts = {}
    },
    {
      'neovim/nvim-lspconfig',
      config = function()
        local lspconfig = require('lspconfig')
        lspconfig['clangd'].setup({
          capabilities = require('blink.cmp').get_lsp_capabilities(),
        })
      end,
    },
  },
})

Relevant configuration

neovim version

NVIM v0.11.0-dev-1417+g487c48ec86-Homebrew Build type: Release LuaJIT 2.1.1736781742 Run "nvim -V1 -v" for more info

blink.cmp version

b6f11a0

@stevalkr stevalkr added the bug Something isn't working label Feb 7, 2025
@Saghen Saghen added the accept Applying a completion item to the buffer label Feb 7, 2025
@ngpong
Copy link

ngpong commented Feb 11, 2025

I have the same problem and here is some additional information:

  1. i can't quite reproduce it in a clean project, only in project at my work.
  2. the problem is solved when I add a .clangd config file to the project, very strange.
  3. and of course, disabling the semantic_token_resolution config also solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accept Applying a completion item to the buffer bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants