notskm / vscode-clang-tidy

MIT License
49 stars 25 forks source link

Config option "Build Path" passes double quote as argument #24

Closed RuijieYu closed 4 years ago

RuijieYu commented 4 years ago

I have a cmake project that has a build directory, and added build as the Build Path. Inside the output I see that the plugin runs clang-tidy with -p="build" with the quotation marks, and from the look of it, clang-tidy sees the quotation marks and is therefore unable to find a directory named "build". If I run the same line in terminal, it would generate a set of fixes in standard out; however the plugin output produces errors. Plugin output:

> clang-tidy /path/to/project/src/history.cpp --export-fixes=- -p="build"
Working Directory: /path/to/project
/path/to/project/src/history.cpp:1:10: error: 'history.hpp' file not found [clang-diagnostic-error]
#include "history.hpp"
         ^
---
MainSourceFile:  '/path/to/project/src/history.cpp'
Diagnostics:
  - DiagnosticName:  clang-diagnostic-error
    DiagnosticMessage:
      Message:         '''history.hpp'' file not found'
      FilePath:        '/path/to/project/src/history.cpp'
      FileOffset:      9
      Replacements:    []
...

Error while trying to load a compilation database:
Could not auto-detect compilation database from directory ""build""
No compilation database found in /path/to/project/"build" or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
1 error generated.
Error while processing /path/to/project/src/history.cpp.
Found compiler error(s).
notskm commented 4 years ago

This has already been fixed. It'll be in the next release.

RuijieYu commented 4 years ago

Yes I was looking at the commits and saw 8688d7d99a2d2872b2a91ff3dcb2dd6f0a44b568. I will be looking forward to the next release. Thanks.

frkd-dev commented 4 years ago

It would be great to release a new version with this fix since this bug makes extension nearly unusable as far as clang heavily relies on compiling_commands database from the build directory.