microsoft / microsoft/TypeScript

Code Completions for Object's keys behave differently in different declaration scenarios

Open
#42,071 5 comments 0 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

I tried these code snippets in monaco editor playground
I'm posting it here, as those were reproducible in VsCode too
VsCode Version: 1.52.0
Commit: 940b5f4bb5fa47866a54529ed759d95d09ee80be
Date: 2020-12-10T22:46:53.673Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 17.7.0

  1. When an Object in constructed with some keys and manipulated by some other keys then, those manipulated keys wont find its place in the suggestions ( as a property ). It only comes in suggestion as a literal

Here, key3 is not suggested as property of the object
Screen Shot 2020-12-21 at 1 53 02 PM


  1. When an Object is initialized with an empty object and then if it is reassigned, then only the directly manipulated keys are shown in suggestions

Here, Only key3 is suggested as property of the object and not the other keys
Screen Shot 2020-12-21 at 8 35 48 PM


  1. When an Object is initialized with an empty object and then if it is only manipulated ( one at a time ) then it works perfectly fine
Screen Shot 2020-12-21 at 8 36 37 PM

Originally posted by @Pranomvignesh in https://github.com/microsoft/monaco-editor/issues/2278#issuecomment-749024514

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 three object-declaration scenarios in the Monaco Editor playground and VS Code described in the issue. Trace the TypeScript completion behavior for object keys and determine whether the differing suggestions are expected; done means the reported scenarios have consistent property completions, with regression coverage if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.