зеркало из https://github.com/dotnet/razor.git
Fix merge conflicts
This commit is contained in:
Коммит
d864388543
|
@ -38,4 +38,4 @@
|
|||
"insertionTitlePrefix": "[17.7P1]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,6 +100,30 @@ internal class DefaultLSPDocumentSynchronizer : LSPDocumentSynchronizer
|
|||
return new SynchronizedResult<TVirtualDocumentSnapshot>(onSynchronizedResult, virtualDocumentSnapshot);
|
||||
}
|
||||
|
||||
internal SynchronizedResult<TVirtualDocumentSnapshot>? TryReturnPossiblyFutureSnapshot<TVirtualDocumentSnapshot>(
|
||||
int requiredHostDocumentVersion,
|
||||
Uri hostDocumentUri) where TVirtualDocumentSnapshot : VirtualDocumentSnapshot
|
||||
{
|
||||
lock (_documentContextLock)
|
||||
{
|
||||
var preSyncedSnapshot = GetVirtualDocumentSnapshot<TVirtualDocumentSnapshot>(hostDocumentUri);
|
||||
var virtualDocumentUri = preSyncedSnapshot.Uri;
|
||||
if (!_virtualDocumentContexts.TryGetValue(virtualDocumentUri, out var documentContext))
|
||||
{
|
||||
// Document was deleted/removed in mid-synchronization
|
||||
return new SynchronizedResult<TVirtualDocumentSnapshot>(false, preSyncedSnapshot);
|
||||
}
|
||||
|
||||
if (requiredHostDocumentVersion <= documentContext.SeenHostDocumentVersion)
|
||||
{
|
||||
// Already synchronized
|
||||
return new SynchronizedResult<TVirtualDocumentSnapshot>(true, preSyncedSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public override Task<bool> TrySynchronizeVirtualDocumentAsync(int requiredHostDocumentVersion, VirtualDocumentSnapshot virtualDocument, CancellationToken cancellationToken)
|
||||
=> TrySynchronizeVirtualDocumentAsync(requiredHostDocumentVersion, virtualDocument, rejectOnNewerParallelRequest: true, cancellationToken);
|
||||
|
|
|
@ -1012,10 +1012,27 @@ internal class DefaultRazorLanguageServerCustomMessageTarget : RazorLanguageServ
|
|||
}
|
||||
else if (request.OriginatingKind == RazorLanguageKind.CSharp)
|
||||
{
|
||||
(synchronized, virtualDocumentSnapshot) = await _documentSynchronizer.TrySynchronizeVirtualDocumentAsync<CSharpVirtualDocumentSnapshot>(
|
||||
request.HostDocument.Version,
|
||||
request.HostDocument.Uri,
|
||||
cancellationToken);
|
||||
// TODO this is a partial workaround to fix prefix completion by avoiding sync (which times out during resolve endpoint) if we are currently at a higher version value
|
||||
// this does not fix postfix completion and should be superceded by eventual synchronization fix
|
||||
|
||||
var futureDataSyncResult =
|
||||
(_documentSynchronizer as DefaultLSPDocumentSynchronizer)?.TryReturnPossiblyFutureSnapshot<CSharpVirtualDocumentSnapshot>(
|
||||
request.HostDocument.Version,
|
||||
request.HostDocument.Uri);
|
||||
if (futureDataSyncResult?.Synchronized == true)
|
||||
{
|
||||
(synchronized, virtualDocumentSnapshot) = futureDataSyncResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
(synchronized, virtualDocumentSnapshot) = await _documentSynchronizer
|
||||
.TrySynchronizeVirtualDocumentAsync<CSharpVirtualDocumentSnapshot>(
|
||||
request.HostDocument.Version,
|
||||
request.HostDocument.Uri,
|
||||
rejectOnNewerParallelRequest: true,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
languageServerName = RazorLSPConstants.RazorCSharpLanguageServerName;
|
||||
}
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче