microsoft / vscode

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

Fixed Documentation Panel #231042

Open JCKodel opened 1 week ago

JCKodel commented 1 week ago

A panel to show the current scope documentation.

In the examples bellow, I'm using the Docs View extension (bierner.docs-view), but that extension is limited because VSCode only shows documentation based on UI interaction (i.e.: where my mouse pointer is over or where is underneath my text cursor).

The idea is to have an always visible context documentation without depending on mouse or text cursors (documentation on demand while I'm typing).

Example:

Scenario: I'm using Dart, and I'm writing some stuff. I'm writing a log using a Dart library method called log.

I want to know that arguments that function accepts, on a always visible panel (so, I don't need to go back to log( or hover over log to trigger the arguments tooltip):

Image

Now, this documentation panel should be available with that documentation until I finish to write my log statement.

In the current documentation panel extension, when I type log("Test",, no documentation is displayed because I think VSCode is telling this extension that nothing in this scope has documentation:

Image

What would be awesome:

To actually show the documentation regarding the current scope (which is the log function):

Image

Now, assume I'm writing log("Test", zone:. The current context is now on the zone argument, which I don't know what it is and I need to glance at the documentation. Currently, VSCode shows the documentation on a popup ONLY when I put the mouse cursor over the zone argument name:

Image

The Documentation panel extension also only shows the documentation, if the text cursor is over the zone name (so, never, because I'm typing it!):

Image

The optimal behaviour would that last documentation be visible until I'm no longer writing the zone: part.

That extension only fails because VSCode doesn't provide documentation hints, except when the user is interacting with the UI, by either hovering some keyword with the mouse or have the text cursor over that keyword (example: log("Test", zo|ne: (where | is the text cursor))

My proposal is: to create a built-in documentation panel that detects the current scope and fix the documentation of that scope in the panel (or, at least, make APIs available, so extension developers can build that).

This would make VSCode less dependent on mouse and less annoying with popups (the only popup that would be displayed is the intellisense). Of course, if all of this could be configured as user preference, better.

BTW: that extension has an Sticky option that freezes the last documentation, but it fails. For example:

log| - shows the correct documentation log("|" - shows Type: String (should show the log documentation) log("Test", |) shows Type: String (should show the log documentation) log("Test, zone|) shows Type: InvalidType (should show the zone arg documentation) log("Test, zone: |) shows Type: InvalidType (should show the zone arg documentation)

skycommand commented 1 week ago

This feature is already implemented. It's called IntelliSense.

Image

JCKodel commented 1 week ago

This feature is already implemented. It's called IntelliSense.

Please, read the proposal. Not the same thing.

skycommand commented 1 week ago

Please, indulge me for a moment. How is your proposal better?