-
Notifications
You must be signed in to change notification settings - Fork 444
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
Make go-to-definition on a typeclass projection application go to the instance(s) #1767
Conversation
ba85f34
to
e06e665
Compare
Hmm the CI test failures are puzzling me (it looks like they're still not getting the instance locations for some reason), because everything passes locally when I do:
|
The interactive tests are not designed for referencing core files in their output. Either you'll need to change the existing tests not to reference core instances, or we implement something in the vein of #1722 (comment) that would prevent these tests from showing instances. |
@rish987 Today we were discussing this PR in the dev meeting. Could you please clarify the semantics you are implementing? |
Sure, I was trying to follow what Sebastian described here, basically, on go-to-definition or go-to-type if we get an I think I may need some help with the tests though (I blindly copied over expected outputs that I just noticed include URIs on my local filesystem 😰 so of course it won't work). Perhaps we need some additional filtering to preserve existing behavior (and some new tests as well to specifically test the new functionality), I was discussing this with @Kha yesterday and it sounded like he had an idea regarding that? |
Right, the fundamental issue is that when looking at the typeclass method call |
…to the instance(s)
…ations (last Tuesday's meeting)
… is responsible for its `expr`.
…fo` node is responsible for its `expr`." This reverts commit d9767f2.
c0f1e26
to
760d9b7
Compare
Okay this should finally be ready! I've merged in #1903 so it depends on that PR being merged first. |
Whoops, didn't mean to close it! |
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.
Looks great all in all!
src/Lean/Widget/Basic.lean
Outdated
structure InfoWithCtx where | ||
ctx : Elab.ContextInfo | ||
info : Elab.Info | ||
children : PersistentArray InfoTree | ||
deriving Inhabited, TypeName |
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.
Let's move this to InfoUtils
and use it in hoverableInfoAt?
and locationLinksOfInfo
etc. The deriving TypeName
should probably be left here though.
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.
Done, let me know what you think of the refactor.
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.
Hi, sorry to only comment on this now but InfoWithCtx
is only really intended for use as a way of bundling data together in the RPC protocol so that interactive expressions and go-to-def in the infoview work. As Gabriel put it, it's a kind of "type popup + go-to-def thunk". Unless you need to do something with RPC here, it would be better not to move it and to add another type with whatever semantics you need instead.
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.
Duplicating it wouldn't be hard, but since the type is opaque in the RPC protocol I'm not really seeing the motivation. It's a sensible bundle of data to have in the server in general, and the name fits as well. Even if we don't necessarily need children
in the widgets.
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.
The type seems like a better fit for Elab.InfoTree
, if anything, because it was already hacky as far as the RPC interface is concerned — the outputs of delaboration are Elab.Info
s but they should really be a much more restricted Delab.Info
without variants like .ofCompletion
. But okay, since InfoWithCtx
is opaque we can always keep it around for uses such as in this PR but replace it with something else in the RPC interface. Btw @rish987 you probably want to also make the output of hoverableInfoAt?
and termGoalAt?
be InfoWithCtx
, document what the children
field is, and change the docstring to note that it's used for more than just RPC.
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.
Done, thanks for the suggestions.
6527820
to
acf4acb
Compare
aca714d
to
9ebb657
Compare
Closes #1722, pending #1903.