Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around issue with getting stale contents from openTextDocument #3545

Merged
merged 5 commits into from
Apr 29, 2019

Conversation

Colengms
Copy link
Contributor

This addresses one of the scenarios discussed in this vscode issue: microsoft/vscode#72831

Using openTextDocument in response to a FileSystemWatcher.onDidChange may result in reading stale (cached) contents, if the file is already opened by vscode. This can be worked around by instead waiting for onDidChangeTextDocument to fire for the file.

@@ -681,11 +699,6 @@ export class CppProperties {
}

let fullPathToFile: string = path.join(this.configFolder, "c_cpp_properties.json");
let filePath: vscode.Uri = vscode.Uri.file(fullPathToFile).with({ scheme: "untitled" });

let document: vscode.TextDocument = await vscode.workspace.openTextDocument(filePath);
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking that this would open and (potentially) focus the file in the editor. Are we doing anything to maintain that behavior with this new approach?

@Colengms Colengms merged commit 110e683 into master Apr 29, 2019
@Colengms Colengms deleted the coleng/changeNotificationIssue branch April 29, 2019 22:17
@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
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.

4 participants