scalameta / nvim-metals

A Metals plugin for Neovim
https://scalameta.org/metals/
Apache License 2.0
466 stars 75 forks source link

Add support for inlayHints settings #666

Closed perrin4869 closed 1 week ago

perrin4869 commented 5 months ago

Describe the feature

https://scalameta.org/metals/docs/editors/user-configuration#should-display-type-annotations-for-inferred-types Right now we get an error message:

[nvim-metals] "inlayHints" is not a valid setting. It will be ignored.

Potential ways to implement

No response

KristianAN commented 5 months ago

Can this be implemented before Neovim 0.10? Afaik the lsp.inlay_hint feature is not stable yet.

jqno commented 2 months ago

I've tried this in Neovim 0.10, and inlay hints already seem to be working. You can enable the inlay hints using vim.lsp.inlay_hints.enable(true). In the metals configuration, you'll have to enable some nvim-metals settings that seem to correspond with the Metals settings from the link in the OP:

There doesn't seem to be one that matches with inlayHints.hintsInPatternMatch.enable.

ckipp01 commented 2 weeks ago

Included in https://github.com/scalameta/nvim-metals/pull/689.

taras-biletskyi commented 2 weeks ago

Adding this to the config does not seem to work for me 🤔

inlayHints = {
  hintsInPatternMatch = { enable = true },
  implicitArguments = { enable = true },
  implicitConversions = { enable = true },
  inferredTypes = { enable = true },
  typeParameters = { enable = true },
}

Metals is latest.snapshot (1.3.5+118-eb2cdb82-SNAPSHOT) and scala version 2.13.12 in the build. No errors in logs either. Is there something else to be done for this to work?