denis-shienkov / vscode-qbs

Qbs Tools extension for VSCode
MIT License
24 stars 12 forks source link

Resolve project automatically after changing properties #38

Closed rweickelt closed 1 year ago

rweickelt commented 3 years ago

After saving overridden-properties.json, one has to run the resolve command explicitly. Instead, it would be nice if the project is automatically resolved after saving the override file. So the file needs to be watched somehow.

denis-shienkov commented 3 years ago

It does not work only once, when you have created the overriden-properties file in a time when the .vscode directory does not exists yet (when you open a projectat first time). In other cases it should work...

I will look why it does not work at first time, even if the related bug #40 was fixed.

denis-shienkov commented 3 years ago

I don't know why, but the node.js file watcher does not work in case if the watcher was started before the file directory was created:

    private async subscribeOverriddenPropertiesChanged() {
        this._overriddenPropertiesWatcher?.close();
        const propertiesPath = this.overriddenPropertiesPath();
        this._overriddenPropertiesWatcher = chokidar.watch(propertiesPath, {ignoreInitial: true});
        this._overriddenPropertiesWatcher.on('change', () => { this._onChanged.fire(QbsSettingsEvent.ProjectResolveRequired); });
    }

this subscribe does not emit the change event in that case... Maybe we need to add some workarounds, I don't know.

denis-shienkov commented 1 year ago

Fixed in v2.0.0