vscode: add minimal configuration
PATCH 1/1 vscode: add minimal configuration
It is essential to configure VSCode indexer plugins to ignore the build folder of bitbake. Otherwise, the indexer plugins run with 100% CPU load until an OOM exception occurs. In practice, this makes VSCode more or less unusable for working with Yocto until a file like the one added by this commit is deployed before VSCode starts. From the user's point of view, it is not obvious why the system runs at 100% CPU load and eventually crashes.
It is even more misleading that VSCode starts the indexers immediately, but does not stop or reconfigure them when the ignore list is updated. In practice, this means that every time the ignore list is changed, VSCode immediately starts indexing the build folder until the OOM exception stops it. Depending on the system's OOM handler, the entire build machine may crash.
Particularly annoying is the Python plugin that ignores the general ignore list and requires an extra ignore section.
The settings are suitable for workflows like bitbake, devtool modify, devtool reset. The settings are not intended to work on the source code of a recipe. It is assumed that a separate instance of VSCode is used per workspace folder. These per workspace instances can have different settings depending on the details of the sources that come with the recipe.
VSCode can change the contents of the .vscode folder, which often leads to a dirty git status. Normally, these changes are not added to git. Otherwise, -f can be used to add them explicitly. It is not perfect if the folder is listed in .gitignore. But it is also not better if it is not.
--- .gitignore | 2 ++ .vscode/settings.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .vscode/settings.json
.gitignore +2 -0
@@ -36,3 +36,5 @@ _toaster_clones/ downloads/ sstate-cache/ toaster.sqlite +.vscode/ +vscode-bitbake-build/
.vscode/settings.json new file +32 -0
@@ -0,0 +1,32 @@ +{ + "files.watcherExclude": { + "**/.git/**": true, + "**/cache/**": true, + "**/tmp*/**": true, + "**/downloads/**": true, + "**/sstate-cache/**": true, + "**/vscode-bitbake-build/**": true, + "**/workspace/sources/**": true, + "**/workspace/attic/**": true + }, + "files.exclude": { + "**/.git/**": true, + "**/cache/**": true, + "**/tmp*/**": true, + "**/downloads/**": true, + "**/sstate-cache/**": true, + "**/vscode-bitbake-build/**": true, + "**/workspace/sources/**": true, + "**/workspace/attic/**": true + }, + "python.analysis.exclude": [ + "**/.git/**", + "**/cache/**", + "**/tmp*/**", + "**/downloads/**", + "**/sstate-cache/**", + "**/vscode-bitbake-build/**", + "**/workspace/sources/**", + "**/workspace/attic/**" + ] +}
Signature · 1 line
2.41.0
Hello Adrian,
It's a nice idea to have VSCode settings for users who want to edit poky for the reasons you mention!
I think it would be nice to have such a configuration as a reference in the vscode-bitbake documentation as well. You could event contribute it yourself if you wish https://github.com/yoctoproject/vscode-bitbake/blob/staging/client/README.md
A few suggestions follow.
Best Regards,
Quoted 25 lines
It is essential to configure VSCode indexer plugins to ignore the build folder of bitbake. Otherwise, the indexer plugins run with 100% CPU load until an OOM exception occurs. In practice, this makes VSCode more or less unusable for working with Yocto until a file like the one added by this commit is deployed before VSCode starts. From the user's point of view, it is not obvious why the system runs at 100% CPU load and eventually crashes.
It is even more misleading that VSCode starts the indexers immediately, but does not stop or reconfigure them when the ignore list is updated. In practice, this means that every time the ignore list is changed, VSCode immediately starts indexing the build folder until the OOM exception stops it. Depending on the system's OOM handler, the entire build machine may crash.
Particularly annoying is the Python plugin that ignores the general ignore list and requires an extra ignore section.The settings are suitable for workflows like bitbake, devtool modify, devtool reset. The settings are not intended to work on the source code of a recipe. It is assumed that a separate instance of VSCode is used per workspace folder. These per workspace instances can have different settings depending on the details of the sources that come with the recipe.
Quoted 5 lines
VSCode can change the contents of the .vscode folder, which often leads to a dirty git status. Normally, these changes are not added to git. Otherwise, -f can be used to add them explicitly. It is not perfect if the folder is listed in .gitignore. But it is also not better if it is not.
Yes exactly. However I tend to not have the .vscode in .gitignore since it's actually versioned.
Quoted 24 lines
Signed-off-by Adrian Freihofer <[email protected]>--- .gitignore | 2 ++ .vscode/settings.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .vscode/settings.json.gitignore +2
-0@@ -36,3 +36,5 @@ _toaster_clones/ downloads/ sstate-cache/ toaster.sqlite +.vscode/ +vscode-bitbake-build/.vscode/settings.json new file +0
-0
.vscode/settings.json line 8
Quoted 8 lines
.vscode/settings.json new file +8
-0@@ -0,0 +1,32 @@ +{ + "files.watcherExclude": { + "**/.git/**": true, + "**/cache/**": true, + "**/tmp*/**": true, + "**/downloads/**": true, + "**/sstate-cache/**": true, + "**/vscode-bitbake-build/**": true,
vscode-bitbake-build looks to be a build folder generated by the vscode-bitbake extension? However the newer versions will have a configurable build directory. Usually, users will probably use the default build directory created by oe-init-build-env which is just build. I suggest to rather ignore that one?
.vscode/settings.json line 20
Quoted 12 lines
.vscode/settings.json new file +12
-0+ "**/workspace/sources/**": true, + "**/workspace/attic/**": true + }, + "files.exclude": { + "**/.git/**": true, + "**/cache/**": true, + "**/tmp*/**": true, + "**/downloads/**": true, + "**/sstate-cache/**": true, + "**/vscode-bitbake-build/**": true, + "**/workspace/sources/**": true, + "**/workspace/attic/**": true
I personally like to browse into the build tree through VSCode. The files.exclude settings would remove all the build tree from the explorer so it would break my use case. The build directory does not take a lot of space either so I don't think your point is to hide it, but rather you are doing that to reduce CPU usage. In my case, the CPU usage comes from the c_cpp extension constantly parsing every .c file in the build tree. The files.exclude setting does stop this behavior. However, the alternative I employ for this is to ignore the build tree in the more specific C_Cpp.files.exclude setting. It should have the same effect.
"C_Cpp.files.exclude": {
"**/build": true,
"**/.vscode": true,
"**/.vs": true
},Once again, the build directory name depends on how eo-init-build-env was called.
.vscode/settings.json line 28
Quoted 8 lines
.vscode/settings.json new file +8
-0+ }, + "python.analysis.exclude": [ + "**/.git/**", + "**/cache/**", + "**/tmp*/**", + "**/downloads/**", + "**/sstate-cache/**", + "**/vscode-bitbake-build/**",
You could also consider using the default build directory name here.
.vscode/settings.json line 32
Quoted 4 lines
.vscode/settings.json new file +4
-0+ "**/workspace/sources/**", + "**/workspace/attic/**" + ] +}
There are also problems when opening poky's python library files. The imports (bb, oe, d, ...) and paths are not properly set up with the default python extension's settings. However we should address this in the future through the vscode-bitbake extension since we already do it for embedded python inside .bb files.
Quoted 4 lines
Signature · 1 line
2.41.0