-
Notifications
You must be signed in to change notification settings - Fork 226
Support Sorbet typed: false files for completion requests
#1245
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
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
659b07d
enable completion on typed: false files
SeanKG 5c6364c
Add tests for completion.rb
SeanKG 4d3c576
use prism to look for magic comments
SeanKG de8f237
rename method and clean up tests
SeanKG 134bad2
use asser/refute_predicate
SeanKG 2f933d2
Add a test for other comments / strings
SeanKG 7545635
Remove completion on constants
SeanKG 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
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
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
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
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.
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.
Seeing these changes for constants made me wonder why Sorbet wasn't providing hover or completion for them on
typed: falsefiles. It can accurately report diagnostics for them, so I thought it should just work.After talking to the team, hover now works for constants in
typed: falsefiles and I opened a PR for completion. Definition already worked for constants.If the PR is approved, we can maintain the same check we had before, since Sorbet will always be able to handle completion for constants.
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.
Oh nice yeah I mean if sorbet can cover this then that works! I had sorta considered that but it was way easier for me to understand how to change this code base.
Will we get 1:1 support for
typed: falsefrom the sorbet LS as this one though?I know constants will be covered but I think you all are working on more support for methods in here as well right? Still seems like it could be valuable to know at the document level what's going on with typechecking.
Obviously this is kind of an edge case - It's on my roadmap to go get us past
typed: falsebut it may take some time still. We need to dedicate some time to supporting that push properly and have a few other priorities before we can take the time to do that. We kinda yolo'd into it on first pass and it was messy / got in the way of devs quite a bit so we had to regress for a time. Hence why we have sorbet installed, but are largelytyped: falsefor now.Anywhoo context aside I still think this could be valuable but I'm also happy to wait for a concrete use-case if the current one gets covered by sorbet!
Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, this change still makes perfect sense for methods. Sorbet does not even attempt to typecheck
typed: falsefiles, so we can definitely fallback method hover, completion, signature help and definition to the Ruby LSP.For constants though, we can fully delegate to Sorbet. It's always able to discover and handle constants properly (meta-programming excluded of course).
So let's just revert the changes to the early returns for constant reads and constant path reads and leave it only for call nodes. Then we should be good to go.
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.
Right yeah that makes sense. I just pushed those changes up now 👍