'Update user/workspace settings from vs code extension
I am trying to update setting.json from my vs code extension and I want to add below code
"files.associations": {
"*.app": "auraComponent"
}
In other words I want to add below key value pair from extension to the users who are going to install my app
So I tried putting the below code in extension.js but it didn't update the settings.
import { ConfigurationTarget, workspace } from 'vscode';
const configuration = workspace.getConfiguration('files.associations');
configuration.update('.app', 'auraComponent', ConfigurationTarget.Global).then(() => {
// take action here
});
Could someone please suggest if I am using the right approach to update the user or workspace settings and also if the code inside extension.js would be executed automatically or not.
Update
I have added extension.js and included the js code as mentioned by mark in his answer
and update my package.json as below
"main": "./extension",
"activationEvents": [
"*"
],
If I run my extension on debug mode then it works fine but not working in real time.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

