-
Notifications
You must be signed in to change notification settings - Fork 199
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
Ensure we don't send duplicate changes when unique filenames aren't used #9141
Ensure we don't send duplicate changes when unique filenames aren't used #9141
Conversation
// For example, when a document moves from the Misc Project to a real project, we will update it here, and each version would | ||
// have a different project key. On the receiving end however, there is only one file path, therefore one version of the contents, | ||
// so we must ensure we only have a single document to compute diffs from, or things get out of sync. | ||
// if (!_languageServerFeatureOptions.IncludeProjectKeyInGeneratedFilePath) |
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 line of code will be commented out in my other open PR, the feature flag doesn't exist in main yet.
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspLogger.cs
Outdated
Show resolved
Hide resolved
@@ -59,7 +59,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(SemanticTokensRangeParam | |||
var semanticTokens = await semanticTokensInfoService.GetSemanticTokensAsync(request.TextDocument, request.Range, documentContext, _razorSemanticTokensLegend.AssumeNotNull(), correlationId, cancellationToken).ConfigureAwait(false); | |||
var amount = semanticTokens is null ? "no" : (semanticTokens.Data.Length / 5).ToString(Thread.CurrentThread.CurrentCulture); | |||
|
|||
requestContext.Logger.LogInformation("Returned {amount} semantic tokens for range {request.Range} in {request.TextDocument.Uri}.", amount, request.Range, request.TextDocument.Uri); | |||
requestContext.Logger.LogInformation("Returned {amount} semantic tokens for range ({startLine},{startChar})-({endLine}-{endChar})} in {request.TextDocument.Uri}.", amount, request.Range.Start.Line, request.Range.Start.Character, request.Range.End.Line, request.Range.End.Character, request.TextDocument.Uri); |
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.
Just noticed this in the log. It used to just [Info - 2:31:15 PM] Returned 50 semantic tokens for range Microsoft.VisualStudio.LanguageServer.Protocol.Range in file:///Users/vs/worker/WebApplication1/Pages/Index.cshtml.
@@ -155,4 +155,78 @@ public async Task OpenExistingProject() | |||
var actualProjectFileName = await TestServices.SolutionExplorer.GetAbsolutePathForProjectRelativeFilePathAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.ProjectFile, ControlledHangMitigatingCancellationToken); | |||
Assert.Equal(expectedProjectFileName, actualProjectFileName); | |||
} | |||
|
|||
[IdeFact(MaxAttempts = 1)] | |||
public async Task OpenExistingProject_WithReopenedFile() |
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've added this test, and the one below, just in case, but it turns out they don't fail even without the fixes in this PR, because of other issues. Have started a Teams thread about it.
Second attempt at fixing various issues: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1867769, https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1868418, https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1868479, #9131, #9125 and #9060
Also fixes #9138
Turns out my previous fix, which I pulled out of my other PR, didn't quite go far enough and specifically failed for documents that were restored to their open state in VS Code/VS and for documents that were seen to be in the "Misc Files" project before appearing in a real project.