Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

- Add mlx language support to document selector
- Enable AST editor for mlx files
- Enable switching between implementation and interface for mlx files
- Add keybindings for OCaml.mlx language

## 1.32.4

- Fix editor focus condition for interface file keybindings. Previously,
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -785,84 +785,84 @@
{
"command": "ocaml.switch-impl-intf",
"key": "Alt+O",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "editor.action.codeAction",
"key": "Alt+D",
"args": {
"kind": "destruct (enumerate cases)"
},
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.construct",
"key": "Alt+C",
"args": {
"kind": "construct"
},
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.jump",
"key": "Alt+J",
"args": {
"kind": "jump"
},
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "editor.action.codeAction",
"key": "Alt+P",
"args": {
"kind": "inferred_intf"
},
"when": "editorLangId == ocaml.interface || editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.evaluate-selection",
"key": "Shift+Enter",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.next-hole",
"key": "Alt+Y",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.prev-hole",
"key": "Shift+Alt+Y",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.ocamllex || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.reveal-ast-node",
"key": "Alt+N",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.switch-hover-mode",
"key": "Alt+H",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.search-by-type",
"key": "Alt+F",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.type-selection",
"key": "Alt+T",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.type-previous-selection",
"key": "Shift+Alt+T",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.augment-selection-type-verbosity",
"key": "Alt+V",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == ocaml.mlx)"
}
],
"languages": [
Expand Down Expand Up @@ -1089,7 +1089,7 @@
{
"command": "ocaml.evaluate-selection",
"group": "OCaml",
"when": "editorTextFocus && editorLangId == ocaml || editorTextFocus && editorLangId == ocaml.interface || editorTextFocus && editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.reveal-ast-node",
Expand All @@ -1104,11 +1104,11 @@
},
{
"command": "ocaml.next-hole",
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.prev-hole",
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)"
},
{
"command": "ocaml.refresh-switches",
Expand Down Expand Up @@ -1168,7 +1168,7 @@
},
{
"command": "ocaml.search-by-type",
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason"
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we could probably add editorTextFocus for correctness

},
{
"command": "ocaml.navigate-typed-holes",
Expand All @@ -1179,7 +1179,7 @@
{
"command": "ocaml.switch-impl-intf",
"key": "Alt+O",
"when": "editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason",
"when": "editorTextFocus && (editorLangId == ocaml || editorLangId == ocaml.interface || editorLangId == reason || editorLangId == ocaml.mlx)",
"group": "navigation"
}
],
Expand Down
1 change: 1 addition & 0 deletions src/ast_editor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ end = struct
match Stdlib.Filename.extension relative with
| ".ml" -> Structure `Ocaml
| ".re" -> Structure `Reason
| ".mlx" -> Structure `Ocaml
| ".mli" -> Signature `Ocaml
| ".rei" -> Signature `Reason
| _ -> Unknown
Expand Down
1 change: 1 addition & 0 deletions src/extension_instance.ml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ end = struct
; language "ocaml.ocamllex"
; language "ocaml.menhir"
; language "reason"
; language "ocaml.mlx"
|]
in
let (lazy outputChannel) = Output.language_server_output_channel in
Expand Down
4 changes: 3 additions & 1 deletion src/switch_impl_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ open Import
let insert_inferred_intf ~source_uri client text_editor =
let open Promise.Syntax in
match
String.is_suffix source_uri ~suffix:".ml" || String.is_suffix source_uri ~suffix:".re"
String.is_suffix source_uri ~suffix:".ml"
|| String.is_suffix source_uri ~suffix:".re"
|| String.is_suffix source_uri ~suffix:".mlx"
with
| false -> Promise.return ()
| true ->
Expand Down