-
Notifications
You must be signed in to change notification settings - Fork 212
Fix overly aggressive delegated completion #11965
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
Merged
alexgav
merged 4 commits into
main
from
dev/alexgav/FixOverlyAggressiveDelegatedCompletion
Jun 21, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
43 changes: 43 additions & 0 deletions
43
...soft.CodeAnalysis.Razor.Workspaces/Protocol/Completion/RazorVSInternalCompletionParams.cs
This file contains hidden or 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,43 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT license. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Roslyn.LanguageServer.Protocol; | ||
|
||
/// <summary> | ||
/// A replacement of the LSP protocol <see cref="CompletionParams"/> that ensures correct serialization between LSP servers. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is the same as the LSP protocol <see cref="CompletionParams"/> except that it strongly types the <see cref="Context"/> property as VSInternalCompletionContext, | ||
/// because our custom message target gets handled by a JsonRpc connection set up by the editor, that has no Roslyn converters. | ||
/// Without using this class, we lose VSInternalCompletionContext.InvokeKind property when calling Roslyn or HTML servers from Razor | ||
/// which results in default value of "Invoked" to be used and can cause overly aggressive completion list. | ||
/// | ||
/// See original CompletionParams here https://github.com/dotnet/roslyn/blob/98d41b80f6a192230c045a6576e2a283a407980b/src/LanguageServer/Protocol/Protocol/CompletionParams.cs | ||
/// </remarks> | ||
internal sealed class RazorVSInternalCompletionParams : TextDocumentPositionParams, IPartialResultParams<SumType<CompletionItem[], CompletionList>?>, IWorkDoneProgressOptions | ||
DustinCampbell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
public RazorVSInternalCompletionParams() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// The completion context. This is only available if the client specifies the | ||
/// client capability <see cref="CompletionSetting.ContextSupport"/>. | ||
/// </summary> | ||
[JsonPropertyName("context")] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public VSInternalCompletionContext? Context { get; set; } | ||
|
||
/// <inheritdoc/> | ||
[JsonPropertyName(Methods.PartialResultTokenName)] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public IProgress<SumType<CompletionItem[], CompletionList>?>? PartialResultToken { get; set; } | ||
|
||
/// <inheritdoc/> | ||
[JsonPropertyName("workDoneProgress")] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] | ||
public bool WorkDoneProgress { get; init; } | ||
} |
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.