-
Notifications
You must be signed in to change notification settings - Fork 94
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
Prioritize affiliated runtimes; ensure that after boot, primary runtime is active #1143
Comments
I would think that some very simple heuristics would get you right most of the time. Certain files are always associated with one language, like Context from me: I opened an R package in Positron, no Python in it anywhere, and Positron started the Python console. |
I think we should have a way for users to explicitly select a primary runtime at the project-level. This could be set by default when using the New Project flow and selecting a specific language. For "folders" or other existing projects, we could have a workspace-level option to set this manually and eventually incorporate it into the richer runtime selector tooling post RC. The Python extension has a default interpreter and several additional manual fields for various language runtime managers:
The R extension has a custom path setting, but not a default interpreter:
In addition to on-disk heuristics such as requirements.txt, lockfiles, IE there could be two rich heuristics:
|
Related to #2659 |
This change eliminates the disorienting startup experience that can occur when multiple affiliated runtimes exist (or multiple sessions are running). Prior to the change, every runtime start or reconnect resulted in the new session taking over the Console and Variables panes and becoming the active session. Practically speaking this meant that startup often showed some flickering as different sessions booted and Positron switched between them on its own, and the session you wound up with when startup was finished might not be the one you wanted or expected. After the change, sessions and affiliated runtimes are ordered, and only one console session gets to become active. The other sessions are still started -- they just start in the background. The result is (hopefully) a calmer startup experience. Right now, there is no explicit ordering -- we just go by whichever one was last used. So if you were using Python when you exited, that's what you should see when you open Positron again; same deal with R. The implementation works as follows: - plumb an `activate` flag everywhere we deal with session start events to keep track of whether the session should be focused/activated after it starts - remember the last used time for both sessions (for reconnect/reload) and affiliations (for new windows) - start/reconnect to sessions in descending order of last use (i.e. most recent first) - at startup, only flag sessions to `activate` if they are the most recently used Addresses #1044 and part of #1143. ### Release Notes #### New Features - When multiple languages are being used, prioritize the most recent one at startup (#1044.) #### Bug Fixes - N/A ### QA Notes - Both affiliations (for new windows) and sessions (for reloading existing windows) should be checked. - For a runtime to become the "last used runtime", you generally need to make a gesture that you want to use the runtime, such as switching to it in the Console or running some code in the Console --------- Signed-off-by: Jonathan <[email protected]> Co-authored-by: sharon <[email protected]> Co-authored-by: positron-bot[bot] <173392469+positron-bot[bot]@users.noreply.github.com>
Currently, runtime affiliation with workspaces happens on a per-language level. That is, if you use R and Python in a workspace, we will separately affiliate an R interpreter and a Python interpreter with your workspace, and both will be started when you open the workspace.
However, we don't currently weight or prioritize the runtimes affiliated with the workspace. This means that even in workspaces that are primarily R based, if Python is also affiliated with the workspace, it will start up too, and take over the foreground (since Python currently registers runtimes after R).
We should remember the primary runtime that's affiliated with a workspace, and ensure that one is started first (see #1067), and that others are started in the background and don't take focus.
We don't currently ask users to identify the primary runtime; we could do that ourselves via a combination of heuristics (asking extensions to supply some kind of affinity rating derived from e.g. the project's files/type) and/or inference (noting what runtime typically has the foreground, and which one was active in the last session).
The text was updated successfully, but these errors were encountered: