microsoft / microsoft/pxt-microbit

autocomplete suggestion on opening parens annoying

Open
#2,963 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

intellisense P2 python
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Describe the bug

After typing an opening paren when defining a function, the autocomplete pics a seemingly random set of suggestions to start you off with. This can be really annoying when you want to break up a function; e.g. I was going to create a class to store state for a panorama in arcade, and had

cursor represented by |

class PanoramaState {
    constructor(|)
}

I pressed ented to list out some fields, e.g.

class PanoramaState {
    constructor(
        public ims: Image[],
        public ind?: number
    ) { }
}

or something similar, that would be ugly / hard to read on one line, but instead of adding a line it inserted a forever:

class PanoramaState {
    constructor(forever(function () {
        
    }))
}

To Reproduce
Steps to reproduce the behavior:

  1. Go to beta editor
  2. start defining a function, add opening parens (maybe wait a second, sometimes it takes a moment for autocomplete to pop up)
  3. press enter
  4. See error

Expected behavior

Unless we have particular info on what's valid input (an enum or something in a function call) it shouldn't suggest anything when the current token is empty

Additional context

I suppose worth noting that this probably happens to me significantly more often than average, as I tend to break up all constructors / some functions with more than two or three parameters into two lines; maybe not something that would hit the average too often? besides just showing weird suggestions if they stop typing for a second.

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 in the beta editor and reproduce the issue by opening a function's parentheses, waiting for autocomplete, and pressing Enter. Investigate the autocomplete behavior for an empty current token; done means Enter creates a new line unless valid input information is available, rather than inserting a random suggestion such as forever(function () {}).

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.