Comments (6)
Hello, can you give a sample code that can reproduce this issue?
from coc-clangd.
This was mostly fixed by neoclide/coc.nvim@bf09260, I hadn't synced.
I believe the new implementation provides the word touching the cursor, which should be correct in most cases.
It will still give less-than-ideal behavior in some cases, e.g. foo*bar
with the cursor on *
will select [foo]*bar
I believe. I think the ideal thing (and what VSCode does) is to provide the empty range foo[]*bar
. In this case clangd will try foo[*]bar
and fo[o]*bar
and use the first one that gives a usable result.
from coc-clangd.
OK, reproducer (pass -hidden-features
to clangd).
int foo, bar, baz = foo*bar;
- with cursor on
o
--> selectsfoo
--> "Dump DeclRefExpr AST" shows "foo" 👍 - with cursor on
*
--> selects the whole line --> no code action 👎 - should show "Dump BinaryOperator AST" - with cursor on
b
--> selectsbar
--> "Dump DeclRefExpr AST" shows "bar" 👍
from coc-clangd.
Your second case, with cursor on *
, call CocActionAsync('codeAction','')
shows Dump TranslationUnitDecl AST
, does this expected?
from coc-clangd.
(Sorry for delay)
No, it's not expected - behaviour ("Dump TranslationUnitDecl" vs no code action offered) might vary with versions of clangd, but coc is sending the whole line range here instead of the cursor location. We want to see "Dump BinaryOperator" which is the thing under the cursor.
I'm not sure how high-priority this is, really - it's pretty confusing when trying to use the "dump selection tree" action to debug clangd, but our actual refactorings probably aren't terribly sensitive to it.
from coc-clangd.
cursor on * --> selects the whole line --> no code action 👎 - should show "Dump BinaryOperator AST"
Test with latest coc.nvim, and clangd-11, code action on *
shows Dump BinaryOperator AST
.
from coc-clangd.
Related Issues (20)
- Refactoring Features HOT 2
- stdint.h Library error HOT 1
- Question: navigate to conflicting item/item causing error? HOT 4
- clangd don't start on windows HOT 1
- Unable to locate C/C++ header files (stdio.h, etc.) HOT 1
- coc-clangd still use c++03 to diagnose HOT 1
- some error flag but the code can running HOT 1
- How do I remove the automatically added parameter label in parentheses? HOT 1
- An issue of including libraries HOT 9
- Duplicate references HOT 2
- Command CocCommand clangd.install fails with error 'Failed to install clangd language server' HOT 5
- 这个插件如何在补全头文件比如#include<iostream>时,光标在>的右边,否则每次都多跳过这个符号一次 HOT 1
- [coc.nvim] Connection to server got closed. Server will not be restarted. HOT 4
- 'iostream' file not found (clang pp_file_not_found) HOT 1
- Connection to server got closed HOT 1
- coc-clangd没有输入头文件的情况下也能补全 HOT 4
- Header file not found, even though autocompletion works and include path is added correctly HOT 5
- MinGW issue HOT 1
- MinGW issue
- It can support like [c-mantic] feature? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coc-clangd.