Skip to content
Prev Previous commit
Next Next commit
Recompute when changing settings
  • Loading branch information
rchiodo committed Apr 13, 2020
commit 6c87fb178c6042bb06c890f9a398cf2aa270b0c1
3 changes: 3 additions & 0 deletions src/client/datascience/editor-integration/codeLensFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList
private onChangedSettings() {
// When config settings change, refresh our code lenses.
this.codeLensCache.clear();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's on any settings change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is that .affectConfiguration function we should be using here. Or else we are clearing these out too much.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No there isn't. Not on the config settings. That's on the workspaceConfiguration.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the worst case is that the code lens are regenerated whenever you change your python settings. Meh.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see where the configSettings uses that 'affectsConfiguration' in the configSettings.ts file (line 571 or so). It will only fire an onDidChangeSettings when the python settings change.


In reply to: 407782405 [](ancestors = 407782405)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably recompute the code lenses though. Otherwise the next execution will recompute them all.


In reply to: 407782955 [](ancestors = 407782955,407782405)


// Force an update so that code lenses are recomputed now and not during execution.
this.updateEvent.fire();
}

private enumerateCommands(resource: Resource): string[] {
Expand Down