Clean headers and add a working wsl/linux configuration for vscode #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current Visual Studio Code configuration appears to be trying to make the IntelliSense work by hacking the MSVC compiler to parse the Cosmopolitan headers. This only works (to whatever degree it does) when running VS Code on Windows, but it doesn't work when you are using VS Code on Linux, or using the remote VS Code server on a WSL installation.
I have updated the existing config to be called
Win32
, which means it will still be selected by default on Windows, and added a secondLinux
configuration which uses the included compiler to determine the IntelliSense settings (behind the scenes it does${compilerPath} ${compilerArgs} -Wp,-v -E -dD -x c -m64 /dev/null
or clang/MSVC equivalent to figure out the defines). I'm not sure if I got all the right CFLAGS out of the box, but this seems to be something similar to what defaultmake
mode uses.It might make non-WSL Windows users lives a bit easier if we had a configuration mode with all the correct switches set up for the
cross9.zip
from https://justine.lol/cosmopolitan/windows-compiling.html but I haven't tried to compile like that yet so can't test it. Update I have downloaded the cross9 gcc and it works perfectly. See: alisonatwork@5de17ffOne quirk: you need to run the
make
once through to set up the links for the bundled C compiler before starting VS Code, or it won't be able to find the compiler, and then it just falls back to some kind of 32-bit safe mode with no defines at all.I also cleaned up some duplicate and unused defines while I was here.
CC: @nicholatian - this is a follow-up to your #40 PR