18 comments
Comment actions Permalink

We actually are working on the documentation but it's not ready yet. Has
anyone managed to create custom templates? Any feedback?

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:9081212.1084460538862.JavaMail.itn@is.intellij.net...

Could you please post short and simple how-to about live templates?



0
Comment actions Permalink

Yes, I did some to automate common tasks in my current project. They were pretty simple and work fine, though I miss "Create file from LT" feature, posted to tracker separately. I have many common files, specifically business entities, collections of them, helper classes and such. Ideally, I would like to have "Create file from LT" and completely drop VS built-in features like "Add class" and other. I already changed VS default templates for such things, but this is still not enough. There are several common scenarious which could be covered by Resharper's LT and make life easier. I will try more LTs in the nearest future.

0
Comment actions Permalink

Do you find live templates configruation UI hard to learn/use or not? Any
feedback would be appreciated.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:4177416.1085043141756.JavaMail.itn@is.intellij.net...

Yes, I did some to automate common tasks in my current project. They were

pretty simple and work fine, though I miss "Create file from LT" feature,
posted to tracker separately. I have many common files, specifically
business entities, collections of them, helper classes and such. Ideally, I
would like to have "Create file from LT" and completely drop VS built-in
features like "Add class" and other. I already changed VS default templates
for such things, but this is still not enough. There are several common
scenarious which could be covered by Resharper's LT and make life easier. I
will try more LTs in the nearest future.


0
Comment actions Permalink

Hello Valentin,

VK> Do you find live templates configruation UI hard to learn/use or
VK> not? Any feedback would be appreciated.

The main issue is: you have to know that macros are surrounded with $. You can guess it from viewing existing templates, but the "Edit Template" dialog by itself does not present any single hint for this.

Also, the "Editable field" control looks and works quite ugly (the text in the cell jumping as you click on it, borders not drawn properly etc.). A simple checkbox embedded in the table cell would be much more convenient.

The "Choose macro" dialog would be better with some explanation text and examples.

The width of table cells jumping as I change macros also doesn't look nice. The "Editable field" column does not need to be resizable at all, and the size of the Name column can probably be adjusted only manually.

--
Dmitry Jemerov
OmniaMea Project Leader
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

1. Edit template dialog should not be modal. The problem is that I often want to look at existing LT when creating new one and I have to close dialog, look at desired template and reopen it.

2. Add buttons to template edit window to insert predefined macros, such as $END$, with tooltips explaining them

3. Add description to choose macro dialog, explaining what this macro does and an example

4. Mouse wheel doesn't work in list of LTs

5. In LT preview window underline editable place, like in editor. Ideally, in edit window right click on the non-underlined macro should bring popup menu with "make this editable" choice. It is not very convenient to count usages of macro and selecting number.

6. For dictionary enumeration, it should allow to guess key and value type, like in collection enumeration

7. Add more macros (more discussion needed). One that I personally miss, is "Suggest type assignable to ]]>". E.g. for "using" LT I need only IDisposable types. Also method-related macros are missed (including constructor). E.g. for "new object" LT ($TYPE$ $VAR$ = new $TYPE$()) I'd like to select type, have suggested var AND select constrcutor.

8. After edit LT grid is positioned on the first element.

More to come :)

0
Comment actions Permalink

The main issue is: you have to know that macros are surrounded with $. You

can guess it from viewing existing templates, but the "Edit Template" dialog
by itself does not present any single hint for this.

That's true but I could not imagine what we could do with that. Any ideas?

>

Also, the "Editable field" control looks and works quite ugly (the text in

the cell jumping as you click on it, borders not drawn properly etc.). A
simple checkbox embedded in the table cell would be much more convenient.

We'll try to make it better. However, the checkbox is not suitable because
for macros having multiple occurences it contains the number.
>

The "Choose macro" dialog would be better with some explanation text and

examples.

Thanks for your suggestion, we'll add it.

>

The width of table cells jumping as I change macros also doesn't look

nice. The "Editable field" column does not need to be resizable at all, and
the size of the Name column can probably be adjusted only manually.

You are right, we'll fix that.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


"Dmitry Jemerov (JetBrains)" <yole@jetbrains.com> wrote in message
news:c8i3bs$s9n$1@is.intellij.net...

