From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80CFDC54FB9 for ; Tue, 21 Nov 2023 08:46:48 +0000 (UTC) Subject: Re: [PATCH] vscode: add minimal configuration To: openembedded-core@lists.openembedded.org From: "Enguerrand de Ribaucourt" X-Originating-Location: FR (80.15.101.118) X-Originating-Platform: Linux Firefox 119 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 21 Nov 2023 00:46:48 -0800 References: <20231120145702.53016-1-adrian.freihofer@siemens.com> In-Reply-To: <20231120145702.53016-1-adrian.freihofer@siemens.com> Message-ID: <31313.1700556408119001067@lists.openembedded.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Nov 2023 08:46:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/190957 Hello Adrian, It's a nice idea to have VSCode settings for users who want to edit poky fo= r 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 yourse= lf if you wish https://github.com/yoctoproject/vscode-bitbake/blob/staging/= client/README.md A few suggestions follow. Best Regards, > > 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. >=20 > 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. >=20 > 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. >=20 > 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.=20 >=20 > Signed-off-by: Adrian Freihofer > --- > .gitignore | 2 ++ > .vscode/settings.json | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+) > create mode 100644 .vscode/settings.json >=20 > diff --git a/.gitignore b/.gitignore > index 8f48d452da..f6ce090b5f 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -36,3 +36,5 @@ _toaster_clones/ > downloads/ > sstate-cache/ > toaster.sqlite > +.vscode/ > +vscode-bitbake-build/ > diff --git a/.vscode/settings.json b/.vscode/settings.json > new file mode 100644 > index 0000000000..517a86d1bf > --- /dev/null > +++ b/.vscode/settings.json > @@ -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-bit= bake extension? However the newer versions will have a configurable build d= irectory. Usually, users will probably use the default build directory crea= ted by oe-init-build-env which is just `build`. I suggest to rather ignore = that one? > + "**/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.e= xclude settings would remove all the build tree from the explorer so it wou= ld break my use case. The build directory does not take a lot of space eith= er 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 extens= ion constantly parsing every .c file in the build tree. The files.exclude s= etting 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 settin= g. 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 c= alled. > + }, > + "python.analysis.exclude": [ > + "**/.git/**", > + "**/cache/**", > + "**/tmp*/**", > + "**/downloads/**", > + "**/sstate-cache/**", > + "**/vscode-bitbake-build/**", You could also consider using the default build directory name here. > + "**/workspace/sources/**", > + "**/workspace/attic/**" > + ] > +} There are also problems when opening poky's python library files. The impor= ts (bb, oe, d, ...) and paths are not properly set up with the default pyth= on extension's settings. However we should address this in the future throu= gh the vscode-bitbake extension since we already do it for embedded python = inside .bb files. > --=20 > 2.41.0 >=20 >