tooltitude / support

Tooltitude Support
https://www.tooltitude.com
Other
21 stars 0 forks source link

Add postfix completions for checking if a slice/map/chan/string is empty or not. #34

Closed hsiafan closed 8 months ago

hsiafan commented 8 months ago

OS Version:

VS Code Version:

Go Version:

Code Repository (if open source):

Feature request:

.

s := []int{1, 2}

// s.ifem 
if len(s) == 0 {
    $CURSOR$
}

// s.ifnem
if len(s) > 0 {
    $CURSOR$
}
tooltitude-support commented 8 months ago

Thanks for your feedback! That should be pretty easy. Not sure about exact abbreviation though.

tooltitude-support commented 8 months ago

@hsiafan

Ok. We now have .ifempty and .ifnempty postfix completions. The first one adds len(e) == 0, the second one adds len(e) != 0.

They both should be available in the next release 0.63.0, which hopefully will be out by the end of the week, i.e. closer to Friday.

tooltitude-support commented 8 months ago

0.63.0 is out. Please try it and let us know if you have any problems with it.

hsiafan commented 8 months ago

0.63.0 is out. Please try it and let us know if you have any problems with it.

I have tried it, and it works just as I expected.