Skip to content

Commit e1e880c

Browse files
committed
OCaml: Add information in the manual language docs for OCaml
CHANGELOG updated
1 parent 87ffe47 commit e1e880c

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Diff for: CHANGELOG.org

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* Add support for [[https://github.com/c3lang/c3c][c3 language]] (requires [[https://github.com/c3lang/c3-ts-mode][c3-ts-mode]] and [[https://github.com/pherrymason/c3-lsp][c3lsp]]).
3636
* Drop support for emacs 27.1 and 27.2
3737
* Add ~lsp-nix-nixd-server-arguments~ to allow passing arguments to the ~nixd~ LSP.
38+
* Improve the lsp-ocaml client (see [[https://github.com/emacs-lsp/lsp-mode/issues/4731][#4731]] for the follow-up issue. MRs: [[https://github.com/emacs-lsp/lsp-mode/pull/4741][#4741]], [[https://github.com/emacs-lsp/lsp-mode/pull/4732][#4732]])
3839

3940
** 9.0.0
4041
* Add language server config for QML (Qt Modeling Language) using qmlls.

Diff for: docs/manual-language-docs/lsp-ocaml.md

+28
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,34 @@ root_file: docs/manual-language-docs/lsp-ocaml.md
88

99
### Commands
1010

11+
#### `lsp-ocaml-type-enclosing`
12+
13+
Gets the type of ident under the cursor. It will highlight the ident and display its type.
14+
15+
When this function is called it will create a transient keymap `lsp-ocaml-type-enclosing-map` that allows to do the following things:
16+
- Increase/decrease the number of aliases expansions. As an example, suppose we want to type `h` in the following expression:
17+
```ocaml
18+
type t = A | B
19+
let h : t = A
20+
```
21+
- The lowest verbosity will give `type t`
22+
- The next verbosity will give `type t = A | B`
23+
- Go up/down the enclosing type (bound to `C-<up>/<down>` by default). As an example:
24+
```ocaml
25+
module A = struct
26+
let h : t = A
27+
let f () = ()
28+
29+
(** Test doc *)
30+
let g (f: 'a -> 'b) a = f a
31+
end
32+
```
33+
- Typing on the last `a` will show `'a`
34+
- Going up will highlight `f a` of type `'b`
35+
- Going up will highlight `(f: 'a -> 'b) a = f a` of type `('a -> 'b) -> 'a -> 'b`
36+
- Going up will highlight the whole module and display its entire type
37+
- Copy the current type (bound to `C-w` by default)
38+
1139
#### `lsp-ocaml-find-alternate-file`
1240

1341
Find the interface corresponding to an implementation or the implementation corresponding to an interface.

0 commit comments

Comments
 (0)