devtool: ide: vscode: Configure read-only files

When debugging or browsing files, the user may fall into external
sources from other packages in the sysroot or dbg-rootfs. Modifying them
will only lead to confusion since they will be overwritten by Yocto. The
user should open them in a separate devtool modify session if they want
to make changes. Meanwhile, we should prevent write access to them.

(From OE-Core rev: 8a95ad9aecb81732c865e00a987bb8bd3d6cb91d)

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Enguerrand de Ribaucourt 2024-02-19 17:55:23 +01:00 committed by Richard Purdie
parent 8e84fbba72
commit c0d340c52e

View File

@ -125,7 +125,7 @@ class IdeVSCode(IdeBase):
settings_dict["cmake.configureOnOpen"] = True
settings_dict["cmake.sourceDirectory"] = modified_recipe.real_srctree
def vscode_settings(self, modified_recipe):
def vscode_settings(self, modified_recipe, image_recipe):
files_excludes = {
"**/.git/**": True,
"**/oe-logs/**": True,
@ -138,9 +138,16 @@ class IdeVSCode(IdeBase):
"**/oe-workdir/**",
"**/source-date-epoch/**"
]
files_readonly = {
modified_recipe.recipe_sysroot + '/**': True,
modified_recipe.recipe_sysroot_native + '/**': True,
}
if image_recipe.rootfs_dbg is not None:
files_readonly[image_recipe.rootfs_dbg + '/**'] = True
settings_dict = {
"files.watcherExclude": files_excludes,
"files.exclude": files_excludes,
"files.readonlyInclude": files_readonly,
"python.analysis.exclude": python_exclude
}
self.__vscode_settings_cmake(settings_dict, modified_recipe)
@ -424,7 +431,7 @@ class IdeVSCode(IdeBase):
self.vscode_tasks_fallback(args, modified_recipe)
def setup_modified_recipe(self, args, image_recipe, modified_recipe):
self.vscode_settings(modified_recipe)
self.vscode_settings(modified_recipe, image_recipe)
self.vscode_extensions(modified_recipe)
self.vscode_c_cpp_properties(modified_recipe)
if args.target: