Currently I am trying to write an extension that allows me to dynamically change the workspace filter by adding/removing/modifying entries in the files.exclude
configuration element and storing it in the workspace settings.
Running a command like this, e.g. to modify a string or array based configuration works as intended:
const config = vscode.workspace.getConfiguration();
config.update('editor.fontSize', 14, false); -> works
But I just can't wrap my head around how to modify an object based configuration like files.exclude
.
I tried different approaches but always got an error saying that I am accessing an element that does not exist.
config.update('files.exclude.TestXYZ', false, false); -> doesn't work
config.update('TestXYZ', false, false); -> doesn't work
Hardcoding an object in advance and using this as new value for the configuration works
let settings = { "*.html": true, "*.css": true };
config.update('files.exclude', settings, false); -> works, but isn't what I need
but in order to write a configurable workspace filter I need to add/remove values from the filter list dynamically.
In addition to that (but not as important): I also can't manage to "read" the current values of files.exclude
in a way that I can work with them. I always get a Proxy object and I'm not that of a pro in typescript tbh.
The initial idea was to read the configuration, make my modifications and save it back but after trying for hours I would be OK to overwrite them entirely as long as it works.