formulahendry / formulahendry/vscode-code-runner
[Feature request] Support compile&link flags in comments
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 351
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
When use code runner with c/cpp codes, we need to add various compile/link flags for third-party libraries. Even though we could add all *potentially* needed libraries in `code-runner.executorMap.cpp` as an all-in-one solution, but it's too ugly and not portable across machines.
**Describe the solution you'd like**
Consider we have code like this:
```cpp
// vscode-runner: -std=c++11 -I/opt/fmt/include -L/opt/fmt/lib -lfmt
#include
int main() {
fmt::print("hello world\n");
return 0;
}
```
We could extract compile command flags from special comments `^\/\/\s*vscode-runner:\s*(.*)$`, instead of modify settings.json.
And then the default config of `code-runner.executorMap.cpp` would be `"cpp": "cd $dir && gcc $commentFlags $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.