-
Notifications
You must be signed in to change notification settings - Fork 48
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
Infoview DocumentPosition should be a context #197
Comments
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. |
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 I am curious about the naming of |
There are different |
Inside of |
ok within I'm going to close because also this doesn't matter. |
Implementation of leanprover/lean4#2064. Besides adding support for widget messages, this adds an `EnvPosContext` that stores the position that a component is "about" (see the docstring for more detail). This was originally proposed in #197 and eventually dismissed (see #226 for a detailed discussion), but I think it warrants a reconsideration. While Gabriel's point that there are many positions around remains true, the `EnvPosContext` stores a very specific one. This position is only used to retrieve a snapshot, and from that a `Lean.Environment`, on the server-side. Widgets currently have to pass this position around manually; this has led to [errors](leanprover-community/ProofWidgets4@ca66ebb) in user code. Furthermore, so far I have not encountered any situation where it makes sense to modify the position; thus a context seems like a preferable approach. If needed, the context can still be set by users. I also had to update some package versions to have tests building again. I hope that didn't break anything!
Implementation of leanprover/lean4#2064. Besides adding support for widget messages, this adds an `EnvPosContext` that stores the position that a component is "about" (see the docstring for more detail). This was originally proposed in #197 and eventually dismissed (see #226 for a detailed discussion), but I think it warrants a reconsideration. While Gabriel's point that there are many positions around remains true, the `EnvPosContext` stores a very specific one. This position is only used to retrieve a snapshot, and from that a `Lean.Environment`, on the server-side. Widgets currently have to pass this position around manually; this has led to [errors](leanprover-community/ProofWidgets4@ca66ebb) in user code. Furthermore, so far I have not encountered any situation where it makes sense to modify the position; thus a context seems like a preferable approach. If needed, the context can still be set by users. I also had to update some package versions to have tests building again. I hope that didn't break anything!
Implementation of leanprover/lean4#2064. Besides adding support for widget messages, this adds an `EnvPosContext` that stores the position that a component is "about" (see the docstring for more detail). This was originally proposed in #197 and eventually dismissed (see #226 for a detailed discussion), but I think it warrants a reconsideration. While Gabriel's point that there are many positions around remains true, the `EnvPosContext` stores a very specific one. This position is only used to retrieve a snapshot, and from that a `Lean.Environment`, on the server-side. Widgets currently have to pass this position around manually; this has led to [errors](leanprover-community/ProofWidgets4@ca66ebb) in user code. Furthermore, so far I have not encountered any situation where it makes sense to modify the position; thus a context seems like a preferable approach. If needed, the context can still be set by users. I also had to update some package versions to have tests building again. I hope that didn't break anything!
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.The text was updated successfully, but these errors were encountered: