Giter Site home page Giter Site logo

Comments (6)

fannheyward avatar fannheyward commented on June 12, 2024

Hello, can you give a sample code that can reproduce this issue?

from coc-clangd.

sam-mccall avatar sam-mccall commented on June 12, 2024

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.

sam-mccall avatar sam-mccall commented on June 12, 2024

OK, reproducer (pass -hidden-features to clangd).

int foo, bar, baz = foo*bar;

  • with cursor on o --> selects foo --> "Dump DeclRefExpr AST" shows "foo" 👍
  • with cursor on * --> selects the whole line --> no code action 👎 - should show "Dump BinaryOperator AST"
  • with cursor on b --> selects bar --> "Dump DeclRefExpr AST" shows "bar" 👍

from coc-clangd.

fannheyward avatar fannheyward commented on June 12, 2024

Your second case, with cursor on *, call CocActionAsync('codeAction','') shows Dump TranslationUnitDecl AST, does this expected?

from coc-clangd.

sam-mccall avatar sam-mccall commented on June 12, 2024

(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.

fannheyward avatar fannheyward commented on June 12, 2024

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)

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.