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

mrmlnc commented 7 years ago

Just a tip:

VS Code have Hover and SignatureHelp tips:

Hover

image

SignatureHelp

image

waderyan commented 7 years ago

@nbransby thanks for opening this up. I watched the video... what specifically are you missing? VS Code does provide parameter hints as @mrmlnc shows in his screenshots.

nbransby commented 7 years ago

inline parameters hints aka the args names prefixed on each value passed into a function invocation swift / objective c style. I think its a great idea to bring this to other languages, and its a perfect feature for an ide to take care of instead of actually introducing it to the language.

waderyan commented 7 years ago

@nbransby can you show me a screenshot? This is what we do today and I'm not seeing how what you are suggesting (args names prefixed on each value passed into a function invocation) is different:

image

nbransby commented 7 years ago

Difference is that its inline in the editor and present at all times - not in a popup

image

waderyan commented 7 years ago

Ok interesting. Thank you for clarifying.

balta2ar commented 6 years ago

For the record, here is child issue in vscode-python that I think depends on this one: https://github.com/Microsoft/vscode-python/issues/53

phiresky commented 6 years ago

Note that this is already possible using decorations:

image

Adapting this sample:

vscode.window.createTextEditorDecorationType({
        before: {
            contentText: "myParam:",
            border: "1px solid gray",
            backgroundColor: "#333",
            margin: "1px",
            textDecoration: "test",
        }
    });

I'm not sure how to get information from the running typescript language server though...

phiresky commented 6 years ago

I'm not sure how to get information from the running typescript language server though...

Looks like this is not possible. Other plugins that manipulate typescript either use regexes (typescript importer), a separate Typescript parser (Typescript Hero) or load the files into the typescript compiler themselves (Move TS). None of these methods really seem viable for this problem...

shiMusa commented 6 years ago

Please make this a simple to install extension! <3 <3 <3 :3

lannonbr commented 6 years ago

So I've wanted this feature in VS Code as well and I ended up making it myself. I currently support JS files at the moment but am interested in adding support for other languages in the future.

Here's a example of it being used in an example JS file:

JS Param Hints / Annotations

Here's the extension: https://marketplace.visualstudio.com/items?itemName=lannonbr.vscode-js-annotations

krulik commented 6 years ago

Looking for such an extension for Golang

DJMcNab commented 6 years ago

This feature looks really useful - has it been considered for the language server protocol?

Using @phiresky's example, this could be done through the semantic highlighting api - see Microsoft/language-server-protocol#18, Microsoft/language-server-protocol#513, etc. for the proposals.

However, in my opinion contentText is an implementation oddity, and the protocol should not require all editors to support that part of the diagnostics api. Indeed, Microsoft/language-server-protocol#513 would not support this as it uses textmate scopes. Therefore, it should probably be a seperate feature similar in use to textDocument/publishDiagnostics.

CC. @dbaeumer, who appears to manage the language-server-protocol repo. A tracking/discussion issue there would probably be useful too, with your blessing.

As a further note https://github.com/rust-lang/rfcs/issues/323#issuecomment-391735876 discusses a further use for this to supercede keyword args in Rust.

vbasky commented 6 years ago

Is there any plan to support this feature in VSCode any time soon ?

Sioxas commented 5 years ago

Looking for such an extension for Java

brunolemos commented 5 years ago

WebStorm 2018.3 just added this for javascript files:

autoimports-in-javascript-816 2x

We'd love to get this on vscode as well, especially for typescript.

lannonbr commented 5 years ago

@brunolemos If you scroll up a little in this thread, I made a VS Code extension that currently does this for JS / TS.

ColCh commented 5 years ago

@lannonbr that extension not works with TS files, right?

image

brunolemos commented 5 years ago

@lannonbr thanks! It's a great alternative for now, unfortunately there's some pain points that would be great to be addressed:

sagebind commented 5 years ago

It would be neat for something very similar, to add decorators for inferred types (which we already know from language servers). Again as an example, taken from IntelliJ:

This information we already have on hover, this is just a way to do the same thing using decorations.

kjeremy commented 5 years ago

Hover doesn't have to display the type, it's just encouraged to in the protocol spec so you would need a different mechanism. I'm wondering if we can use #66418 for this?