Hello Valentin,

>

VK> Do you find live templates configruation UI hard to learn/use or
VK> not? Any feedback would be appreciated.

>

The main issue is: you have to know that macros are surrounded with $. You

can guess it from viewing existing templates, but the "Edit Template" dialog
by itself does not present any single hint for this.
>

Also, the "Editable field" control looks and works quite ugly (the text in

the cell jumping as you click on it, borders not drawn properly etc.). A
simple checkbox embedded in the table cell would be much more convenient.
>

The "Choose macro" dialog would be better with some explanation text and

examples.
>

The width of table cells jumping as I change macros also doesn't look

nice. The "Editable field" column does not need to be resizable at all, and
the size of the Name column can probably be adjusted only manually.
>

--
Dmitry Jemerov
OmniaMea Project Leader
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"



0
Comment actions Permalink

Ilya, thanks for your feedback! See my comments below.

1. Edit template dialog should not be modal. The problem is that I often

want to look at existing LT when creating new one and I have to close
dialog, look at desired template and reopen it.

We'll do that.

>

2. Add buttons to template edit window to insert predefined macros, such

as $END$, with tooltips explaining them

We'll think about that.

>

3. Add description to choose macro dialog, explaining what this macro does

and an example

Will be implemented.

>

4. Mouse wheel doesn't work in list of LTs


We'll try to fix that.

>

5. In LT preview window underline editable place, like in editor.


We'll add it.

Ideally, in edit window right click on the non-underlined macro should

bring popup menu with "make this editable" choice. It is not very convenient
to count usages of macro and selecting number.

I do not think many user will guess to invoke popup menu there. Usually
there are not too big numbers and you immediately see the feedback
(underlined) after selecting a value.

>

6. For dictionary enumeration, it should allow to guess key and value

type, like in collection enumeration

There is such request in the tracker already.

>

7. Add more macros (more discussion needed). One that I personally miss,

is "Suggest type assignable to ]]>". E.g. for "using" LT I need only
IDisposable types.

Could you please provide more information about this "using" template. I'm
not sure I understand where such macro is needed in it.

Also method-related macros are missed (including constructor). E.g. for

"new object" LT ($TYPE$ $VAR$ = new $TYPE$()) I'd like to select type, have
suggested var AND select constrcutor.

What does it mean "to select constructor"? What will be done after selecting
a constructor?

>

8. After edit LT grid is positioned on the first element.


I could not reproduce that on my current build. Probably it's fixed already.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:23871212.1085052039426.JavaMail.itn@is.intellij.net...

1. Edit template dialog should not be modal. The problem is that I often

want to look at existing LT when creating new one and I have to close
dialog, look at desired template and reopen it.
>

2. Add buttons to template edit window to insert predefined macros, such

as $END$, with tooltips explaining them
>

3. Add description to choose macro dialog, explaining what this macro does

and an example
>

4. Mouse wheel doesn't work in list of LTs

>

5. In LT preview window underline editable place, like in editor. Ideally,

in edit window right click on the non-underlined macro should bring popup
menu with "make this editable" choice. It is not very convenient to count
usages of macro and selecting number.
>

6. For dictionary enumeration, it should allow to guess key and value

type, like in collection enumeration
>

7. Add more macros (more discussion needed). One that I personally miss,

is "Suggest type assignable to ". E.g. for "using" LT I need only IDisposable types. Also method-related macros are missed (including constructor). E.g. for "new object" LT ($TYPE$ $VAR$ = new $TYPE$()) I'd like to select type, have suggested var AND select constrcutor. >]]>

8. After edit LT grid is positioned on the first element.

>

More to come :)



0
Comment actions Permalink

Separate replies to maintain discussion...

I do not think many user will guess to invoke popup menu there. Usually there are not too big numbers and you immediately see the feedback (underlined) after selecting a value.


First, many users will try popup menus, when they see "rich" editor. And it appears to be "rich" with colors and highlights. Second, there could be more actions, like "Cursor here", that inserts (or moves!) $END$ macro. Third, I suppose people will create LTs from existing code and thus they need to copy code into editor and then "mark" several things with macros. So I would select real type, hit right mouse button, and use "Change to macro". Then, all occurences of this type should be changed to macro. Then I click in other place, and hit "Cursor here" from popup menu. Then I will assign macros as needed and I'm done.

