microsoft / microsoft/TypeScript

Include documentation from a variable's type when you hover the variable

Open
#37,876 18 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Issue Type: Feature request

I had hoped to see the description for the type when hovering over the value via intellisense, etc.

When I hover over context.slot I can see "The slot the disk is in." yet when I try hovering over const slot I see just the type. Is there anything to enable this? Even setting slot to Slot manually it still only shows the type.

 /** The slot the disk is in. */
type Slot = string;

interface Context {
    /** The slot the disk is in. */
    slot?: Slot
}

const func = (context: Context): Context => {
    const x = context.slot;
    const slot: Slot = context.slot;

    return {
        slot: x || slot
    };
};

func({
    slot: '1'
}).slot;

VS Code version: Code 1.43.2 (0ba0ca52957102ca3527cf479571617f0de6ed50, 2020-03-24T07:34:57.037Z)
OS version: Darwin x64 19.2.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz (4 x 2400)
GPU Status 2d_canvas: unavailable_software
flash_3d: disabled_software
flash_stage3d: disabled_software
flash_stage3d_baseline: disabled_software
gpu_compositing: disabled_software
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: disabled_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: disabled_software
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: unavailable_software
webgl2: unavailable_software
Load (avg) 1, 1, 2
Memory (System) 8.00GB (0.79GB free)
Process Argv .
Screen Reader no
VM 0%
Extensions (27)
Extension Author (truncated) Version
go-outliner 766 0.1.20
npm-intellisense chr 1.3.0
path-intellisense chr 1.4.2
jsrefactor cms 2.20.5
vue-peek dar 1.0.2
vscode-eslint dba 2.1.2
EditorConfig Edi 0.14.5
vscode-npm-script eg2 0.3.11
flow-for-vscode flo 1.5.0
todo-tree Gru 0.0.171
docthis joe 0.7.1
vscode-home-assistant kee 1.6.1
dotenv mik 1.0.1
vscode-docker ms- 1.0.0
csharp ms- 1.21.16
atom-keybindings ms- 3.0.6
cpptools ms- 0.27.0
Go ms- 0.13.1
vscode-typescript-next ms- 3.9.20200408
go-doc msy 0.1.1
hide-gitignored npx 1.1.0
vetur oct 0.24.0
vscode-graphql Pri 0.2.14
json-template sto 0.3.1
vscode-icons vsc 10.0.0
vscode-wakatime Wak 4.0.0
vscode-go-autotest win 1.6.0

(2 theme extensions excluded)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hover behavior with the TypeScript example in the issue and inspect the TypeScript language-service hover path used by VS Code. Determine how documentation is selected for variables whose types refer to aliases, then verify that the hover includes the type documentation without changing existing property hover behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.