You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Infoview DocumentPosition should be a context #197
Currently in the infoview code, every component is passing the pos : DocumentPosition prop up through the component hierarchy. I think it would make a lot of sense to make this a React context instead.
I'm not sure if this is such a good idea. We have a lot of different positions floating around.
The cursor position in the editor.
The position of the current info (which may be different from the cursor position if it's pinned).
The position of the data shown in the info (which may lag behind the info position when the cursor is moved).
The position used for RPC queries.
The position of the diagnostic message / term goal / widget.
It goes without saying that all of these can be different. I vaguely recall that we've had some issues mixing up 2 and 3 but I can't find it right now.
I agree with Gabriel, I think "pinning" shows an example where a react component needs it's own local "pos" that is not in a shared context. You see this in Infos.tsx where the pos being passed down to the component is conditionally coming from the curLoc state or the pinnedPoss state. Infos is also listening to the ec.events.changedCursorLocation event so it can update when the current location is changed. AllMessages is also an example of a React component in the info view that does not use the cursor location at all.
I am curious about the naming of pinnedPoss and setPinnedPoss. I would have named these pinnedPos and setPinnedPos. I'm not sure what the second s at the and of those names represents exactly... it's not like it is plural positions or anything... so a bit confusing to me? Or is it plural because of the pinKey.current refcount?
There are different poses flying around but once you are inside the body of InfoDisplay there is only one pos. so the proposal would be to add pos as a context there.
ok within GoalUI, but also MessageView does its own thing with positions and can ignore the context. Eg the context could be called InfoDisplayPosContext.
I'm going to close because also this doesn't matter.
Activity
gebner commentedon Jun 17, 2022
I'm not sure if this is such a good idea. We have a lot of different positions floating around.
It goes without saying that all of these can be different. I vaguely recall that we've had some issues mixing up 2 and 3 but I can't find it right now.
lovettchris commentedon Jun 20, 2022
I agree with Gabriel, I think "pinning" shows an example where a react component needs it's own local "pos" that is not in a shared context. You see this in Infos.tsx where the pos being passed down to the component is conditionally coming from the
curLocstate or thepinnedPossstate. Infos is also listening to theec.events.changedCursorLocationevent so it can update when the current location is changed.AllMessagesis also an example of a React component in the info view that does not use the cursor location at all.I am curious about the naming of
pinnedPossandsetPinnedPoss. I would have named thesepinnedPosandsetPinnedPos. I'm not sure what the secondsat the and of those names represents exactly... it's not like it is plural positions or anything... so a bit confusing to me? Or is it plural because of thepinKey.currentrefcount?EdAyers commentedon Jun 21, 2022
There are different
poses flying around but once you are inside the body ofInfoDisplaythere is only one pos. so the proposal would be to add pos as a context there.gebner commentedon Jun 21, 2022
Inside of
InfoDisplayyou still have the positions (2)-(5) from my list.EdAyers commentedon Jun 21, 2022
ok within
GoalUI, but also MessageView does its own thing with positions and can ignore the context. Eg the context could be calledInfoDisplayPosContext.I'm going to close because also this doesn't matter.
Widget messages (#449)
Widget messages (#449)
Widget messages (#449)