dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.04k forks source link

snippets do not expand for #region and #if #56618

Closed GF-Huang closed 2 weeks ago

GF-Huang commented 3 years ago

Version Used:

image

Steps to Reproduce:

  1. Type #region
  2. Press Tab on the keyboard
  3. Press Tab on the keyboard
  4. Press Tab on the keyboard
  5. Press Tab on the keyboard
  6. Press Tab on the keyboard
  7. Press Tab on the keyboard
  8. Press Tab on the keyboard
  9. Press Tab on the keyboard
  10. Press Tab on the keyboard

Expected Behavior:

https://www.youtube.com/watch?v=II_5C9mfS9Q&ab_channel=CoffeeNCode

Actual Behavior:

ipMVmg9Roi

Youssef1313 commented 3 years ago

It looks like you're pressing a "space" after typing #region? You just need to hit tab twice.

GF-Huang commented 3 years ago

It looks like you're pressing a "space" after typing #region? You just need to hit tab twice.

Are you serious? I have used C# to write programs for several years, and I know this common sense.

Youssef1313 commented 3 years ago

@GF-Huang Do you mean you're expecting it to work even with a space after "#region"? I don't think snippets are designed to work this way. If it works for you without the extra space, then I believe this is by design.

Note: I'm not a Microsoft employee - so you may want to wait for someone from Roslyn team to confirm.

GF-Huang commented 3 years ago

@GF-Huang Do you mean you're expecting it to work even with a space after "#region"? I don't think snippets are designed to work this way. If it works for you without the extra space, then I believe this is by design.

Note: I'm not a Microsoft employee - so you may want to wait for someone from Roslyn team to confirm.

I never type space, I never press space, the space was generated by the tab key, that's what you see.

Again, I use #region many times at the previous version, but now, the 16.11.3, it broken.

jmarolf commented 3 years ago

I can reproduce this in 16.11. This appears to be an editor bug, the #region snippet is never expanded. @olegtk was anything about snippet handling changed recently?

Youssef1313 commented 3 years ago

Doesn't seem to repro in 17.0 P4 for me

region

(I'm assuming that if this regressed in 16.x it would regress in 17.x as well? But will see if I can test on 16.11) Tested on 16.11.3, it didn't repro for me. See comment below.

@jmarolf Was the first tab typed as a character? I mean if this is happening, it may be the reason why the editor isn't triggering snippet completion. ie, it may or may not be an editor issue. But I'm completely unsure, this is just a random thought 😄

olegtk commented 3 years ago

@AmadeusW ?

Youssef1313 commented 3 years ago

@jmarolf It didn't reproduce for me in 16.11.3. It may be some specific setting that causes this?

region_16_11

jmarolf commented 3 years ago

It does for me it I type at the end of a bracket: region_bug

Microsoft Visual Studio Enterprise 2019 Version 16.11.3

huoyaoyuan commented 3 years ago

It doesn't reproduce for me on either 16.11 or 17.0P4

image It still doesn't reproduce if I toggle this setting.

CyrusNajmabadi commented 2 weeks ago

Closing as we are not investing in legacy snippets behavior.