Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inlay hints plugin #4131

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Add inlay hints plugin #4131

wants to merge 6 commits into from

Conversation

jetjinser
Copy link

@jetjinser jetjinser commented Mar 10, 2024

inlay hints usages: #2938.

task list

misc:

  • tests
  • detail config or version option (still updating)

feat:

  • fixity
  • local (let) binding
  • implicit imports list
  • lambda arguments
  • function arguments
  • do block binding
  • record names in positional record construction
  • holes ^[1]

[1]: It is currently impossible to find holes deterministically in HieASTs, so the current implementation is actually "type with an Unbound Var". There are two solutions I can think of: 1) modify GHC; 2) regex diagnostic.

config

The plugin configuration looks like this (neovim/lua):

settings = {
  haskell = {
    formattingProvider = "stylish-haskell",
    plugin = {
      ["inlay-hints"] = {
        config = {
          -- All inlay hints are disabled default

          -- enable all inlay hints
          all = true,

          -- or enable individually
          fixity = true,
          localBinding = true,
          -- hole = true,
        },
      },
    },
  },
},

The usages of inlay hints is still under public discussion

preview

fixity fixity
fixity + local binding (`let`) fixity + local binding
fixity + local binding (`let`) + hole type fixity + local binding + hole type

@jetjinser jetjinser mentioned this pull request Mar 10, 2024
@soulomoon soulomoon added the GSoC Possible GSoC idea label Mar 10, 2024
@soulomoon
Copy link
Collaborator

soulomoon commented Mar 10, 2024

Looking good.
We have an inlay hints GSoC candidate @michaelpj

@michaelpj
Copy link
Collaborator

This looks like a good proof-of-concept!

We'll definitely want to make this configurable - I suspect most people won't want fixities everywhere in their editor

Fixity information is now available in the inlay hints plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Possible GSoC idea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants