VS Code snippets

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

VS Code snippets

Harbs
I started creating some VS Code snippets for making writing code with .as and mxml files in VS Code easier.

Is there a good way to share this stuff?

So far, I’ve created snippets for:
CDATA blocks
fx:Script blocks
fx:Style blocks
COMPILE::SWF
COMPILE::JS
getters and setters

Reply | Threaded
Open this post in threaded view
|

Re: VS Code snippets

Carlos Rovira
That looks good :)

Here seems to be a way :
https://code.visualstudio.com/Docs/customization/userdefinedsnippets#_sharing-your-snippets-in-the-marketplace

2017-01-30 17:58 GMT+01:00 Harbs <[hidden email]>:

> I started creating some VS Code snippets for making writing code with .as
> and mxml files in VS Code easier.
>
> Is there a good way to share this stuff?
>
> So far, I’ve created snippets for:
> CDATA blocks
> fx:Script blocks
> fx:Style blocks
> COMPILE::SWF
> COMPILE::JS
> getters and setters
>
>


--

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.
Reply | Threaded
Open this post in threaded view
|

Re: VS Code snippets

Harbs
I’m trying to figure out the best way to create new classes.

I can create a snippet which lays out the scaffolding for a class, but I’d really like something similar to the “New” command in Flash Builder.

Is anyone familiar with solutions for that?

> On Jan 30, 2017, at 7:24 PM, Carlos Rovira <[hidden email]> wrote:
>
> That looks good :)
>
> Here seems to be a way :
> https://code.visualstudio.com/Docs/customization/userdefinedsnippets#_sharing-your-snippets-in-the-marketplace
>
> 2017-01-30 17:58 GMT+01:00 Harbs <[hidden email]>:
>
>> I started creating some VS Code snippets for making writing code with .as
>> and mxml files in VS Code easier.
>>
>> Is there a good way to share this stuff?
>>
>> So far, I’ve created snippets for:
>> CDATA blocks
>> fx:Script blocks
>> fx:Style blocks
>> COMPILE::SWF
>> COMPILE::JS
>> getters and setters
>>
>>
>
>
> --
>
> Carlos Rovira
> Director General
> M: +34 607 22 60 05
> http://www.codeoscopic.com
> http://www.avant2.es
>
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si ha recibido este mensaje por
> error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> proceda a su destrucción.
>
> De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> servicio o información solicitados, teniendo usted derecho de acceso,
> rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> necesaria.

Reply | Threaded
Open this post in threaded view
|

Re: VS Code snippets

Josh Tynjala
VSCode doesn't expose APIs to display a custom form similar to how you
would create a new class in Flash Builder where you can specify the name of
a new class, its package, superclass, interfaces, etc.

In a custom command, you can ask VSCode to display a set of instructions
with either a text input, a set of buttons, or a list of items where you
may select one. You can add things to the status bar or display a context
menu in certain places too. You can see most the available APIs on the
vscode.window object here:

https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window

You could possibly chain a few of these things together, one by one. Ask
for the name of the new class with vscode.window.showInputBox(), then its
superclass with the same API (or maybe vscode.window.showQuickPick(), after
you get a list of classes out of the language server with something like
vscode.executeWorkspaceSymbolProvider).

I'm not sure how clean it would end up being on the user experience side,
but it should be possible to basically make a primitive wizard.

- Josh

2017-01-30 10:11 GMT-08:00 Harbs <[hidden email]>:

> I’m trying to figure out the best way to create new classes.
>
> I can create a snippet which lays out the scaffolding for a class, but I’d
> really like something similar to the “New” command in Flash Builder.
>
> Is anyone familiar with solutions for that?
>
> > On Jan 30, 2017, at 7:24 PM, Carlos Rovira <
> [hidden email]> wrote:
> >
> > That looks good :)
> >
> > Here seems to be a way :
> > https://code.visualstudio.com/Docs/customization/
> userdefinedsnippets#_sharing-your-snippets-in-the-marketplace
> >
> > 2017-01-30 17:58 GMT+01:00 Harbs <[hidden email]>:
> >
> >> I started creating some VS Code snippets for making writing code with
> .as
> >> and mxml files in VS Code easier.
> >>
> >> Is there a good way to share this stuff?
> >>
> >> So far, I’ve created snippets for:
> >> CDATA blocks
> >> fx:Script blocks
> >> fx:Style blocks
> >> COMPILE::SWF
> >> COMPILE::JS
> >> getters and setters
> >>
> >>
> >
> >
> > --
> >
> > Carlos Rovira
> > Director General
> > M: +34 607 22 60 05
> > http://www.codeoscopic.com
> > http://www.avant2.es
> >
> > Este mensaje se dirige exclusivamente a su destinatario y puede contener
> > información privilegiada o confidencial. Si ha recibido este mensaje por
> > error, le rogamos que nos lo comunique inmediatamente por esta misma vía
> y
> > proceda a su destrucción.
> >
> > De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> comunicamos
> > que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> > S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> > servicio o información solicitados, teniendo usted derecho de acceso,
> > rectificación, cancelación y oposición de sus datos dirigiéndose a
> nuestras
> > oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> > necesaria.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: VS Code snippets

