Skip to content

Commit e946931

Browse files
authored
Fix keybinding when conditions and unsupported language filters (#1985)
Explicitly add editorTextFocus to each language condition in keybindings to ensure correct operator precedence. Previously, conditions like `editorTextFocus && editorLangId == ocaml || editorLangId == reason` were ambiguous and could activate incorrectly. Remove `ocaml.ocamllex` and `ocaml.menhir` from `switch-impl-intf` command. The implementation only supports `.ml` and `.re` files for switching between implementation and interface. Remove `ocaml.ocamllex` and `ocaml.menhir` from `evaluate-selection` command. These file types contain specialised syntax not suitable for REPL evaluation. Signed-off-by: Sora Morimoto <[email protected]>
1 parent ecf77ad commit e946931

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
(`construct`, `next-hole`, `prev-hole`, `search-by-type`,
1212
`copy-type-under-cursor`) were incorrectly enabled for `.mll` files and
1313
have been removed. (#1984)
14+
- Fix keybinding conditions to ensure correct language support. Explicitly add
15+
`editorTextFocus` to each language condition to clarify operator precedence.
16+
Remove `ocaml.ocamllex` and `ocaml.menhir` from `switch-impl-intf` and
17+
`evaluate-selection` commands as these languages are not supported by those
18+
features. (#1985)
1419

1520
## 1.32.3
1621

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -785,31 +785,31 @@
785785
{
786786
"command": "ocaml.switch-impl-intf",
787787
"key": "Alt+O",
788-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.menhir"
788+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
789789
},
790790
{
791791
"command": "editor.action.codeAction",
792792
"key": "Alt+D",
793793
"args": {
794794
"kind": "destruct (enumerate cases)"
795795
},
796-
"when": "editorLangId == ocaml || editorLangId == reason"
796+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == reason"
797797
},
798798
{
799799
"command": "ocaml.construct",
800800
"key": "Alt+C",
801801
"args": {
802802
"kind": "construct"
803803
},
804-
"when": "editorLangId == ocaml || editorLangId == reason"
804+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == reason"
805805
},
806806
{
807807
"command": "ocaml.jump",
808808
"key": "Alt+J",
809809
"args": {
810810
"kind": "jump"
811811
},
812-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
812+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
813813
},
814814
{
815815
"command": "editor.action.codeAction",
@@ -822,17 +822,17 @@
822822
{
823823
"command": "ocaml.evaluate-selection",
824824
"key": "Shift+Enter",
825-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason || editorTextFocus && editorLangId == ocaml.ocamllex || editorTextFocus && editorLangId == ocaml.menhir"
825+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
826826
},
827827
{
828828
"command": "ocaml.next-hole",
829829
"key": "Alt+Y",
830-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
830+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
831831
},
832832
{
833833
"command": "ocaml.prev-hole",
834834
"key": "Shift+Alt+Y",
835-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
835+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
836836
},
837837
{
838838
"command": "ocaml.reveal-ast-node",
@@ -847,7 +847,7 @@
847847
{
848848
"command": "ocaml.search-by-type",
849849
"key": "Alt+F",
850-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
850+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
851851
},
852852
{
853853
"command": "ocaml.type-selection",
@@ -1089,7 +1089,7 @@
10891089
{
10901090
"command": "ocaml.evaluate-selection",
10911091
"group": "OCaml",
1092-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason || editorTextFocus && editorLangId == ocaml.ocamllex || editorTextFocus && editorLangId == ocaml.menhir"
1092+
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
10931093
},
10941094
{
10951095
"command": "ocaml.reveal-ast-node",
@@ -1179,7 +1179,7 @@
11791179
{
11801180
"command": "ocaml.switch-impl-intf",
11811181
"key": "Alt+O",
1182-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.menhir",
1182+
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason",
11831183
"group": "navigation"
11841184
}
11851185
],

0 commit comments

Comments
 (0)