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

[Bug]: incorrect key for c++ #81

Open
daniilrozanov opened this issue Apr 4, 2024 · 3 comments
Open

[Bug]: incorrect key for c++ #81

daniilrozanov opened this issue Apr 4, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@daniilrozanov
Copy link

daniilrozanov commented Apr 4, 2024

Bug Description

In line

std::string c = "afaf";

vik command selects only string c, ignoring std::.

I am using defaut configuration of plugin from README.

neovim version

0.9.5
@daniilrozanov daniilrozanov added the bug Something isn't working label Apr 4, 2024
@b0ae989c
Copy link

b0ae989c commented Jun 4, 2024

This is expected. The key object matches one word in front of : or =.
See

---@param scope "inner"|"outer" outer key includes the `:` or `=` after the key
function M.key(scope)
local pattern = "()%S.-( ?[:=] ?)"
M.selectTextobj(pattern, scope, config.lookForwardSmall)
end

@chrisgrieser
Copy link
Owner

Indeed, the behavior is expected. I don't know any C, so I am not familiar with how the pattern has to be adapted to make it work correctly there - any PRs welcome.

@b0ae989c
Copy link

b0ae989c commented Jun 9, 2024

C and C++ don't have the key/value syntax. The :: in that snippet is a scope resolution operator, and std::string s = "abc"; is a copy initialization of the variable s. This is not a key/value pair. Should close.

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

No branches or pull requests

3 participants