josa42 / coc-go

Go language server extension using gopls for coc.nvim.
MIT License
566 stars 30 forks source link

feat: Inlay hints support #187

Closed yaegassy closed 2 years ago

yaegassy commented 2 years ago

Description

Recent gopls updates support inlay hints. I added support for inlay hints in coc-go.

"v0.0.81" is required to smoothly add inlay hints feature in coc.nvim. Upgraded coc.nvim to "v0.0.81" with existing coc-go and made necessary adjustments. (e.g. disabledFeatures)

DEMO (mp4)

coc-settings.json:

  "go.goplsOptions": {
    // ...snip
    "hints": {
      "constantValues": true,
      "parameterNames": true,
      "rangeVariableTypes": true,
      "assignVariableTypes": true,
      "compositeLiteralTypes": true,
      "compositeLiteralFields": true,
      "functionTypeParameters": true
    },
    // ...snip
  },

https://user-images.githubusercontent.com/188642/179625098-b95adeee-6b1d-4182-a925-870930b1fa1c.mp4

yaegassy commented 2 years ago

@josa42 gentle ping

yaegassy commented 2 years ago

Recent updates to coc.nvim allow inaly hints to be used without additional processing on the coc-extension side if the language server supports inlay hints.

If coc.nvim is up to date, inlay hints are available. This coc-go's PR itself will be closed.