-
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
Fix completion in an empty document #11344
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,6 +313,59 @@ The end. | |
snippetLabels: ["snippet1", "snippet2"]); | ||
} | ||
|
||
[Fact] | ||
public async Task HtmlSnippetsCompletion_EmptyDocument() | ||
{ | ||
await VerifyCompletionListAsync( | ||
input: """ | ||
$$ | ||
""", | ||
completionContext: new RoslynVSInternalCompletionContext() | ||
{ | ||
InvokeKind = RoslynVSInternalCompletionInvokeKind.Explicit, | ||
TriggerCharacter = null, | ||
TriggerKind = RoslynCompletionTriggerKind.Invoked | ||
}, | ||
expectedItemLabels: ["snippet1", "snippet2"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is an unfortunate behavior change/regression in empty HTML document in HTML LSP editor. It no longer shows tags (as non-LSP editor and thus legacy Razor editor used to). E.g. legacy HTML but no completion at all in LSP HTML editor (since there aren't any snippets). By extension that affects Razor as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No issues with changes in this PR though, thank you for fixing this case! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same conversation as #11343 (comment) really. This PR isn't introducing any regression or change in behaviour. We don't show Html elements or components when completion is invoked on an empty line, as the completion items don't have the |
||
snippetLabels: ["snippet1", "snippet2"]); | ||
} | ||
|
||
[Fact] | ||
public async Task HtmlSnippetsCompletion_WhitespaceOnlyDocument1() | ||
{ | ||
await VerifyCompletionListAsync( | ||
input: """ | ||
|
||
$$ | ||
""", | ||
completionContext: new RoslynVSInternalCompletionContext() | ||
{ | ||
InvokeKind = RoslynVSInternalCompletionInvokeKind.Explicit, | ||
TriggerCharacter = null, | ||
TriggerKind = RoslynCompletionTriggerKind.Invoked | ||
}, | ||
expectedItemLabels: ["snippet1", "snippet2"], | ||
snippetLabels: ["snippet1", "snippet2"]); | ||
} | ||
|
||
[Fact] | ||
public async Task HtmlSnippetsCompletion_WhitespaceOnlyDocument2() | ||
{ | ||
await VerifyCompletionListAsync( | ||
input: """ | ||
$$ | ||
|
||
""", | ||
completionContext: new RoslynVSInternalCompletionContext() | ||
{ | ||
InvokeKind = RoslynVSInternalCompletionInvokeKind.Explicit, | ||
TriggerCharacter = null, | ||
TriggerKind = RoslynCompletionTriggerKind.Invoked | ||
}, | ||
expectedItemLabels: ["snippet1", "snippet2"], | ||
snippetLabels: ["snippet1", "snippet2"]); | ||
} | ||
|
||
[Fact] | ||
public async Task HtmlSnippetsCompletion_NotInStartTag() | ||
{ | ||
|
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.
Thank you for the comment! :) #Resolved