Skip to content

Commit b703c47

Browse files
authored
Enable mlx in documentSelector and a few small features (#1964)
* documentSelector includes mlx * Add entrylog for mlx * Add ocaml.mlx into keybindings * Enalbe shiwting impl/intf for mlx * Enalbe AST editor for mlx * Add changelog entires * Make sure editorTextFocus and editorLangId works together * Remove ocamllex and mehir from ocaml.switch-impl-intf * Fix identation on ocaml.prev-hole * Fix identation on ocaml.search-by-type * Add editorTextFocus in ocaml.next-hole|prev-hole * Remove ocamllex from ocaml.search-by-type
1 parent 8019372 commit b703c47

File tree

5 files changed

+29
-20
lines changed

5 files changed

+29
-20
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
- Add mlx language support to document selector
6+
- Enable AST editor for mlx files
7+
- Enable switching between implementation and interface for mlx files
8+
- Add keybindings for OCaml.mlx language
9+
510
## 1.32.4
611

712
- Fix editor focus condition for interface file keybindings. Previously,

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -785,84 +785,84 @@
785785
{
786786
"command": "ocaml.switch-impl-intf",
787787
"key": "Alt+O",
788-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
788+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
789789
},
790790
{
791791
"command": "editor.action.codeAction",
792792
"key": "Alt+D",
793793
"args": {
794794
"kind": "destruct (enumerate cases)"
795795
},
796-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == reason"
796+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == reason || editorLangId == ocaml.mlx)"
797797
},
798798
{
799799
"command": "ocaml.construct",
800800
"key": "Alt+C",
801801
"args": {
802802
"kind": "construct"
803803
},
804-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == reason"
804+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == reason || editorLangId == ocaml.mlx)"
805805
},
806806
{
807807
"command": "ocaml.jump",
808808
"key": "Alt+J",
809809
"args": {
810810
"kind": "jump"
811811
},
812-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
812+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
813813
},
814814
{
815815
"command": "editor.action.codeAction",
816816
"key": "Alt+P",
817817
"args": {
818818
"kind": "inferred_intf"
819819
},
820-
"when": "editorLangId == ocaml.interface || editorLangId == reason"
820+
"when": "editorTextFocus && (editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
821821
},
822822
{
823823
"command": "ocaml.evaluate-selection",
824824
"key": "Shift+Enter",
825-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
825+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
826826
},
827827
{
828828
"command": "ocaml.next-hole",
829829
"key": "Alt+Y",
830-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
830+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.mlx)"
831831
},
832832
{
833833
"command": "ocaml.prev-hole",
834834
"key": "Shift+Alt+Y",
835-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
835+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.mlx)"
836836
},
837837
{
838838
"command": "ocaml.reveal-ast-node",
839839
"key": "Alt+N",
840-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
840+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
841841
},
842842
{
843843
"command": "ocaml.switch-hover-mode",
844844
"key": "Alt+H",
845-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
845+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
846846
},
847847
{
848848
"command": "ocaml.search-by-type",
849849
"key": "Alt+F",
850-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
850+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
851851
},
852852
{
853853
"command": "ocaml.type-selection",
854854
"key": "Alt+T",
855-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
855+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
856856
},
857857
{
858858
"command": "ocaml.type-previous-selection",
859859
"key": "Shift+Alt+T",
860-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
860+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
861861
},
862862
{
863863
"command": "ocaml.augment-selection-type-verbosity",
864864
"key": "Alt+V",
865-
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
865+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
866866
}
867867
],
868868
"languages": [
@@ -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"
1092+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
10931093
},
10941094
{
10951095
"command": "ocaml.reveal-ast-node",
@@ -1104,11 +1104,11 @@
11041104
},
11051105
{
11061106
"command": "ocaml.next-hole",
1107-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
1107+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
11081108
},
11091109
{
11101110
"command": "ocaml.prev-hole",
1111-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
1111+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
11121112
},
11131113
{
11141114
"command": "ocaml.refresh-switches",
@@ -1168,7 +1168,7 @@
11681168
},
11691169
{
11701170
"command": "ocaml.search-by-type",
1171-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
1171+
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx"
11721172
},
11731173
{
11741174
"command": "ocaml.navigate-typed-holes",
@@ -1179,7 +1179,7 @@
11791179
{
11801180
"command": "ocaml.switch-impl-intf",
11811181
"key": "Alt+O",
1182-
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason",
1182+
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)",
11831183
"group": "navigation"
11841184
}
11851185
],

src/ast_editor.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ end = struct
6868
match Stdlib.Filename.extension relative with
6969
| ".ml" -> Structure `Ocaml
7070
| ".re" -> Structure `Reason
71+
| ".mlx" -> Structure `Ocaml
7172
| ".mli" -> Signature `Ocaml
7273
| ".rei" -> Signature `Reason
7374
| _ -> Unknown

src/extension_instance.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ end = struct
169169
; language "ocaml.ocamllex"
170170
; language "ocaml.menhir"
171171
; language "reason"
172+
; language "ocaml.mlx"
172173
|]
173174
in
174175
let (lazy outputChannel) = Output.language_server_output_channel in

src/switch_impl_intf.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ open Import
33
let insert_inferred_intf ~source_uri client text_editor =
44
let open Promise.Syntax in
55
match
6-
String.is_suffix source_uri ~suffix:".ml" || String.is_suffix source_uri ~suffix:".re"
6+
String.is_suffix source_uri ~suffix:".ml"
7+
|| String.is_suffix source_uri ~suffix:".re"
8+
|| String.is_suffix source_uri ~suffix:".mlx"
79
with
810
| false -> Promise.return ()
911
| true ->

0 commit comments

Comments
 (0)