8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
"rust-analyzer.cargo.features": "all"
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
Given compile_commands.json use same lib.c with ALL below three status in order
compile_commands.json
lib.c
without define, is lib mode, output library
define test, is test mode, output binary
define bench, is bench mode, output binary
Actually, vscode show lib.c
lib region code is not gray
test region code is gray!
bench region code is gray!
[ { "directory": "/tmp/repo/build/example/example_add_u64", "command": "/usr/lib/ccache/bin/cc -I/tmp/repo/src/example/example_add_u64/include -o CMakeFiles/example_add_u64__lib.dir/src/lib.c.o -c /tmp/repo/src/example/example_add_u64/src/lib.c", "file": "/tmp/repo/src/example/example_add_u64/src/lib.c", "output": "example/example_add_u64/CMakeFiles/example_add_u64__lib.dir/src/lib.c.o" }, { "directory": "/tmp/repo/build/example/example_add_u64", "command": "/usr/lib/ccache/bin/cc -Dtest -I/tmp/repo/src/example/example_add_u64/include -o CMakeFiles/example_add_u64__lib_test.dir/src/lib.c.o -c /tmp/repo/src/example/example_add_u64/src/lib.c", "file": "/tmp/repo/src/example/example_add_u64/src/lib.c", "output": "example/example_add_u64/CMakeFiles/example_add_u64__lib_test.dir/src/lib.c.o" }, { "directory": "/tmp/repo/build/example/example_add_u64", "command": "/usr/lib/ccache/bin/cc -Dbench -I/tmp/repo/src/example/example_add_u64/include -o CMakeFiles/example_add_u64__lib_bench.dir/src/lib.c.o -c /tmp/repo/src/example/example_add_u64/src/lib.c", "file": "/tmp/repo/src/example/example_add_u64/src/lib.c", "output": "example/example_add_u64/CMakeFiles/example_add_u64__lib_bench.dir/src/lib.c.o" } ]
#include <stdint.h> #include <stdio.h> #include <stdlib.h> uint64_t add_u64(uint64_t left, uint64_t right) { uint64_t ret = left + right; return ret; } // TODO: gray #ifdef test #define TEST_MAIN(F) \ int main(int argc, char *argv[]) { \ (void)argc; \ (void)argv; \ F(); \ return EXIT_SUCCESS; \ } void it_works() { uint64_t result = add_u64(2, 2); if (result != 4) { exit(EXIT_FAILURE); } } TEST_MAIN(it_works) #endif // TODO: gray #ifdef bench #define BENCH_MAIN(F) \ int main(int argc, char *argv[]) { \ (void)argc; \ (void)argv; \ F(); \ return EXIT_SUCCESS; \ } void it_works() { uint64_t result = add_u64(2, 2); if (result != 4) { exit(EXIT_FAILURE); } } BENCH_MAIN(it_works) #endif
Workaround
vscode show lib.c
test region code is not gray
bench region code is gray
[ { "directory": "/tmp/repo/build/example/example_add_u64", "command": "/usr/lib/ccache/bin/cc -Dtest -I/tmp/repo/src/example/example_add_u64/include -o CMakeFiles/example_add_u64__lib_test.dir/src/lib.c.o -c /tmp/repo/src/example/example_add_u64/src/lib.c", "file": "/tmp/repo/src/example/example_add_u64/src/lib.c", "output": "example/example_add_u64/CMakeFiles/example_add_u64__lib_test.dir/src/lib.c.o" }, { "directory": "/tmp/repo/build/example/example_add_u64", "command": "/usr/lib/ccache/bin/cc -Dbench -I/tmp/repo/src/example/example_add_u64/include -o CMakeFiles/example_add_u64__lib_bench.dir/src/lib.c.o -c /tmp/repo/src/example/example_add_u64/src/lib.c", "file": "/tmp/repo/src/example/example_add_u64/src/lib.c", "output": "example/example_add_u64/CMakeFiles/example_add_u64__lib_bench.dir/src/lib.c.o" } ]
#include <stdint.h> #include <stdio.h> #include <stdlib.h> uint64_t add_u64(uint64_t left, uint64_t right) { uint64_t ret = left + right; return ret; } #ifdef test #define TEST_MAIN(F) \ int main(int argc, char *argv[]) { \ (void)argc; \ (void)argv; \ F(); \ return EXIT_SUCCESS; \ } void it_works() { uint64_t result = add_u64(2, 2); if (result != 4) { exit(EXIT_FAILURE); } } TEST_MAIN(it_works) #endif // TODO: gray #ifdef bench #define BENCH_MAIN(F) \ int main(int argc, char *argv[]) { \ (void)argc; \ (void)argv; \ F(); \ return EXIT_SUCCESS; \ } void it_works() { uint64_t result = add_u64(2, 2); if (result != 4) { exit(EXIT_FAILURE); } } BENCH_MAIN(it_works) #endif
rust cargo features should be C define equivalent.
rust
cargo
C
define
cargo have an auto enabled feature named default.
default
Inspired by
"rust-analyzer.cargo.features": "all",
I suggest
When
"C_Cpp.default.compileCommandsDefinesAll": false
UI behavior as same as current
"C_Cpp.default.compileCommandsDefinesAll": true
Expect vscode show lib.c
bench region code is not gray
The text was updated successfully, but these errors were encountered:
rust-analyzer.cargo.features
No branches or pull requests
Feature Request
actual
Given
compile_commands.json
use samelib.c
with ALL below three status in orderwithout define, is lib mode, output library
define test, is test mode, output binary
define bench, is bench mode, output binary
Actually, vscode show
lib.c
lib region code is not gray
test region code is gray!
bench region code is gray!
compile_commands.json
lib.c
workaround
Workaround
compile_commands.json
remove lib mode elementvscode show
lib.c
lib region code is not gray
test region code is not gray
bench region code is gray
compile_commands.json
lib.c
related
rust
cargo
features should beC
define
equivalent.cargo have an auto enabled feature named
default
.Inspired by
feat
I suggest
When
"C_Cpp.default.compileCommandsDefinesAll": false
UI behavior as same as current
When
"C_Cpp.default.compileCommandsDefinesAll": true
Given
compile_commands.json
use samelib.c
with ALL below three status in orderwithout define, is lib mode, output library
define test, is test mode, output binary
define bench, is bench mode, output binary
Expect vscode show
lib.c
lib region code is not gray
test region code is not gray
bench region code is not gray
The text was updated successfully, but these errors were encountered: