That's cool, having quick actions to do the folding is part way there.

Hehe, I am genuinely looking for a 'try' alternative! I think that an 
editor-supported solution would keep everybody happy.
It would let the code be read as if it were written with some syntactic 
sugar macro, but the code underneath is just plain golang code.
The Golang language/standard library doesn't have to support any macros, 
which keeps the language team happy,
and since the code is unchanged, it lets each person decide which 
collapsings they want to use (if any at all).

It looks like VSCode has a feature suggestion ticket in their backlog here: 
https://github.com/microsoft/vscode/issues/70794
Which would at least make it possible for an extension to implement the 
code folding I'm after.
I wonder if we can encourage VSCode to start working on it, or whether we 
can get a group of Golang devs to work on it for them (it
is open source after all)... 

On Friday, 19 July 2019 05:45:00 UTC+10, Michael Jones wrote:
>
> Ha!
>
> https://github.com/rstuven/vscode-iferrblocks
>
> On Thu, Jul 18, 2019 at 10:32 AM Jim Robinson <jim.r...@gmail.com 
> <javascript:>> wrote:
>
>> Is it named try? :P
>>
>> On Wednesday, July 17, 2019 at 8:37:53 PM UTC-7, Michael Jones wrote:
>>>
>>> There is a special “collapse if err !=  nil blocks plugin for VS code. 
>>>
>>> On Wed, Jul 17, 2019 at 5:37 PM <kez....@gmail.com> wrote:
>>>
>>>> Context:
>>>> 1. Golang can be very verbose, for example checking if err != nil after 
>>>> a function call takes 3 lines:
>>>> if err != nil {
>>>>    return nil, fmt.Errorf("some context: %v", err)
>>>> }
>>>>
>>>>
>>>> 2. Editors like VSCode can already collapse blocks of statements, where 
>>>> the above would be displayed as:
>>>> if err != nil {...
>>>>
>>>>
>>>> My question:
>>>> Are there any editors that support some kind of customisable collapsing 
>>>> behaviour? Where the above code could be collapsed to something like:
>>>> ...check...fmt.Errorf("some context: %v", err)...
>>>>
>>>> Has anyone tried to implement this kind of behaviour? Is it difficult 
>>>> to achieve?
>>>>
>>>>
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "golang-nuts" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to golan...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/golang-nuts/e15556dd-b957-4d79-9ca4-8b6ed8eb6e6c%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/golang-nuts/e15556dd-b957-4d79-9ca4-8b6ed8eb6e6c%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>>>
>>> *Michael T. jonesmichae...@gmail.com*
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golan...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/920a48e6-431d-40b2-8081-d0b207cb1840%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/920a48e6-431d-40b2-8081-d0b207cb1840%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
>
> *Michael T. jonesmichae...@gmail.com <javascript:>*
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1e0a1507-0eb4-48da-8ad1-54cace6a48d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to