-
Notifications
You must be signed in to change notification settings - Fork 26
Support positron.session_init and positron.session_reconnect hooks
#1088
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c578758
First pass at session init hook support
jennybc 8ce1526
Apply suggestion from @github-actions[bot]
jennybc 50750d4
Revert "Apply suggestion from @github-actions[bot]"
jennybc da773a0
Revert "First pass at session init hook support"
jennybc fa04cae
Handle comm_open data and fire positron.session_init hooks
jennybc fc06c58
Pass `comm_open` data via `handle_comm_open()`
lionel- e15b8a0
Use 2 hooks
jennybc b869fa8
Thread comm_msg originator to enable frontend RPCs from hooks
jennybc d1a6495
Box Originator in KernelRequest::CommMsg to please clippy
jennybc 66e019b
`cargo +nightly fmt --all`
jennybc eb0065f
Merge these 2 tests
jennybc 6ead2df
Don't export the hook runners
jennybc 7bfadb1
Deserialize UI comm_open data via typed struct
jennybc eb19361
Test hook behaviour for the 3 start types
jennybc 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,11 @@ impl Console { | |
| let comm = self.comms.get(self.ui_comm_id.as_deref()?)?; | ||
| Some(UiCommRef { | ||
| comm, | ||
| originator: self.active_request.as_ref().map(|r| &r.originator), | ||
| originator: self | ||
| .active_request | ||
| .as_ref() | ||
| .map(|r| &r.originator) | ||
| .or(self.comm_msg_originator.as_ref()), | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the key change that makes frontend RPCs work from |
||
| stdin_request_tx: &self.stdin_request_tx, | ||
| }) | ||
| } | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Architectural (later):
In the future, we think
start_typemight eventually come throughcomm_open(). In that world, I think it does make sense for this to be a 3 valued string like is shown here. Because we get acomm_open()for all 3 types of "start".When we move
start_typetocomm_open(), this method probably changes fromFrontendReadyto something more specific likeFireHooks(or maybe the name still makes sense, idk yet?). Regardless, what definitely would change is thatstart_typewould be removed from the params here, because it would have already come through incomm_open().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.
FWIW I stayed away from hard-wiring "fire the hooks!" terminology into the Positron side. Because I figured, Positron really doesn't need to know what the backend is doing with this info. It just needs to say "I am ready".
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.
Yea that is also where I was starting to land with "or maybe the name still makes sense, idk yet?"