Skip to content

Conversation

@pfitzseb
Copy link
Member

@pfitzseb pfitzseb commented Oct 5, 2020

No description provided.

Copy link
Member Author

@pfitzseb pfitzseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current shortcomings should be limited to the fact that it's not possible to interrupt code in the REPL from an editor and vice versa.

package.json Outdated
},
{
"command": "language-julia.interrupt",
"key": "Ctrl+Shift+C",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This technically overwrites a default kebinding (Open New External Terminal), but that doesn't seem like a big deal to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, don't we have the other keyboard shortcut already? I think overwriting default keybindings is probably something we should avoid...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it's very convenient not to have to focus the REPL to interrupt code, imho. Either is fine though, so I can remove this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of feel we need a generic solution for this... Here is one idea: we could have a setting that says "enable conflicting julia keybindings", and that toggles one of these context values, and then we could use that in when clauses for all the keybindings that we want to introduce but that conflict with existing keybindings. The default for the setting would be false, but it would make it very easy for a user to toggle that setting, and then they would automatically get a large number of "better" keybindings, at the cost of them overwriting existing ones.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I like that option. I wanted to rework our keybindings anyways, so I can implement that option while I'm at it. Ok to do that in a follow up?

msg = JSONRPC.get_next_message(conn_endpoint[])

if is_dev
@async if is_dev
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't cause any problems, but is required for us to process multiple requests/notifications at the same time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit this makes me quite nervous because if affects absolutely everything, i.e. now the whole REPL code here needs to be reentrant safe, which is certainly not something we thought about when we wrote it initially...

But I also don't have a fantastic other idea ;) We could go back to the original model, where the code execution message is a notification that returns right away once the code running has been started, and then the server sends a notification back when the code has finished running, that way we wouldn't have these long-running code execution requests. I think that would limit the whole reentrant story to code execution, right?

@pfitzseb
Copy link
Member Author

pfitzseb commented Oct 6, 2020

Alright, every way to evaluate code now goes through the same mechanism. As a consequence, the language-julia.interrupt command can interrupt the REPL as well, and Ctrl-C in the REPL now invokes that command.

@pfitzseb pfitzseb added this to the Next Minor milestone Oct 6, 2020
Copy link
Member

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

I can't pretend to fully understand all of this, but I did have one comment on making the whole msg loop async.

package.json Outdated
},
{
"command": "language-julia.interrupt",
"key": "Ctrl+Shift+C",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, don't we have the other keyboard shortcut already? I think overwriting default keybindings is probably something we should avoid...

msg = JSONRPC.get_next_message(conn_endpoint[])

if is_dev
@async if is_dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to admit this makes me quite nervous because if affects absolutely everything, i.e. now the whole REPL code here needs to be reentrant safe, which is certainly not something we thought about when we wrote it initially...

But I also don't have a fantastic other idea ;) We could go back to the original model, where the code execution message is a notification that returns right away once the code running has been started, and then the server sends a notification back when the code has finished running, that way we wouldn't have these long-running code execution requests. I think that would limit the whole reentrant story to code execution, right?

@theogf
Copy link

theogf commented Oct 10, 2020

In reference to the

"command": "language-julia.interrupt",
"key": "Ctrl+Shift+C",

maybe it's preferable to have a key combination like in Juno. For example : Ctrl + J, Ctrl + C

@pfitzseb pfitzseb requested a review from davidanthoff October 12, 2020 13:18
@pfitzseb
Copy link
Member Author

Alright, removed the controversial keybinding. We're also only @asyncing runcode requests, which is enough for this feature.

@davidanthoff
Copy link
Member

davidanthoff commented Oct 19, 2020

Test are failing, though. Was probably a timeout thing, I triggered another run.

@pfitzseb pfitzseb merged commit 0d8b10c into master Oct 19, 2020
@davidanthoff davidanthoff deleted the sp/interrupts branch February 11, 2021 19:40
@oppo-source oppo-source removed the request for review from a team April 16, 2021 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants