Message ID | 20240219165525.714512-4-enguerrand.de-ribaucourt@savoirfairelinux.com |
---|---|
State | Accepted, archived |
Commit | 8a95ad9aecb81732c865e00a987bb8bd3d6cb91d |
Headers | show |
Series | devtool: ide: Improve VSCode support | expand |
On Mon, 2024-02-19 at 17:55 +0100, Enguerrand de Ribaucourt wrote: > 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> > --- > scripts/lib/devtool/ide_plugins/ide_code.py | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py > b/scripts/lib/devtool/ide_plugins/ide_code.py > index c063b7d0590..7b683c74086 100644 > --- a/scripts/lib/devtool/ide_plugins/ide_code.py > +++ b/scripts/lib/devtool/ide_plugins/ide_code.py > @@ -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) > @@ -425,7 +432,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: LGTM. Adrian
diff --git a/scripts/lib/devtool/ide_plugins/ide_code.py b/scripts/lib/devtool/ide_plugins/ide_code.py index c063b7d0590..7b683c74086 100644 --- a/scripts/lib/devtool/ide_plugins/ide_code.py +++ b/scripts/lib/devtool/ide_plugins/ide_code.py @@ -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) @@ -425,7 +432,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:
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> --- scripts/lib/devtool/ide_plugins/ide_code.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)