microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.52k stars 28.99k forks source link

Parameter Hints shown inline all the time (like IntelliJ) #16221

Closed nbransby closed 2 years ago

nbransby commented 7 years ago

Would be useful for typescript: https://youtu.be/ZfYOddEmaRw

bzrncev commented 4 years ago

I just switched to VS Code and was missing this feature for PHP files, so I implemented it myself. Still in beta, but workable: https://marketplace.visualstudio.com/items?itemName=BobbyZrncev.intellij-parameter-hints

Thanks to @lannonbr for inspiration.

MelnCat commented 4 years ago

This feature would be extremely useful!

tbillington commented 4 years ago

For inspiration rust-analyzer is doing this in vscode today.

Screen Shot 2020-01-05 at 2 32 39 pm

jonit-dev commented 4 years ago

This feature would be great! Meanwhile, I'm using JS Parameter Annotations

JeromeDeLeon commented 4 years ago

This would be a really great feature. Please, hear us out. 🚀

liangjiancang commented 4 years ago

It has been 3 years!!!

pittersnider commented 4 years ago

This is very helpful and give us a large productivity scale.

mjbvz commented 4 years ago

We hear you... but these +1 comments are not productive. Locking to prevent more noise

Try https://marketplace.visualstudio.com/items?itemName=lannonbr.vscode-js-annotations in the meantime

abumalick commented 3 years ago

lannonbr's extension is deprecated.

There is this one available now: https://marketplace.visualstudio.com/items?itemName=liamhammett.inline-parameters

jonit-dev commented 3 years ago

I'm using this one, pretty good too:

Name: Parameter Hints Id: dominicvonk.parameter-hints Description: Automatic parameter hints Version: 0.2.7 Publisher: Dominic Vonk VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=DominicVonk.parameter-hints

jonlepage commented 3 years ago

I'm using this one, pretty good too:

Name: Parameter Hints Id: dominicvonk.parameter-hints Description: Automatic parameter hints Version: 0.2.7 Publisher: Dominic Vonk VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=DominicVonk.parameter-hints

wow, is the first one where i add and work the first time without config ! thanks for share ! look very clean for me and my theme, seem no bug ! image

mjbvz commented 3 years ago

Parameter name hints are now supported with TypeScript 4.4:

Screen Shot 2021-07-13 at 7 18 03 PM

TypeScript 4.4 will be picked up in the August VS Code release. To test this feature in the current VS Code insiders build:

  1. Either install the typescript nightly extension OR install typescript 4.4 locally and switch your workspace to use it
  2. Enable parameter hints by setting "typescript.inlayHints.parameterNames.enabled": "all" or "javascript.inlayHints.parameterNames.enabled": "all"

❗ Please give this feature a try and open new issues for any problems / feature requests related to it ❗


But wait, there's more!!!

In addition to parameter names, you can also turn on hints for:

These are all disabled by default in both JS and TS. Here's a look at a JS file showing some of those additional hints enabled:

Screen Shot 2021-07-13 at 7 31 55 PM

There are also two configurations you can use to control when parameter name hints are shown:

HighCommander4 commented 3 years ago

Parameter name hints are now supported with TypeScript 4.4

Out of curiosity, how does this work at the LSP layer? My understanding is the LSP protocol support hasn't been merged yet. Or does Typescript not use LSP?

jestarray commented 3 years ago

@mjbvz Can you link to how the inlay hints is implemented in the LSP for typescript? I'd like to do implement this for another language, thank you/

yume-chan commented 3 years ago

Or does Typescript not use LSP?

Correct, because TypeScript language server was created before the invention of LSP, it doesn't use LSP. TypeScript team doesn't want to switch to LSP because it will either break old clients or require maintaining two protocols.

In fact, Code also doesn't have built-in support for LSP. Code team has an official npm package to bridge between LSP features and Code extension APIs, that extension authors must install it themselves to make LSP servers work with Code.

silicakes commented 3 years ago

Or does Typescript not use LSP?

Correct, because TypeScript language server was created before the invention of LSP, it doesn't use LSP. TypeScript team doesn't want to switch to LSP because it will either break old clients or require maintaining two protocols.

In fact, Code also doesn't have built-in support for LSP. Code team has an official npm package to bridge between LSP features and Code extension APIs, that extension authors must install it themselves to make LSP servers work with Code.

Full LSP support is part of Typescripts official roadmap: https://github.com/microsoft/TypeScript/issues/39459

sschneider-ihre-pvs commented 3 years ago

How can I customize the inlay tokens with editor.tokenColorCusomizations ? what scope is it?

jrieken commented 3 years ago

Keeping this open to finalize the API

loilo commented 3 years ago

How can I customize the inlay tokens with editor.tokenColorCusomizations ? what scope is it?

@sschneider-ihre-pvs You cannot do this via editor.tokenColorCustomizations, but via workbench.colorCustomizations:

...

    "workbench.colorCustomizations": {
        "[My Theme]": {
            "editorInlayHint.foreground": "#FF0000",
            "editorInlayHint.background": "#FFFF00",
        }
    },

...

As documented here: https://code.visualstudio.com/api/references/theme-color

sschneider-ihre-pvs commented 3 years ago

I meant the inlay token font-style.

gjsjohnmurray commented 3 years ago

I meant the inlay token font-style.

Look at the editor.inlayHints.fontFamily setting.

sschneider-ihre-pvs commented 3 years ago

I did that already but I can't pick an italic style that is the reason I was asking for font-style.

trodix commented 3 years ago

Can we have support for inline parameters hint for others languages like Java ?

KamasamaK commented 3 years ago

Can we have support for inline parameters hint for others languages like Java ?

The API is not language-specific. The language extension authors will need to implement it when the API is finalized.

EDIT: See redhat-developer/vscode-java#2099 for the Java issue

TarunavBA commented 3 years ago

When will this feature be available for python?

alex-kinokon commented 3 years ago

Should be closed by #42089?

AmanRathoreM commented 2 years ago

See this StackOverflow question it is related to this issue if you know the answer then please tell

imShara commented 2 years ago

How to activate it in .vue components?

coder137 commented 2 years ago

Is there a way to activate this for the C/C++ codebases?

HighCommander4 commented 2 years ago

Is there a way to activate this for the C/C++ codebases?

With the clangd langugage server, yes (see this post for how to enable).

coder137 commented 2 years ago

Is there a way to activate this for the C/C++ codebases?

With the clangd langugage server, yes (see this post for how to enable).

Thanks this worked. Hopefully, there is an official VSCode supported C/C++ extension eventually as well

jrieken commented 2 years ago

The API has been finalised, the feature is implemented. All further work is tracked with the inlay-hints-label

jrieken commented 2 years ago

To verify ensure that registerInlayHintsProvider is in latest vscode.d.ts