0
Comment actions Permalink

using template might look like this:

using($TYPE$ $VAR$ = new $TYPE($END$))
{
}

Here $TYPE$ should be "type, assignable to IDisposable" and $VAR$ suggested from $TYPE$.

Actually, this is artificial example. In my project I see many applications of such macro, but I can't publish info about them.

0
Comment actions Permalink

Method-related macros. I'm not yet sure, that's just a guess of what might be needed. We can select types, and variable, but not methods in LT. I just feel that it is missing.

Ah, and we definitly need parameters! For example, I would like to have LT for checking that value passed to public API is non-null. I'd have something like:

0
Comment actions Permalink

And "current line number" should have its fellows "current file name", "current project name". However I see little value in these, becaue after code is edited line number will be broken, and copy-paste can break file and project...

0
Comment actions Permalink

I see your case now. Unfortunately we cannot search all subtypes of
particular type efficiently enough to allow such macro. So it should wait
until will be able to do this (we plan this).

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:27082896.1085063005929.JavaMail.itn@is.intellij.net...

using template might look like this:

>

using($TYPE$ $VAR$ = new $TYPE($END$))
{
}

>

Here $TYPE$ should be "type, assignable to IDisposable" and $VAR$

suggested from $TYPE$.
>

Actually, this is artificial example. In my project I see many

applications of such macro, but I can't publish info about them.
>
>


0
Comment actions Permalink

Method-related macros. I'm not yet sure, that's just a guess of what might

be needed. We can select types, and variable, but not methods in LT. I just
feel that it is missing.

Could you provide any usecase?

Ah, and we definitly need parameters! For example, I would like to have LT

for checking that value passed to public > API is non-null. I'd have
something like:

Well, this can easily be implemented. Please post a feature request.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:18005340.1085063288967.JavaMail.itn@is.intellij.net...

Method-related macros. I'm not yet sure, that's just a guess of what might

be needed. We can select types, and variable, but not methods in LT. I just
feel that it is missing.
>

Ah, and we definitly need parameters! For example, I would like to have LT

for checking that value passed to public API is non-null. I'd have something
like:
>

     throw new ArgumentNullException("$PARAM$");]]>



0
Comment actions Permalink

Yes, I also see little sense in "current line number" macro. Maybe we should
drop it. "Current file name" and others probably make sense. There can be
also "current date", "current date/time", "current user name" etc.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:30503638.1085063568882.JavaMail.itn@is.intellij.net...

And "current line number" should have its fellows "current file name",

"current project name". However I see little value in these, becaue after
code is edited line number will be broken, and copy-paste can break file and
project...


0
Comment actions Permalink

Hmm, isn't it the same as when "Goto inheritors" used?

0
Comment actions Permalink

I've submited an SCR:
http://www.intellij.net/tracker/resharper/viewSCR?publicId=2664
You can add more suggestions (of similar macros) as comments.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Valentin Kipiatkov (JetBrains)" <valentin@intellij.com> wrote in message
news:c8im5v$ogl$1@is.intellij.net...

Yes, I also see little sense in "current line number" macro. Maybe we

should

drop it. "Current file name" and others probably make sense. There can be
also "current date", "current date/time", "current user name" etc.

>

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:30503638.1085063568882.JavaMail.itn@is.intellij.net...

And "current line number" should have its fellows "current file name",

"current project name". However I see little value in these, becaue after
code is edited line number will be broken, and copy-paste can break file

and

project...

>
>


0
Comment actions Permalink

Yes, it's the same. Is it ALWAYS fast enough?

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:17305866.1085071006850.JavaMail.itn@is.intellij.net...

Hmm, isn't it the same as when "Goto inheritors" used?



0
Comment actions Permalink

On MY computer, I didn't notice any case when this operation is slow. Actually, openning inheritors for Object takes about 400 ms, and this one is probably the longest.

May be this could be option-controlled, so users of slow computers don't suffer?

0

Please sign in to leave a comment.