# Type annotations in vscode

**URL:** <https://discuss.ocaml.org/t/type-annotations-in-vscode/16204>\
**Category:** Ecosystem\
**Tags:** vscode\
**Created:** [February 28, 2025, 12:55pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204 "2025-02-28T12:55:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![threepwood](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@threepwood](https://discuss.ocaml.org/u/threepwood)\
**Post date:** [February 28, 2025, 12:55pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204/1 "2025-02-28T12:55:46Z")

</div>

I just noticed that vscode started adding greyed-out type hints for function parameters, e.g. `fun c: char -> ...` (where the `: char` part is not something I typed). Does anyone know how to get rid of this? When I look it up I find instructions to turn off “codelens” but I already did so (and it was doing something different, type annotations above function definitions).

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [February 28, 2025, 1:18pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204/2 "2025-02-28T13:18:16Z")

</div>

These are called “inlay hints” I am told by a VS Code-using colleague. You should be able to disable them in your preferences.

Cheers,  
Nicolas

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [February 28, 2025, 1:21pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204/3 "2025-02-28T13:21:24Z")

</div>

These were introduced in [Preliminary inlay hint support by jfeser · Pull Request #1159 · ocaml/ocaml-lsp · GitHub](https://github.com/ocaml/ocaml-lsp/pull/1159), by the way.

Cheers,  
Nicolas

---

<div class="post-metadata">

**Author:** ![threepwood](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@threepwood](https://discuss.ocaml.org/u/threepwood)\
**Post date:** [February 28, 2025, 1:58pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204/4 "2025-02-28T13:58:04Z")

</div>

Thank you, that did it.

I like vscode and the ocaml extension but it’s annoying to have to turn off the latest gimmick (and first find out what it’s called) every few months…

---

<div class="post-metadata">

**Author:** ![user1](https://avatars.discourse-cdn.com/v4/letter/u/5daacb/32.png) [@user1](https://discuss.ocaml.org/u/user1)\
**Post date:** [December 26, 2025, 3:23pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204/5 "2025-12-26T15:23:50Z")

</div>

> Thank you, that did it.

Can you tell what “did it”?

I cannot find anything related to “inlay hints” (or related keywords) in vscode settings. I added all of the following lines to settings.json but type hints still appear:

```json
    "ocaml.inlayHints.enable": false,
    "editor.inlayHints.enabled": "off",
    "ocaml.lsp.typeHints.enable": false,
    "ocaml.trace.server": "off",
    "editor.semanticHighlighting.enabled": false
}

```

---

<div class="post-metadata">

**Author:** ![threepwood](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@threepwood](https://discuss.ocaml.org/u/threepwood)\
**Post date:** [December 26, 2025, 3:43pm UTC](https://discuss.ocaml.org/t/type-annotations-in-vscode/16204/6 "2025-12-26T15:43:31Z")

</div>

For me it appears in the settings GUI. The json line is `"editor.inlayHints.enabled": "off"`.

To set this only for `.ml` files you need to put it in a `"[ocaml]": { ... }` block. I also have `"editor.codeLens": false` in there, to disable some earlier form of intrusive type annotations (I do not know if it still does something).
