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

Implement inlay hints #300

Closed
resolritter opened this issue Jul 5, 2021 · 6 comments
Closed

Implement inlay hints #300

resolritter opened this issue Jul 5, 2021 · 6 comments
Labels
wontfix This will not be worked on

Comments

@resolritter
Copy link

resolritter commented Jul 5, 2021

Announcement: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#inlay-hints
Linked PR: microsoft/TypeScript#42089 (was already merged)

I believe this has not yet landed on a stable release although 4.4 is scheduled for next month already

@chemzqm
Copy link
Member

chemzqm commented Jul 6, 2021

It's not possible to add inline virtual text on both vim and neovim, so send your feature request to vim/neovim fist.

@chemzqm chemzqm added the wontfix This will not be worked on label Jul 6, 2021
@resolritter
Copy link
Author

It could work with virtual text at the end of the line in Neovim, like coc-rust-analyzer

@fannheyward
Copy link
Member

I'll take a look on this after TS 4.4 released. There're several works:

  1. tsserver makes its own inlayHint protocol implementation, but LSP is working on a new/standard protocol on Add proposed textDocument/inlayHints to protocol & client. microsoft/vscode-languageserver-node#772
  2. display with virtual text, it works but not perfect, this needs vim/nvim more works

@fannheyward
Copy link
Member

Test code:

// enumMemberValues
enum E1 {
  A,
  B,
}

enum E2 {
  A = 0,
  B = 1,
}

// functionLikeReturnTypes
function foo() {
  return Date.now()
}

function bar(): number {
  return Date.now()
}

// parameterNames
parseInt('123', 8)

// parameterTypes
document.addEventListener('click', e => {
  console.log(e)
})

// propertyDeclarationTypes
class Bar {
  prop = Date.now;
}

// variableTypes
const xxf = Date.now()

In VSCode:

截屏2021-08-09 下午6 26 39

In coc, only enumMemberValues, functionLikeReturnTypes and variableTypes are enabled.

截屏2021-08-09 下午6 29 58

Because we can't set inline virtual text, parameterNames, parameterTypes and propertyDeclarationTypes are disabled.

@chemzqm any thoughts on this? Do we need to add this in coc-tsserver?

@fannheyward
Copy link
Member

The variableTypes hints should be disabled too.

@hadnet
Copy link

hadnet commented Nov 19, 2021

How is this going, guys? Any updates? When can we use this feature?

fannheyward added a commit to fannheyward/coc-tsserver that referenced this issue Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants