roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Switch expression pattern is not using suggestion mode

Open 333fred opened this issue 3 years ago • 4 comments

Version Used: Version 17.0.0 Preview 3.0 [31519.82.main] (I think this is a recent break)

Steps to Reproduce:

  1. Create a new console app.
  2. Type _ = args switch { $$ } (cursor at $$)
  3. Type _<space>

Expected Behavior:

_ is kept.

Actual Behavior:

#if is inserted (or whatever is top of your completion list). Here's a different example: No suggestion mode

333fred avatar Jul 20 '21 17:07 333fred

Note: we likely shouldn't be in suggestion mode here. What we should be doing is adding the 'discard symbol' (_) to the completion list so that this just counts as a real match with normal completion semantics.

CyrusNajmabadi avatar Jul 20 '21 17:07 CyrusNajmabadi

@jinujoseph i think we should not have this in the backlog. it's a pretty unpleasant experience typing a reasonable code construct.

CyrusNajmabadi avatar Jul 20 '21 22:07 CyrusNajmabadi

cc @genlu fyi

jinujoseph avatar Jul 20 '21 22:07 jinujoseph

jinujoseph i think we should not have this in the backlog. it's a pretty unpleasant experience typing a reasonable code construct.

I would go as far as to say it's the most common switch expression pattern. Just about every switch expression I type has one, and this bug has bit me nearly a double-digit number of times today.

333fred avatar Jul 20 '21 23:07 333fred

I don't repro this anymore. We don't seem to hard select:

image

CyrusNajmabadi avatar Jan 31 '23 21:01 CyrusNajmabadi