-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
#28617 - implemented according to comments in PR #28952
Closed
Closed
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
77751c9
#28617 - implemented according to comments in PR
cristianhosu c2134a2
#28617 - changed according to PR 28952
cristianhosu 2cd6f12
#28617 - modified according to PR comments
cristianhosu 7c5078e
#28617 - removed references to quick open action
cristianhosu ebd7bb0
merge monaco.d.ts
cristianhosu 10ff9cb
Merge remote-tracking branch 'upstream/master'
cristianhosu cd6c611
Merge from upstream/master
cristianhosu b2d9137
merge from upstream
cristianhosu 1e98f71
Merge branch 'master' into #28617
cristianhosu c1626a7
fixed merge duplication
cristianhosu be27e6b
Merge remote-tracking branch 'upstream/master'
cristianhosu 0f20e2e
merge
cristianhosu f16860f
Merge branch '#28617'
cristianhosu 02d5a9d
Merge branch 'master' into #28617
cristianhosu ee650e6
#28617 - added command to menu registry
cristianhosu ce7b823
#28617
cristianhosu 244df43
Merge branch 'master' into #28617
cristianhosu 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 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 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 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 |
---|---|---|
|
@@ -21,6 +21,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; | |
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; | ||
import URI from 'vs/base/common/uri'; | ||
import { IEditorOptions, Position as EditorPosition } from 'vs/platform/editor/common/editor'; | ||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; | ||
|
||
// --- List Commands | ||
|
||
|
@@ -422,4 +423,13 @@ export function registerCommands(): void { | |
return void 0; | ||
}); | ||
}); | ||
|
||
CommandsRegistry.registerCommand('_workbench.quickOpen', function (accessor: ServicesAccessor, args: [string]) { | ||
const quickOpenService = accessor.get(IQuickOpenService); | ||
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. Remove |
||
const [prefix] = args; | ||
|
||
return quickOpenService.show(prefix).then(() => { | ||
return void 0; | ||
}); | ||
}); | ||
} |
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 madness. Don't add a new command, replace the action with a command having the same id, register the command to the command palette. Don't add an API command
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 don't really think this is madness per se, but okay. I see what you mean. It's not okay to have both a command and an action that do the same thing. But for my piece of mind and since I've just started working on VS Code, can you please detail what;s the difference between an API command, a command and an action? what are they each used for?
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.
Sorry for being harsh. There is a world of debt and basically an action is a command with extras. A command is basically just a function with an identifier. Then we use that identifier to bind command execution to a user gesture, e.g. bind a keybinding to an identifier or bind a UI-botton to an identifier. These UI gestures basically all call
executeCommand
with their assigned id. That is why running exec-command from within an action is a double loop (the run is already the result of calling exec-command).A simple sample of registering a command (id to function) and a menu item (button to id) can be found here: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/html/browser/webview.ts#L28. Not shown in that sample, but commands have access to all services via the first argument passed to them.
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.
So, my recommendation is to turn the
GlobalQuickOpenCommand
into a namespace which export (as const) theID
. That is because others use the ID and you wanna keep things simple. Then inside the namespace you can just do the registration and things should just work. Let me know if there something I can help out with