Skip to content

Add context keys for platforms - #54894

Merged
Benjamin Pasero (bpasero) merged 2 commits into
masterfrom
tyriar/8962
Aug 7, 2018
Merged

Benjamin Pasero (bpasero) merged 2 commits into
masterfrom
tyriar/8962

Conversation

@Tyriar

Copy link
Copy Markdown
Contributor

Fixes #8962


This allows the following when clauses:

  • "when": "isLinux"
  • "when": "isMac"
  • "when": "isWindows"
  • "when": "!isLinux" (isMac || isWindows)
  • "when": "!isMac" (isLinux || isWindows)
  • "when": "!isWindows" (isLinux || isMac)

@alexdima

Copy link
Copy Markdown
Member

👍

@alexdima Alexandru Dima (alexdima) removed their assignment Jul 30, 2018
@alexdima

Copy link
Copy Markdown
Member

This PR will make PR #45995 obsolete

@gandalfsaxe

Gandalf Saxe (gandalfsaxe) commented Aug 14, 2018 •

Copy link
Copy Markdown

Does this work for settings as well? Or should I make a separate issue for that?

Awesome feature by the way!

@Tyriar

Copy link
Copy Markdown
Contributor Author

Gandalf Saxe (@gandalfsaxe) it doesn't work for settings as they don't support when clauses, I image the solution there would look similar to language-specific settings:

{
  [os=linux]: {
    blah
  }
}

I think there's an issue tracking this.

@gandalfsaxe

Copy link
Copy Markdown

Daniel Imms (@Tyriar) That makes sense. That'd be really great to have!

I don't think there is an existing issue. The only I could find was #5595, which was closed with reference to the very issue this PR fixed, #8962. Unless you can find a relevant issue, I'll make a new one shortly 🙂

@Tyriar

Copy link
Copy Markdown
Contributor Author

Gandalf Saxe (@gandalfsaxe) I opened that issue, thanks.

@gandalfsaxe

Gandalf Saxe (gandalfsaxe) commented Aug 16, 2018 •

Copy link
Copy Markdown

Daniel Imms (@Tyriar) Did this PR stop working? I can make a separate issue, but they don't seem to work for me anymore. It's like they're completely ignored now.

See the following video, where I try to set a shortcut for git.clean (discard):

I'm on latest 1.27 Insiders btw.

@Tyriar

Copy link
Copy Markdown
Contributor Author

Gandalf Saxe (@gandalfsaxe) seems to be working for me? 😕

Does the actual keybinding work? Maybe it's an issue with the context menu?

@gandalfsaxe

Copy link
Copy Markdown

Daniel Imms (@Tyriar) Sorry I was too quick there. I did a bit of testing, and it turned out to be quite a subtle issue not related to this PR at all - it seems to work perfectly.

I tried to use ⌃⌘D as a shortcut, and it turnes out that this is an undocumented global shortcut for looking up the selected word in the macOS Dictionary app. But it doesn't show up in System Preferences -> Keyboard -> Shortcuts. Instead you have to run a terminal command and restart: https://apple.stackexchange.com/questions/22785/how-do-i-disable-the-command-control-d-word-definition-keyboard-shortcut-in-os-x

It seems like some other people were affected by this in Emacs. Good to know, and bad on Apple for hiding this shortcut so thoroughly. Anyway, the when clause works fine 🙂

Btw It seems like the issue with the context menu illustrated above is half fixed:

  • It no longer shows the Windows shortcut when there is a Mac shortcut also
  • However if only a Windows shortcut is set, it does show this even There is still a bit of an issue in that the context menu show the Windows shortcut even though it doesn't actually work - so it's cosmetic, but misleading.

@Tyriar

Copy link
Copy Markdown
Contributor Author

SteVen Batten (@sbatten) keybindings that don't match the context are showing in the context menu? See #54894 (comment)

@sbatten

Copy link
Copy Markdown
Member

Daniel Imms (@Tyriar) yea, I just tested this on an old 1.22 build, it looks like the context menus and application menu ignore context for keybindings.

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OS Specific Keybindings

5 participants