Skip to content

try to ignore history on editor open for quicksearch - #204880

Merged
Andrea Mah (andreamah) merged 4 commits into
mainfrom
grumpy-beaver
Feb 13, 2024
Merged

Andrea Mah (andreamah) merged 4 commits into
mainfrom
grumpy-beaver

Conversation

@andreamah

@andreamah Andrea Mah (andreamah) commented Feb 10, 2024 •

Copy link
Copy Markdown
Contributor

@andreamah Andrea Mah (andreamah) changed the title try to ignore history on editor open try to ignore history on editor open for quicksearch Feb 13, 2024
@andreamah
Andrea Mah (andreamah) marked this pull request as ready for review February 13, 2024 18:27
@vscodenpa VS Code Bot (vscodenpa) added this to the February 2024 milestone Feb 13, 2024
@andreamah
Andrea Mah (andreamah) merged commit da8f671 into main Feb 13, 2024
@andreamah
Andrea Mah (andreamah) deleted the grumpy-beaver branch February 13, 2024 19:22
@bpasero

Benjamin Pasero (bpasero) commented Feb 14, 2024 •

Copy link
Copy Markdown
Contributor

Andrea Mah (@andreamah) sorry for the late response, I should have been the reviewer here, can you add me for future PRs in this area? I will post a follow up PR with some cleanup and thoughts. Thanks!

export class TestHistoryService implements IHistoryService {

declare readonly _serviceBrand: undefined;
declare shouldIgnoreActiveEditorChange: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is not very safe, this would not actually put the property on the class as far as I know but just declare it as type to be there.

export class TestHistoryService implements IHistoryService {

declare readonly _serviceBrand: undefined;
declare shouldIgnoreActiveEditorChange: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

...same here

this.editorSequencer.queue(async () => {
// disable and re-enable history service so that we can ignore this history entry
this._historyService.shouldIgnoreActiveEditorChange = true;
await this._editorService.openEditor({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opening an editor can fail with an error thrown and so this would leave the history in ignore-mode, without ever setting it back. At least a try/finally is needed.

@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quick Search should omit history

4 participants