]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
devtool: ide: vscode: Configure read-only files
authorEnguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Mon, 19 Feb 2024 16:55:23 +0000 (17:55 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 20 Feb 2024 12:58:20 +0000 (12:58 +0000)
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.

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/ide_plugins/ide_code.py

index b2193130d2e9fc4d40f5eddc735851738f9d0a83..f44665ed8729bda25e7c320506015c047d854664 100644 (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: