sergey-visual-studio/dpack

"Surround with" doesn't work when there are custom Snippets defined

konytskyy opened this issue · 26 comments

If you put custom Snippets in
C:\Users<user>\Documents\Visual Studio 2022\Code Snippets\Visual C#\My Code Snippets
and try to use Surround With - Visual studio pop up those custom snippets.
immagine

OS: Windows 10 Pro 21h1
VS 2022 Pro Version 17.3.6
DPack RX 2022 v4.5.1
C#

Interesting. Could you post your custom snippets file? Thanks.

XpoSnippets.zip

Snippets to work with xpo of devexpress

Confirmed. The whole Surround With feature is a wrapper around subset of VS's surround with + dedicated commands with their own shortcuts. It does fall apart when custom snippets are added to the mix.

I have a preliminary patch ready but I'll need to do quite a bit more testing, including other languages that Surround With is supported for. It'll probably be a month or so before I can get a patch out. I'll keep you posted. Thanks.

DPack is fantastic I use it since VS 2015 and if I can contribute in some test...

Here's an updated version that should finalize that Surround With issue. Give it a try and let me know if you run into any issues.

DPackRx-4.5.2.2.vsix.zip

Thank you. It works as expected a bit slow but it works.
Is it possible to add also "using" in context menu?

immagine

Thank you. It works as expected a bit slow but it works. Is it possible to add also "using" in context menu?

Yeah, I can see that. Old DPack used to do its own formatting instead of relying on built in snippets. I almost dropped Surround With feature for VS 2022 and added this current workaround, The downside is that it's slower, doesn't allow for additional formatting, and not supported for VB of all things,

I'll look into adding using.

OK. Doesn't matter. Thank you again for your work and you add-on :-)

Hi,

I see little bug

when ypu decide to surround with "region" it puts "if" snippets
immagine

immagine

Yuriy

That's for C# isn't it? Thanks.

Yes, it's c#

Check Insert Snippet built-in command, select Visual C#, and report back on what you get. Here's what I'm seeing here:

image

Yes I know how to do this but how many clicks I do have to arrive to a #region ? :-)
Your extension allow me to have job done in 2 clicks also if it's a bit slow

That's not what I was looking for. I basically wanna see a screenshot similar to mine taken on your machine. Thanks.

These are snapshoot sequence for "surround with" from VS
immagine

immagine

immagine

Quick update - I'm gonna try resurrecting pre-VS2022 version that doesn't rely on built-in templates.

Resurrected older Surround With functionality. Give new beta a try and let me know how that works for you. Thanks.

DPackRx-4.5.2.3.vsix.zip

Thank you I'll try it immediately

After installation v2.5.2.3 I don't see anymore DPack menu Surround with
immagine

Try restarting VS. I had noticed the same thing here while testing it but couldn't reproduce it - it'd be missing and then back after restart. I'll take a closer look if that still persists for you.

No, neither after restart there is no "Surround with" menu. I have aslo tried to see if this menu was hidden but I could not find it

Identified a breaking change. Will have another beta out in a few days. Thanks.

Give new beta a try and let me know how it turns out. Thanks.

DPackRx-4.5.2.4.vsix.zip

Thank you I'll try immediately

Everything is ok, Surround works as expected and its also very quick. Thak you !!!

New release should be out shortly.