-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add Interactive REPL Experiment #23235
Conversation
package.json
Outdated
{ | ||
"command": "python.execInREPL", | ||
"group": "Python", | ||
"when": "editorFocus && editorLangId == python && !virtualWorkspace && shellExecutionSupported" |
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.
Does this also need “not in interactive”
?
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.
Is "not in interactive" referring to IW only with Jupyter?
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.
I think #23389 was what we were talking about??
@@ -105,6 +108,17 @@ export function activateFeatures(ext: ExtensionState, _components: Components): | |||
interpreterService, | |||
pathUtils, | |||
); | |||
|
|||
// Register native REPL context menu when in experiment | |||
const experimentService = ext.legacyIOC.serviceContainer.get<IExperimentService>(IExperimentService); |
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.
legacy IOC? is there a newer one to use?
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.
Usually in other files in Python extension if we were to use serviceContainer, we access it via IServiceContainer, which we still could I believe if we register the REPL command in other file? I just thought extensionActivation was the best place to register command and read experiment service since it seemed like the fastest/prioritized when extension loads.
src/client/repl/replCommands.ts
Outdated
const notebookEdit = NotebookEdit.insertCells(cellCount, [notebookCellData]); | ||
const workspaceEdit = new WorkspaceEdit(); | ||
workspaceEdit.set(notebookDocument.uri, [notebookEdit]); | ||
workspace.applyEdit(workspaceEdit); |
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.
looks like this returns a thenable, might need to await this?
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.
good point, just added a commit for this!
Allow users to use Interactive Window UI with Python custom REPL controller instead of iPykernel. Closes microsoft#23175 Closes microsoft#23174 Closes microsoft#23029 Majority of: microsoft#23332 Context menu under Python for running Python REPL code using IW UI should only appear when user's ```pythonRunREPL``` experiment is enabled.
… UI (#23442) "Smartly" allow execute on enter for the #23235 experiment. User should be able to execute when they press enter on text input box of interactive window trigger from Python extension, whereas we would "wait" and allow insertion of new line after detecting user's Python command is not complete. When the user finally types enter again on a blank line, we should just proceed to execute whatever code, regardless of whether it is complete/valid or not to replicate Python's original interactive REPL behavior. Basically creating Python command and registering that for keybinding of 'Enter'. This would conditionally call interactive.execute which would then eventually call our execute handler contributed from Python n extension's REPL controller, or go ahead and insert,pass in Enter to the text input box to allow user to type "complete" code. This PR only intends to implement/add changes regarding execute on enter logic, adding Intellisense support, and also adding things into disposables so they can be properly disposed. Trying to also add setting to allow toggling on/off to send Python command to Terminal or IW REPL if the user is in experiment. Handling of interrupt for windows should be on separate PR. Test will be added later as separate PR. --------- Co-authored-by: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
… UI (#23442) "Smartly" allow execute on enter for the microsoft#23235 experiment. User should be able to execute when they press enter on text input box of interactive window trigger from Python extension, whereas we would "wait" and allow insertion of new line after detecting user's Python command is not complete. When the user finally types enter again on a blank line, we should just proceed to execute whatever code, regardless of whether it is complete/valid or not to replicate Python's original interactive REPL behavior. Basically creating Python command and registering that for keybinding of 'Enter'. This would conditionally call interactive.execute which would then eventually call our execute handler contributed from Python n extension's REPL controller, or go ahead and insert,pass in Enter to the text input box to allow user to type "complete" code. This PR only intends to implement/add changes regarding execute on enter logic, adding Intellisense support, and also adding things into disposables so they can be properly disposed. Trying to also add setting to allow toggling on/off to send Python command to Terminal or IW REPL if the user is in experiment. Handling of interrupt for windows should be on separate PR. Test will be added later as separate PR. --------- Co-authored-by: Courtney Webster <60238438+cwebster-99@users.noreply.github.com> Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Allow users to use Interactive Window UI with Python custom REPL controller instead of iPykernel. Closes #23175 Closes #23174 Closes #23029 Majority of: #23332 Context menu under Python for running Python REPL code using IW UI should only appear when user's ```pythonRunREPL``` experiment is enabled.
Allow users to use Interactive Window UI with Python custom REPL controller instead of iPykernel.
Closes #23175
Closes #23174
Closes #23029
Majority of: #23332
Context menu under Python for running Python REPL code using IW UI should only appear when user's
pythonRunREPL
experiment is enabled.