microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.28k stars 12.39k forks source link

JS Doc not shown for comment attached to property initializer in object literal #48167

Open Cuixote opened 2 years ago

Cuixote commented 2 years ago

Issue Type: Bug

/**
 * any object
 * @type {{x: number, y: number, z: number}}
 */
const position = {
  /**
   * Abscissa coordinates
   */
  x: 1
}

position.x
企业微信20220307-155324@2x

when mouse hover at 'position.x', the comment "Abscissa coordinates" is shown in webstorm. But, it doesn't work in vscode.

image

VS Code version: Code 1.65.0 (b5205cc8eb4fbaa726835538cd82372cc0222d43, 2022-03-02T11:11:20.886Z) OS version: Darwin x64 21.1.0 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2600)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|3, 3, 3| |Memory (System)|16.00GB (0.02GB free)| |Process Argv|--crash-reporter-id d99eb78d-acc8-4db9-b16f-44ad18e3a83c| |Screen Reader|no| |VM|0%|
Extensions (38) Extension|Author (truncated)|Version ---|---|--- markdown-toc|Ala|1.5.6 jsx|Twe|0.0.1 vscode-styled-jsx|bla|2.1.1 npm-intellisense|chr|1.4.1 path-intellisense|chr|2.8.0 vscode-markdownlint|Dav|0.46.0 vscode-eslint|dba|2.2.2 githistory|don|0.6.19 gitlens|eam|12.0.1 vscode-npm-script|eg2|0.3.24 vsc-material-theme|Equ|33.1.2 vsc-material-theme-icons|equ|1.2.2 prettier-vscode|esb|9.3.0 git-project-manager|fel|1.8.2 gitkraken-authentication|git|1.0.3 vue|jcb|0.1.5 vue|liu|0.1.5 code-beautifier|mic|2.3.3 vscode-docker|ms-|1.20.0 vscode-language-pack-zh-hans|MS-|1.65.1 python|ms-|2022.2.1924087327 vscode-pylance|ms-|2022.3.0 jupyter|ms-|2022.2.1020642448 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.6 cpptools|ms-|1.8.4 node-debug2|ms-|1.43.0 sublime-keybindings|ms-|4.0.10 vscode-typescript-tslint-plugin|ms-|1.3.3 team|ms-|1.161.1 vscode-react-native|msj|1.9.2 vetur|oct|0.35.0 material-icon-theme|PKi|4.13.0 minapp-vscode|qiu|2.4.6 js-jsx-snippets|sky|11.0.0 language-stylus|sys|1.15.0 open-in-browser|tec|2.0.0 vscode-icons|vsc|11.10.0 (2 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 pythondataviewer:30285071 vscod805:30301674 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30433507 vsclayoutctrt:30448491 dsvsc009:30440023 pythonvspyt640:30442238 vsbas813:30436447 vscscmwlcmc:30438804 vscgsvidc:30447482 helix:30440343 ```
a-tarasyuk commented 2 years ago

The response seems to include a comment

Screenshot 2022-03-08 at 18 36 48

/cc @RyanCavanaugh

Cuixote commented 2 years ago
/**
 * any object
 * @type {{x: number, y: number, z: number}}
 */
const position = {
  /**
   * Abscissa coordinates
   */
  x: 1
}

position.x

this will go wrong.

/**
 * any object
 */
const position = {
  /**
   * Abscissa coordinates
   */
  x: 1
}

position.x

this will not.

I guess VSCODE handles comments by replacing rather than merging. And the priority of the comments of the position is higher than that of its attribute position.x.