goxr3plus commented 5 years ago

What happened ? I am waiting for this in Java ? Is it implemented :) ? Even Eclipse has it now ... https://github.com/angelozerr/jdt-codemining

kresdjan commented 5 years ago

I am missing this feature so much. I really hope they will implement it.

cipri-tom commented 5 years ago

The main advantage of this feature is that it allows you to see the parameter hints without masking the code above it. Currently, the parameter hints make it difficult to look at the lines just above them:

Screenshot 2019-03-12 at 16 22 21

(I actually wanted to draw inspiration from the commented line above)

dulinux commented 5 years ago

+1 This is a great feature from IntelliJ that should definitetly be ported to vscode.

stereobutter commented 5 years ago

I would really like to have this for python!

pittersnider commented 5 years ago

+1 for JS

markm77 commented 5 years ago

Would greatly help with cases like this (from Typescript file) where you can't see what an individual parameter is by hover. (Real example with randomised content.)

        const myVar = new this(
          id,
          'https://example.com:6010',
          'FeZJlIDPbvSxHaZ5DSDFJDSFJksksjfjhyralaklasda',
          false,
          '00YISYSYDYYYFY33423423',
          'https://example.com:6020',
          'https://example.com:6030',
          'https://example.com:6030',
          'xxxdc9f3',
          'sldfkjjjewrjioweurfiopjdkasl;kdl;asd'
        );
chrisobrien1 commented 5 years ago

Jetbrains have a good post on the benefits of inline parameter hints. Would love to get it in VS Code!

https://www.jetbrains.com/help/resharper/Inline_Parameter_Name_Hints.html

blurymind commented 5 years ago

yes please add this to vscode!

Also this https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag it should be a part of the ide, not an addon

intelij's out of the box html tag editing is vastly better atm

shijiezhou1 commented 5 years ago

@lannonbr that extension not works with TS files, right?

image

It is works for ts if you donwload the latest and greatest

markm77 commented 5 years ago

Would be great if this could work well for default parameters as well as specified parameters. For example, if a default parameter is used (due to parameter missing or specified as undefined) it would be great to see both the default parameter name and value that will be used in the hints. This would save a function definition lookup to understand the function call which is exactly the point of this feature. 😀

eljenso commented 5 years ago

Just saw this feature in my coworkers WebStorm, now I want this feature in VSCode. :smiley:

umutcnkus commented 5 years ago

Add me to the waiting list. It looks really cool on Intellij.

kwiat1990 commented 5 years ago

It would be a very helpful feature.

marcuskwan commented 5 years ago

I agree with the others!

nikitakatchik commented 5 years ago

Need!

zapateo commented 5 years ago

This would be really useful.

DominicWatts commented 5 years ago

phpstorm has it. I saw this and wanted in Vscode :)

CharlesT100 commented 5 years ago

@mjbvz Requesting this feature too - could we know the status, will it be implemented by the VS Code team?

andrewrothman commented 5 years ago

Would love to see this in VS Code.

SomeoneToIgnore commented 5 years ago

One extra thing to consider for the future implementation in VS Code is the fact that those hints may be interactive. Here's an example from the intellij-rust plugin: https://github.com/intellij-rust/intellij-rust/pull/4217

dpanic commented 5 years ago

any news on this?

xianyuggg commented 5 years ago

any news on this?

sagebind commented 5 years ago

any news on this?

If there were, I am quite certain the vscode team would post an appropriate update to this thread.

joeloudjinz commented 5 years ago

2020 is approaching and this feature is not implemented yet !! would be a great improvement :smiley:

rajkundu commented 5 years ago

Please add this! It would be such a useful feature and, at least in my use, IntelliJ would have nothing over VS Code. Please!!!

sagebind commented 5 years ago

OT, but @rajkundu I read your comment in my head using the Chamberlain's voice: https://www.youtube.com/watch?v=lm9E3NQOuh0. It fit.

rajkundu commented 5 years ago

Not terribly dissimilar 😆

jonlepage commented 4 years ago

any new on this , i see my friend have this image This is awesome, how activate this in vscode ?? Or a plugin ?