Giter Site home page Giter Site logo

Comments (3)

kadircet avatar kadircet commented on June 12, 2024

you need to check clangd logs, which can be done through :CocInfo. you should see a log line of the form: Loaded compilation database from xxx. Whenever clangd loads a compilation database.

Also you can look for a log line of the form Updating xxx with comand xxx to see what compile commands clangd is using for a file.

What if both compile_commands.json and compile_flags.txt are on the same directory. Which one is used?

compile_flags.txt will take precedence.

What if compile_commands.json is on src directory and compile_flags.txt in foo2? Since it starts searching the parent directories I assume it will find compile_commands.json first and stop searching any more.

We search by going up, so assuming the structure of foo1/foo2/foo3/src and a file inside src/ directory, we'll make use of the compilation database in src and stop the search.

What if compile_commands.json is on src directory and compile_flags.txt in foo2 but compile_commands is invalid? Is it skipped and the compile_flags.txt in foo2 is used?

it depends on your definition of invalid, as long as the file has valid json contents we'll use it. even if the compile commands don't make sense for clang.

from coc-clangd.

gbihtas avatar gbihtas commented on June 12, 2024

@kadircet

Thank you for your reply

  • What I mean by "invalid compile_commands.json" is sth like the example I provided.

[
adfgadgadfadgasdgadga <<<--- INVALID ENTRY. JSON NO LONGER VALID
{ "directory": "/home/user/llvm/build",
"command": "/usr/bin/clang++ -Irelative -DSOMEDEF="With spaces, quotes and \-es." -c -o file.o file.cc",
"file": "file.cc" },
...
]

I was trying to get an error message so I was breaking the json.

  • I wasn't able to find the "Loaded compilation database" string but I could find the command from the complile_commands.json e.g. /usr/bin/c++ --driver-mode=g++ -o CMakeFiles/test.dir/solution.cpp.o -c

  • Moreover I could find a "Failed to find compilation database" message if a complile_commands.json was not present or was invalid and no "compile_flags.txt" was available as well.

  • I could also find the flags from compile_flags.txt when complile_commands.json was not present.

from coc-clangd.

kadircet avatar kadircet commented on June 12, 2024

I wasn't able to find the Loaded compilation database string

Ah, you are right this was introduced right after the branch cut. So it didn't make into clangd-10. You would need to use a weekly build for it, or build from source directly. Weekly builds of clangd can be found at https://github.com/clangd/clangd/releases

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.