-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
How do I make a command that only appears in the command pallet when my extension is loaded? #10401
Comments
You can actually not... Today all commands are known upfront to decouple UI for a command from the actual command implementation. We do that to prevent eager loading of the world. I do understand tho that you want some additions after the fact... |
PoSh "Expand Alias" is listed in there and just fails with "command not found" when the extension isn't loaded. Does this seem like a reasonable behaviour to copy for now (eg. don't add it to
Registering a command in |
Well, This is a fair feature request, at least the F1 commands list should be dynamic in some way |
Without any changes here -- is there anyway today to have an extension get rid of command defined in Is there another (better) way to get this to work for the menus and/or the command palette? |
With #19345 (comment) we added the ability to show a command only in some cases |
@jrieken that sounds great -- but is there another way to use |
Yeah, we have an half-official command that lets you set custom context keys but it needs some doc. I'll make we have proper docs when this happens |
Great! FYI -- I'd be happy with only half-official docs too ;) |
:-) there is the |
@jrieken that changes everything! ;) Thank you! |
Glad you like it. We have a request to APIify the context keys et al but this will work for now |
@jrieken Is there any example of this? I'm not sure how to make it work? I can set a context at startup but can I add |
@DanTup You can see an example of this here and here. Seems to work in both stable and insiders. I have also added the new Hope that helps -- if not let me know. Also make sure you are using |
Yeah I spotted the typo (also |
* limit to 5 keywords * cleanup gutters config * fix icon * update colours, activate on ide open and menu adds * use setContext undocumented command for custom UI microsoft/vscode#19345 (comment) microsoft/vscode#10401 * set default true for removeCoverage context menu * fix extension.test * add settings grid * add proper test for extension activate on open * increment version
@eamodio @jrieken Sorry to be a pain, but I still can't make this work :( Here's the changes I've made - I've added |
ok, so I should've re-read my previous comment - I did the same thing (put in command definitions). However, even if I add them to the menus parts they won't work. Unfortunately the samples linked above don't match up now because they weren't linked to specific versions and the code has all moved around. Any pointers appreciated! |
Ok, sorted this out - I was missing the |
Yeah, closing this issue because we have the |
I'd like to some commands that only appear when a Dart project is open (eg. my extension is activated). If I add a command to
packages.json
it seems to always be available in the command pallet. (These commands are equiv ofnuget restore
etc., you wouldn't want them visible when you open a Perl project, for example).I'm sure I'm missing something; but I just can't figure out how to control this :(
The text was updated successfully, but these errors were encountered: