feat/ref(LSP): constructor variant better hover #3756
Replies: 4 comments 7 replies
-
Sounds good to me!
There already is one for that part: #3507 Edit: looks like I misunderstood what was said. That issue is still relevant to this though |
Beta Was this translation helpful? Give feedback.
-
Sorry, I'm not sure what you're proposing here. Could you expand a little please?
That function doesn't have any labels, so none would be shown. There's an issue for functions with labels here: #3507 Arguments are never shown as they are not part of the public API. |
Beta Was this translation helpful? Give feedback.
-
In short what I'm proposing is to instead of showing the constructor name we show the construction variant, modulePath, and maybe its arguments. And what I'm wanting feed back on would be how that is formated. I've proposed the top is formated like As for the function not showing labels I was making using of its formating to provide op2 which follows that. It doesn't contain argument name nor labels, but it appears labels are suppose to be shown and not arguments so to an extent op2 (given that |
Beta Was this translation helpful? Give feedback.
-
Here's and hypothetical hover (using the same code as shown in the proposal) for op3. gateway/ws_handler.SocketMsg
MatchEnd(
reason: String,
win_pid: Option(String),
game_time: #(Int, Float)
) For op2; gateway/ws_handler.SocketMsg
MatchEnd(String, Option(String), #(Int, Float)) For op1; gateway/ws_handler.SocketMsg
MatchEnd |
Beta Was this translation helpful? Give feedback.
-
Problem
The code given above is in context for what is being hovered. Currently, when hovering a constructor's variant it will return the constructor type itself (
SocketMsg
). However, That provides really no data at all, I understand that you could to an extent achieve some access to the variant's fields by hovering..
, and yes that is to an extent what I am proposing.Current Hover:
Proposed Idea
variants' documentation would not change
Further info--Proposals;
op1
would be the quickest to implement as there has already been work done to have the type'smodule
in the rustPattern::Constructor
. The only thing needed would be formatting.op2
would also be relatively easy to format and gather the types from the arguments field and format likefn
arguments.op3
would require a bit more fidgeting as we'd need to create somefn
(rust) in the printer to handle printing the labels of a constructor--something that inop2
can be replicated from printingfn
in gleam.Targeted changes
/langauge_server/hover.rs
Beta Was this translation helpful? Give feedback.
All reactions