Repository navigation
Send ERB virtual state when a document is opened - #4267
Open
rafayqayyum wants to merge 1 commit into
Open
rafayqayyum wants to merge 1 commit into
rafayqayyum wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Closes #2784
Hovering an HTML element in a freshly opened ERB file fails with
Unable to resolve text model content for resource embedded-content://…until the file is edited. That explains why it reproduced for some people and not others.Implementation
Document#initializecallsparse!, so afterdidOpenthe document no longer needs parsing. Thedelegate/textDocument/virtualStatenotification inBaseServeris only sent whendocument.parse!returnstrue, which first happens after an edit, so the extension's embedded-content provider has nothing for a newly opened file.text_document_did_opennow sends the virtual state for ERB documents when the client supports request delegation. I kept this inserver.rbrather thanbase_server.rbto avoid conflicting with #4261, which reworks the parse/notify block there (it keeps theparse!-true condition, so it doesn't cover this case).Automated Tests
Added a server test that opens an ERB document with request delegation enabled and asserts the
virtualStatenotification is sent with the host-language source. It fails onmain(no notification is sent).Manual Tests
.html.erbfile and, without editing it, hover an HTML tag.main: the "Unable to resolve text model content" error appears. With this branch: the HTML hover shows.