microsoft / microsoft/vscode-cpptools
Add IntelliSense mode and support for emscripten / web assembly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and version: macOS 12.5
- VS Code: 1.70.2
- C/C++ extension: 1.11.5
- GDB / LLDB version: N/A
Bug Summary and Steps to Reproduce
IntelliSense does not work for Emscripten. C++ Tool will query the default compiler target, but would not recognize it:
Querying compiler's default target using command line: "/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/em++" -dumpmachine
Compiler returned default target value: wasm32-unknown-emscripten
Unhandled default compiler target value detected: wasm32-unknown-emscripten
And then it will go on and query the headers with the wrong target specified (in this case, ARM):
Compiler query command line: /Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/em++ -std=gnu++17 --target=aarch64-arm-none-eabi -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
This would cause Emscripten's clang to use the wrong relative sysroot directory for header search, thus breaking IntelliSense.
tommyli@HOST ~ % em++ -std=gnu++17 --target=aarch64-arm-none-eabi -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
clang -cc1 version 16.0.0 based upon LLVM 16.0.0git default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/usr/local/include"
ignoring nonexistent directory "/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/SDL
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/compat
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/lib/clang/16.0.0/include
End of search list.
Dropping --target would make cm++ finding the sysroot headers correctly:
tommyli@HOST ~ % em++ -std=gnu++17 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
clang -cc1 version 16.0.0 based upon LLVM 16.0.0git default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/SDL
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/compat
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/lib/clang/16.0.0/include
/Users/tommyli/Documents/emscripten-core/emsdk/upstream/emscripten/cache/sysroot/include
Debugger Configurations
N/A
Debugger Logs
N/A
Other Extensions
No response
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the compiler-target query with em++ and compare the header search results with and without --target, as shown in the issue. Trace how the reported wasm32-unknown-emscripten target is handled and verify that IntelliSense recognizes it and queries the correct Emscripten sysroot headers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100