-
Notifications
You must be signed in to change notification settings - Fork 107
Add new command to kick off (refresh) interpreter discovery #7762
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
11 commits
Select commit
Hold shift + click to select a range
77738d2
Add new command to kick off discovery
juliasilge d9a40c0
Update tests
juliasilge d93b81e
Switch to new public `rediscoverAllRuntimes()`
juliasilge 59e892c
Update tests
juliasilge b377929
Move private method back to where it was in file
juliasilge d00af25
Add a notification for added runtimes
juliasilge 0ff52df
Merged origin/main into feature/new-command-runtime-discovery
juliasilge 66a69a4
Merged origin/main into feature/new-command-runtime-discovery
juliasilge 10a7ef9
Update comment to be more accurate
juliasilge 93ea551
Trigger a refresh in `pythonRuntimeDiscoverer` so discovery is always…
juliasilge dca2b35
Merge branch 'main' into feature/new-command-runtime-discovery
juliasilge 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,8 +44,8 @@ export const LANGUAGE_RUNTIME_RESTART_ACTIVE_SESSION_ID = 'workbench.action.lang | |
export const LANGUAGE_RUNTIME_RENAME_SESSION_ID = 'workbench.action.language.runtime.renameSession'; | ||
export const LANGUAGE_RUNTIME_RENAME_ACTIVE_SESSION_ID = 'workbench.action.language.runtime.renameActiveSession'; | ||
export const LANGUAGE_RUNTIME_DUPLICATE_ACTIVE_SESSION_ID = 'workbench.action.language.runtime.duplicateActiveSession'; | ||
|
||
export const LANGUAGE_RUNTIME_SELECT_RUNTIME_ID = 'workbench.action.languageRuntime.selectRuntime'; | ||
export const LANGUAGE_RUNTIME_DISCOVER_RUNTIMES_ID = 'workbench.action.language.runtime.discoverAllRuntimes'; | ||
|
||
/** | ||
* Helper function that askses the user to select a language from the list of registered language | ||
|
@@ -967,6 +967,29 @@ export function registerLanguageRuntimeActions() { | |
} | ||
}); | ||
|
||
registerAction2(class extends Action2 { | ||
/** | ||
* Constructor. | ||
*/ | ||
constructor() { | ||
super({ | ||
id: LANGUAGE_RUNTIME_DISCOVER_RUNTIMES_ID, | ||
title: nls.localize2('workbench.action.language.runtime.discoverAllRuntimes', "Discover All Interpreters"), | ||
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. We could use wording here that is more like "Refresh Interpreter Discovery", if we think that is better or more clear? 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. I prefer the wording in the PR! |
||
f1: true, | ||
category | ||
}); | ||
} | ||
|
||
async run(accessor: ServicesAccessor) { | ||
// Access service. | ||
const runtimeStartupService = accessor.get(IRuntimeStartupService); | ||
|
||
// Kick off discovery. | ||
runtimeStartupService.rediscoverAllRuntimes(); | ||
} | ||
}); | ||
|
||
|
||
/** | ||
* Arguments passed to the Execute Code actions. | ||
*/ | ||
|
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.
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.
This is what we needed for this to work for Python! 🎉
However, it does change what the Python discoverer does for all uses. Do we think this is a good way to go? The alternative is that
discoverAllRuntimes()
on the runtime startup service could gain an optional boolean argument that specifies whether this is a refresh or an original discovery; we would then pipe it through the API command through to here:positron/extensions/positron-python/src/client/positron/manager.ts
Line 124 in 93ea551
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.
Refreshing every time could slow down discovery if users open up multiple windows, since it runs on extension activation. However, finding interpreters each new window might be a nice experience (and actually make it less necessary to use a refresh command). I think its fine to do every time.