Skip to content

intellisense puts most likely choice last #130778

@gregveres

Description

@gregveres

Issue Type: Bug

I am creating a variable and assigning it value. The value is an instance of a TS interface. Something like this:

interface a {
 id: number,
 place: string
}

then in a function, I try to create a variable of that type:

const person : a = {
id: 1,
place: 'Canada'
};

when I type the p of place, itellisense gives me a bunch of stupid suggestions for the context and the only appropriate suggestion is the last one in the list. Why is that?

For instance, in a real example I have, the interface I am filling out has a member called PeriodId and I have not yet added PeriodId. I type p and this is what comes up:

  • private method
  • prop
  • public method
  • PeriodId

The first three are bad suggestions because they don't even make sense in this context. I am inside the definition of an object literal defining a const varaible inside a class function. creating a public or private method or a prop don't make any sense. Surely intellisense should be more intelligent than that.

To make matters even worse, if I just type:

const v: a = {

and I bring up intellisense, it gives me every option under the sun, including all of the members of interface a, but it puts the members of interface a at the end of the list. Thank goodness the menu lets me scroll up to wrap around to the bottom of the list.

These interface members should be the first items in the list. If they were first, I wouldn't care what other suggestions intellisense gave, no matter how inappropriate they are for the context.

VS Code version: Code 1.59.0 (379476f, 2021-08-04T23:13:12.822Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

System Info
Item Value
CPUs AMD Ryzen 7 5800X 8-Core Processor (16 x 3793)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.93GB (3.00GB free)
Process Argv --crash-reporter-id fe8c6969-e322-4f5f-9f8d-9d0340a5d8e2
Screen Reader no
VM 0%
Extensions (42)
Extension Author (truncated) Version
vscode-icalendar af4 1.0.1
npm-intellisense chr 1.4.0
path-intellisense chr 2.4.0
bracket-pair-colorizer Coe 1.0.61
bracket-pair-colorizer-2 Coe 0.2.1
vue-peek dar 1.0.2
vscode-markdownlint Dav 0.43.2
vscode-eslint dba 2.1.23
css-flexbox-cheatsheet dzh 3.2.3
gitlens eam 11.6.0
rightclick-git Eve 2.0.0
vscode-firefox-debug fir 2.9.4
auto-rename-tag for 0.1.8
sass-lint gle 1.0.7
vscode-format-context-menu lac 1.0.4
eml lei 0.4.0
i18n-ally lok 2.7.0
regionfolder map 1.0.15
template-string-converter meg 0.5.3
vscode-attrs-sorter mrm 2.1.0
vscode-scss mrm 0.10.0
csharp ms- 1.23.14
vscode-dotnet-runtime ms- 1.2.0
powershell ms- 2021.8.0
vs-keybindings ms- 0.2.1
debugger-for-chrome msj 4.12.12
html-fmt-vscode Nik 0.7.2
vetur oct 0.34.1
fix-json oli 0.1.2
leaper Onl 0.10.5
vscode-jest Ort 4.0.3
material-icon-theme PKi 4.9.0
vscode-scss-formatter sib 2.2.3
indenticator Sir 0.7.0
rewrap stk 1.14.0
code-spell-checker str 1.10.2
vscode-stylelint sty 0.86.0
sass-indented syl 1.8.17
vscodeintellicode-insiders Vis 1.1.3
vscode-icons vsc 11.6.0
vscode-import-cost wix 2.15.0
vue-language-features znc 0.7.6

(5 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
vsccppwtct:30329789
pythonvssor306:30344512
bridge0708:30335490
vstre464cf:30350173
bridge0723:30351747

Metadata

Metadata

Assignees

Labels

*questionIssue represents a question, should be posted to StackOverflow (VS Code)snippetssuggestIntelliSense, Auto CompletetypescriptTypescript support issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions