How to hide certain files and folders from the project explorer view

How to override filesystemPreferenceSchema’s files.exclude option (from ‘@theia/filesystem/lib/browser/filesystem-preferences’).

We are trying to implement it through theia extension.

[original thread by asvinwin123]

What do you want to do? Do you want to change the default files.exclude behavior? If so, you can override the default frontend preferences in your application’s package.json. For instance, adding the following to the ./examples/browser/package.json you will get an app which does not show JS/TS files by default.

diff --git a/examples/browser/package.json b/examples/browser/package.json
index c44e0e090..63f8d83c6 100644
--- a/examples/browser/package.json
+++ b/examples/browser/package.json
@@ -8,7 +8,16 @@
       "config": {
         "applicationName": "Theia Browser Example",
         "preferences": {
-          "files.enableTrash": false
+          "files.enableTrash": false,
+          "files.exclude": {
+            "**/.git": true,
+            "**/.svn": true,
+            "**/.hg": true,
+            "**/CVS": true,
+            "**/.DS_Store": true,
+            "**/*.js": true,
+            "**/*.ts": true
+          }

If you want to go further, you have to rebind the FileSystemPreferences in your extension.


That worked … Thank you very much.


Can i have the developer documentation for theia if any available? And may i know about other settings that can be done with package.json?

You can override any default frontend preferences, plus you can set the defaultTheme and the applicationName:


If i change the package.json, whether i need yarn rebuild?


Thanks for spending time to address my queries…

Yes. yarn theia build will make sure to (re-)generate both the frontend and the backend code based on the package.json content.