neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.15k stars 953 forks source link

feat(inlayHint): add `inlayHint.position` configuration #5060

Closed de-vri-es closed 1 week ago

de-vri-es commented 1 week ago

This PR adds an option to move all inlay hints to after the original text.

Personally, I find hints inside the source code very distracting. And they make the code look much wider than it really is, which I personally do not like.

This option allows to restore the old behavior where all hints were displayed at the end of a line.

fannheyward commented 1 week ago

Thank you for your PR! Please change the configuration to inlayHint.position, with inline and eol options.

https://github.com/neoclide/coc.nvim/issues/4740

de-vri-es commented 1 week ago

Switched to use config instead of _config directly, should fix the test failure.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.49%. Comparing base (e4abae7) to head (4a59637).

Files Patch % Lines
src/handler/inlayHint/buffer.ts 33.33% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5060 +/- ## ========================================== - Coverage 98.52% 98.49% -0.03% ========================================== Files 273 273 Lines 26081 26084 +3 Branches 5389 5390 +1 ========================================== - Hits 25696 25692 -4 - Misses 226 232 +6 - Partials 159 160 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

de-vri-es commented 1 week ago

Hmm, can the test failure on nightly be related to this PR, or is it flaky? :o

de-vri-es commented 1 week ago

Thanks! :partying_face:

SeniorMars commented 1 week ago

I know this is a lot to ask but we used to be able to add an icon and color of the inlay hints in our cocconfig. Would it be possible to support those features as well?

de-vri-es commented 1 week ago

You can configure the color by changing the CocInlayHint, CocInlayHintType and/or CocInlayHintParameter syn/highlight groups (from :help coc-inlayHint).

Icon I dunno.

SeniorMars commented 1 week ago

I should probably make this an issue, but I'm not sure we want to support this.

In either case before (a long time ago), we used to have the following options.

 "codeLens.separator": " ",
  "codeLens.subseparator": " | ",
  "inlayHint.typeSeparator": "‣ ",
  "inlayHint.parameterSeparator": "‣ ",
fannheyward commented 1 week ago

@SeniorMars the separator configuration has been removed and has no plan to add back, because language server will add separator like : with inlay hint, we don't want to do omitting/replacing work in client side.