-
Notifications
You must be signed in to change notification settings - Fork 141
Add support for vscode #92
New issue
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
base: master
Are you sure you want to change the base?
Changes from all commits
3971b96
b14a01b
6eb0f92
a15d121
9a92950
947585c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,3 +239,6 @@ _Pvt_Extensions/ | |
| ModelManifest.xml | ||
|
|
||
| .cache/ | ||
|
|
||
| # Visual Studio Code | ||
| .vscode/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
| // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
|
||
| // List of extensions which should be recommended for users of this workspace. | ||
| "recommendations": [ | ||
| "ms-vscode.cmake-tools", // CMake for Debugging C/C++ | ||
| "llvm-vs-code-extensions.vscode-clangd", // Optional intellisense-like features with LLVM/clangd | ||
| "theodevelop.bison-flex-lang", // For flex/bison source files | ||
| ], | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "(lldb) Launch", | ||
| "type": "lldb", | ||
| "request": "launch", | ||
| // Resolved by CMake Tools: | ||
| "program": "${command:cmake.launchTargetPath}", | ||
| // "--header-file=<output_header>", "-o<output_source>", "<input_source>" | ||
| "args": [], | ||
| "cwd": "${workspaceFolder}", | ||
| "terminal": "integrated", | ||
| "stopOnEntry": false, | ||
| // Non-Windows is unnecessary but it helps to ensure PATH correctly | ||
| "env": { | ||
| "PATH": "${env:PATH}:${command:cmake.launchTargetDirectory}" | ||
| }, | ||
| "windows": { | ||
| // Warning: CodeLLDB is still slower than WinDbg (cppvsdbg) in Windows | ||
| // and don't support C++ (string/vector) for MSVC ABI - this codebase is C99 | ||
| "env": { | ||
| "PATH": "${env:PATH};${command:cmake.launchTargetDirectory}" | ||
| } | ||
| }, | ||
| "initCommands": [ | ||
| "settings set target.process.follow-fork-mode parent" | ||
| ] | ||
| }, | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems those settings would best be user-scope, not specific to this workspace.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Workspace is the appropriate place for codebase consistency settings, unless that is something we don't want... First is editor settings, most users have different settings which will make the codebase inconsistent, the proper way to have consistent code is clang-format, but that will format the whole code instead being just limited to the addtional lines introduced by developers; and will probably make it more difficult to sync with upstream. Ruler indicator is just a mindful/useful indicator, I see GNU have an unwritten rule of 80 character line limit, but some codes go up to 120 chars in flex/bison, I'll say this is optional, I can remove this if you don't like to see these lines The git operations are minimal and good to have for new developers, it helps to ensure git pull in vscode don't branch and merge, prune is optional as it helps to cleanup deleted branches in origin just that the code base is not super active at the moment CMake preferred generator won't mess up the system as it only uses Ninja if its installed, although the codebase is small, it approximately halves the compilation time for debugging
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Usually you don't want this, since users will mess with that around and accidentally push private & personal settings / metadata.
It doesn't necessarily format the whole base, you can just configure it to only format modified lines. And it's totally in the scope of the contributing developer.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Febbe ,
Personal settings stay within their user directory
I don't recall
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ve been using
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I know of the extension being able to format by lines, I just couldn't get it to work when I use command line... |
||
| "editor.insertSpaces": true, | ||
| "editor.tabSize": 4, | ||
| "editor.detectIndentation": true, | ||
| "files.trimTrailingWhitespace": true, | ||
| "[markdown]": { | ||
| "files.trimTrailingWhitespace": false, | ||
| }, | ||
| "editor.rulers": [80,120], | ||
| "git.rebaseWhenSync": true, | ||
| "git.pruneOnFetch": true, | ||
| // "cmake.preferredGenerators": ["Ninja Multi-Config"], | ||
| "cmake.generator": "Ninja Multi-Config", | ||
| "cmake.options.statusBarVisibility": "compact", | ||
| "cmake.useCMakePresets": "never", | ||
| "C_Cpp.intelliSenseEngine": "disabled", | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
|
|
||
| # How to setup vscode-like editors for debugging win_flex/win_bison | ||
|
|
||
| Here is a simple guide (based on the [MS documentation](https://code.visualstudio.com/docs/cpp/cmake-linux)): | ||
| 1. Make sure the [Prerequisites](https://code.visualstudio.com/docs/cpp/cmake-linux#_prerequisites) are installed. | ||
| 2. [Select a compiler kit](https://code.visualstudio.com/docs/cpp/cmake-linux#_select-a-kit), any of the native `amd64` version of MSVC is recommended for compatibility - any of the rest with `x86` is cross-compiling a 32-bit version of `win_flex`/`win_bison`. | ||
|
|
||
|  | ||
|
|
||
| NOTE: Click `Scan for kits` when setting up C/C++ debugging for the first time if there is no compiler kits found yet. | ||
|
|
||
| 3. Due to `win_flex`/`win_bison` being separate executables/targets, debugging will need to [select a launch target](https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/debug-launch.md#select-a-launch-target). | ||
|
|
||
|  | ||
|
|
||
| 4. Optionally switch between build types - usually between `Release` or `Debug` builds, make sure `Debug` is selected when debugging or there will be no debug symbols to hit breakpoints. | ||
|
|
||
|  | ||
|
|
||
| 5. Both `win_flex` and `win_bison` requires arguments for the target input/output source files, just add the arguments as how `win_flex` or `win_bison` was called from the command line where each space-separated argument is an element in [.vscode/launch.json](.vscode/launch.json)'s `args` array separated by commas, based on [flex-bison-example](https://github.com/meyerd/flex-bison-example), | ||
| - here is a sample for `win_flex` target: | ||
| ```json | ||
| "args": [ | ||
| "calc.l", | ||
| ], | ||
| ``` | ||
| - here is a sample for `win_bison` target: | ||
| ```json | ||
| "args": [ | ||
| "-d", | ||
| "calc.y", | ||
| ], | ||
| ``` | ||
| - NOTE: This example uses source files without full path was achieved by setting `cwd` | ||
| ```json | ||
| "cwd": "${workspaceFolder}/../flex-bison-example", | ||
| ``` | ||
|
|
||
| 6. Setup the codebase for inspection [debugging](https://code.visualstudio.com/docs/editor/debugging), eg. breakpoints (with `F9`), [logpoints](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#logpoints). | ||
|
|
||
|  | ||
|
|
||
| 7. Hit `F5` to start debugging, or click the `launch` button. | ||
|
|
||
|  | ||
|
|
||
| 8. Here is how it looks like when the program pauses at a breakpoint, refer to the official [Debugging guide](https://code.visualstudio.com/docs/debugtest/debugging#_debugger-user-interface) for more information. | ||
|
|
||
|  |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to ignore a folder we directly add in the same commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a deterrant, changes to this directory will have warnings, and developers will need to force add new files