-
Notifications
You must be signed in to change notification settings - Fork 682
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
Don't open closed documents #7826
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2f4b51c
Update dynamic documents to store edits for closed documents
ryzngard de1837d
Merge branch 'main' into dynamic_file_changes
ryzngard 212e710
Encapsulate each set of changes in an Update class
ryzngard d23f7df
Merge branch 'dynamic_file_changes' of https://github.com/ryzngard/vs…
ryzngard 0e170b1
Merge branch 'main' into dynamic_file_changes
ryzngard 4719d13
Merge branch 'main' into dynamic_file_changes
ryzngard 86d43c5
Add checksum and encoding information to publish data
ryzngard 6d9e1b4
Merge branch 'dynamic_file_changes' of https://github.com/ryzngard/vs…
ryzngard fbfe1dc
Use correct checksum values. Use base64 checksum
ryzngard 0b09369
update packages
ryzngard 5b3e0eb
Pass multiple updates as sets of edits
ryzngard 505add1
Update roslyn version
ryzngard 1c03a02
Merge branch 'main' into dynamic_file_changes
dibarbet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as vscode from 'vscode'; | ||
import { CSharpProjectedDocument } from '../csharp/csharpProjectedDocument'; | ||
import { HtmlProjectedDocument } from '../html/htmlProjectedDocument'; | ||
import { getUriPath } from '../uriPaths'; | ||
import { IRazorDocument } from './IRazorDocument'; | ||
|
||
export class RazorDocument implements IRazorDocument { | ||
public readonly path: string; | ||
|
||
constructor( | ||
readonly uri: vscode.Uri, | ||
readonly csharpDocument: CSharpProjectedDocument, | ||
readonly htmlDocument: HtmlProjectedDocument | ||
) { | ||
this.path = getUriPath(uri); | ||
} | ||
|
||
public get isOpen(): boolean { | ||
for (const textDocument of vscode.workspace.textDocuments) { | ||
if (textDocument.uri.fsPath == this.uri.fsPath) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this works, given elsewhere the edits are concated together. Wouldn't we need to insert subsequent edits at position 0?
Though that could be at odds with the Roslyn algorithm that processes the same edits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a good point. I don't think I've actually hit a scenario where they got concat together in testing so probably missed this. Idk why reverse was used initially. Let me look...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverse makes sense for a single batch of ordered changes, it means you don't need to track forward when applying edits earlier in the file, and adjust positions later in the file. But the batches would need to be applied in order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize they were guaranteed to be ordered. Or that it was guaranteed to not overlap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can just update to applying stored edits first instead of doing a concat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be better now. I updated to keep track of
Updates
as individual units sent from Razor. How they get applied remains consistent and the edits being returned on ordered to be sent back to Roslyn