-
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
Conversation
// Special case for empty documents, to just force Html. When there is no content, then there are no source mappings, | ||
// so the map call below fails, and we would default to Razor. This is fine for most cases, but empty documents are a | ||
// special case where Html provides much better results when users first start typing. | ||
return new DocumentPositionInfo(RazorLanguageKind.Html, new Position(0, 0), hostDocumentIndex); |
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
TriggerCharacter = null, | ||
TriggerKind = RoslynCompletionTriggerKind.Invoked | ||
}, | ||
expectedItemLabels: ["snippet1", "snippet2"], |
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.
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 comment
The 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 comment
The 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 <
in them, so they wouldn't produce valid code. This PR just makes the experience the same whether the document is empty or not.
Fixes #10613
Fixes #10614