Harbs
I was exploring snippets as a way to create classes. I created a snippet which get most of the way there, but packages and classes need to be created separately. I was hoping to use something similar to TextMate’s bash execution, but that’s not supported: https://github.com/Microsoft/vscode/issues/10561 <https://github.com/Microsoft/vscode/issues/10561>

Having an extension create snippets on the fly using the file name and file path to automatically generate package and class name would be a nice way to go. That can be done using this: https://github.com/Microsoft/vscode/issues/3210 <https://github.com/Microsoft/vscode/issues/3210> but it’s beyond my skill level in writing VS Code extensions.

> On Jan 30, 2017, at 10:39 PM, Josh Tynjala <[hidden email]> wrote:
>
> VSCode doesn't expose APIs to display a custom form similar to how you
> would create a new class in Flash Builder where you can specify the name of
> a new class, its package, superclass, interfaces, etc.
>
> In a custom command, you can ask VSCode to display a set of instructions
> with either a text input, a set of buttons, or a list of items where you
> may select one. You can add things to the status bar or display a context
> menu in certain places too. You can see most the available APIs on the
> vscode.window object here:
>
> https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window
>
> You could possibly chain a few of these things together, one by one. Ask
> for the name of the new class with vscode.window.showInputBox(), then its
> superclass with the same API (or maybe vscode.window.showQuickPick(), after
> you get a list of classes out of the language server with something like
> vscode.executeWorkspaceSymbolProvider).
>
> I'm not sure how clean it would end up being on the user experience side,
> but it should be possible to basically make a primitive wizard.
>
> - Josh
>
> 2017-01-30 10:11 GMT-08:00 Harbs <[hidden email]>:
>
>> I’m trying to figure out the best way to create new classes.
>>
>> I can create a snippet which lays out the scaffolding for a class, but I’d
>> really like something similar to the “New” command in Flash Builder.
>>
>> Is anyone familiar with solutions for that?
>>
>>> On Jan 30, 2017, at 7:24 PM, Carlos Rovira <
>> [hidden email]> wrote:
>>>
>>> That looks good :)
>>>
>>> Here seems to be a way :
>>> https://code.visualstudio.com/Docs/customization/
>> userdefinedsnippets#_sharing-your-snippets-in-the-marketplace
>>>
>>> 2017-01-30 17:58 GMT+01:00 Harbs <[hidden email]>:
>>>
>>>> I started creating some VS Code snippets for making writing code with
>> .as
>>>> and mxml files in VS Code easier.
>>>>
>>>> Is there a good way to share this stuff?
>>>>
>>>> So far, I’ve created snippets for:
>>>> CDATA blocks
>>>> fx:Script blocks
>>>> fx:Style blocks
>>>> COMPILE::SWF
>>>> COMPILE::JS
>>>> getters and setters
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Carlos Rovira
>>> Director General
>>> M: +34 607 22 60 05
>>> http://www.codeoscopic.com
>>> http://www.avant2.es
>>>
>>> Este mensaje se dirige exclusivamente a su destinatario y puede contener
>>> información privilegiada o confidencial. Si ha recibido este mensaje por
>>> error, le rogamos que nos lo comunique inmediatamente por esta misma vía
>> y
>>> proceda a su destrucción.
>>>
>>> De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>> comunicamos
>>> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>>> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>>> servicio o información solicitados, teniendo usted derecho de acceso,
>>> rectificación, cancelación y oposición de sus datos dirigiéndose a
>> nuestras
>>> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>>> necesaria.
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: VS Code snippets

Nemi
In reply to this post by Harbs
If extension is not a option right now, maybe put it on https://gist.github.com/ so one can copy snippets' files somewhere and use them.
Reply | Threaded
Open this post in threaded view
|

Re: VS Code snippets

Nemi
In reply to this post by Harbs