"Create Method from Event"
I just discovered this by accident ( the little lightbulb that shows up when
an event handler doesn't have a method for it )
It's a WONDERFUL idea. I would recommend the following changes...
make it easier to see . It only shows up for a few seconds when you do a
build and there is a compile error. I think this is just a bug that needs to
be worekd out, not the actual design.
Add a "Change Event Name". It would be nice to be able to rename the event
methods.
Just a thought! Thanks for your time!
Please sign in to leave a comment.
Well, if I understood you rightly, you mean the following case. You have a
code like
e += new SomeDelegate(MethodName);
Where e is an event and SomeDelegate is a delegate type of the event. If
ReSharper cannot resolve "MethodName" it gets highlighted in red.
As soon as it is red any time you put the caret on MethodName (e.g., by
using F2 to navigate between errors) and wait for a little while
(approximately half a second) you'll see a light-bulb at the beginning of
the line containing the error. You can also press Alt+Enter if you do not
want to wait till the light-bulb appears. You will be given a number of
options in a list among which are "Create method 'MethodName'".
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Derek" <derek@btacinc.com> wrote in message
news:c63cjj$i2n$1@is.intellij.net...
when
>
to
>
>
>
>
I mean, you do not need to compile. You can use the feature as soon as the
text gets highlighted.
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:c63dbg$n5n$1@is.intellij.net...
>
>
>
>
>
>
>
needs
event
>
>
Yeah.That'd be the feature. I've never heard of this before. Where is it
documented?
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:c63der$nic$1@is.intellij.net...
>I mean, you do not need to compile. You can use the feature as soon as the
>
>
>
>
>> Well, if I understood you rightly, you mean the following case. You have
>> a
>> code like
>>
>> e += new SomeDelegate(MethodName);
>>
>> Where e is an event and SomeDelegate is a delegate type of the event. If
>> ReSharper cannot resolve "MethodName" it gets highlighted in red.
>> As soon as it is red any time you put the caret on MethodName (e.g., by
>> using F2 to navigate between errors) and wait for a little while
>> (approximately half a second) you'll see a light-bulb at the beginning of
>> the line containing the error. You can also press Alt+Enter if you do not
>> want to wait till the light-bulb appears. You will be given a number of
>> options in a list among which are "Create method 'MethodName'".
>>
>>
>> --
>> Andrey Simanovsky
>> Software Developer
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>>
>>
>>
>> "Derek" <derek@btacinc.com> wrote in message
>> news:c63cjj$i2n$1@is.intellij.net...
>> > I just discovered this by accident ( the little lightbulb that shows up
>> when
>> > an event handler doesn't have a method for it )
>> > It's a WONDERFUL idea. I would recommend the following changes...
>> >
>> > make it easier to see . It only shows up for a few seconds when you do
>> > a
>> > build and there is a compile error. I think this is just a bug that
>> to
>> > be worekd out, not the actual design.
>> >
>> > Add a "Change Event Name". It would be nice to be able to rename the
>> > methods.
>> >
>> > Just a thought! Thanks for your time!
>> >
>> >
>>
>>
>
At http://www.jetbrains.net/confluence/display/ReSharper/Features (you may
need to login -- use the same login/password as when Download), section
QuickFixes. Sorry for having no complete list of them (but this is EAP:). As
soon as new ones appear they are usually announced in the changes list.
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Derek" <derek@btacinc.com> wrote in message
news:c63did$ong$1@is.intellij.net...
>
the
have
If
by
of
not
up
do
>
>
Hello Andrey,
The problem I have with this feature is that it disables an easier-to-use VS.NET feature that lets you implement the missing method by just pressing the TAB key. Please don't take away functionality that VS.NET actually gets right!
Thanks!
-Michael
>> Yeah.That'd be the feature. I've never heard of this before. Where is
>> it documented?
>>
>> "Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
>> news:c63der$nic$1@is.intellij.net...
>>
>>> I mean, you do not need to compile. You can use the feature as soon
>>> as
>>>
>>> text gets highlighted.
>>>
>>> --
>>> Andrey Simanovsky
>>> Software Developer
>>> JetBrains, Inc
>>> http://www.jetbrains.com
>>> "Develop with pleasure!"
>>> "Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in
>>> message news:c63dbg$n5n$1@is.intellij.net...
>>>
>>>> Well, if I understood you rightly, you mean the following case. You
>>>>
>>>> a
>>>> code like
>>>> e += new SomeDelegate(MethodName);
>>>>
>>>> Where e is an event and SomeDelegate is a delegate type of the
>>>> event.
>>>>
>>>> ReSharper cannot resolve "MethodName" it gets highlighted in red.
>>>> As soon as it is red any time you put the caret on MethodName
>>>> (e.g.,
>>>>
>>>> using F2 to navigate between errors) and wait for a little while
>>>> (approximately half a second) you'll see a light-bulb at the
>>>> beginning
>>>>
>>>> the line containing the error. You can also press Alt+Enter if you
>>>> do
>>>>
>>>> want to wait till the light-bulb appears. You will be given a
>>>> number of options in a list among which are "Create method
>>>> 'MethodName'".
>>>>
>>>> --
>>>> Andrey Simanovsky
>>>> Software Developer
>>>> JetBrains, Inc
>>>> http://www.jetbrains.com
>>>> "Develop with pleasure!"
>>>> "Derek" <derek@btacinc.com> wrote in message
>>>> news:c63cjj$i2n$1@is.intellij.net...
>>>>> I just discovered this by accident ( the little lightbulb that
>>>>> shows
>>>>>
>>>> when
>>>>
>>>>> an event handler doesn't have a method for it )
>>>>> It's a WONDERFUL idea. I would recommend the following changes...
>>>>> make it easier to see . It only shows up for a few seconds when
>>>>> you
>>>>>
>>>>> a
>>>>> build and there is a compile error. I think this is just a bug
>>>>> that
>>> needs
>>>
>>>> to
>>>>
>>>>> be worekd out, not the actual design.
>>>>>
>>>>> Add a "Change Event Name". It would be nice to be able to rename
>>>>> the
>>>>>
>>> event
>>>
>>>>> methods.
>>>>>
>>>>> Just a thought! Thanks for your time!
>>>>>
Michael,
in build 78, we've made some corrections that allow you to use VS TAB hint
if you are quick enough.
The problem is the ReSharper quick fix ('bulb') appears after some delay
when you have typed
an unresolved identifier, and this cancels VS TAB hint. Ideally, ReSharper
quick fixes must not appear if
VS hint is displayed, but we've not found a way to detect the latter fact
yet.
"Michael Teper" <michael.dot.teper@convade.dot.com> wrote in message
news:c63hl5$jgk$1@is.intellij.net...
>
VS.NET feature that lets you implement the missing method by just pressing
the TAB key. Please don't take away functionality that VS.NET actually gets
right!
>
>
>
Michael,
With our features you can achieve pretty the same functionalty in
another (better for me) way. If you have the following code:
event EventHandler myEvent;
void foo()
{
myEvent += new |
}
and press CtrlShiftSpace (smart complete) here it will automatically
propose "EventHandler()". When you choose it you have the following code:
myEvent += new EventHandler(|)
Now you can type the preferred method name (not hard-coded, like in VS.NET,
but any you'd like). Note that the caret is placed inside brackets so you
can type the method name immediately.
After that you can press Alt+Enter and generate the method.
NOTE: You can also press CtrlShiftSpace inside the parentheses to get list
of all existing methods which match the delegate signature
--
Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Michael Teper" <michael.dot.teper@convade.dot.com> wrote in message
news:c63hl5$jgk$1@is.intellij.net...
>
VS.NET feature that lets you implement the missing method by just pressing
the TAB key. Please don't take away functionality that VS.NET actually gets
right!
>
>
>
Added to the "Did you know?" section.
http://www.jetbrains.net/confluence/display/ReSharper/DidYouKnow%3F
--
Oleg Stepanov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Oleg Stepanov (JetBrains)" <Oleg.Stepanov@JetBrains.Com> wrote in message
news:c659kj$eg0$1@is.intellij.net...
>
>
>
>
>
>
VS.NET,
>
list
>
easier-to-use
gets
>
>
Now you can type the preferred method name (not hard-coded, like in VS.NET, but any you'd like).
In VS.NET you can edit method name before you press TAB for the second time, it will keep hint while caret is inside "()". For me, the best advantage of re#er is ability to reopen smart-complete, quick-fix and other hints at any time.
Hello Oleg,
For me, thats not better because it actually requires me to type in the method name. I've actually been happy with VS.NET's default of "_]]>" naming convention and would hate to have to type that out by hand.
Perhaps, as a compromise, you could auto-populate the method name but then select it just like you do a live template so that it can be modified or just accepted by pressing TAB. Would that be possible?
-Michael
Hey Oleg,
Feedback on "Create Method from Event"...
Intellisense version...
"+= " gets you the suggested template (highlighted for over type)
]]> gets you "new EventHandler(default_method_name)" with
default_method_name highlighted for over type
]]> gets you method body template
[note: I like the template highlighting (one line template only?) so it can
be over typed]
Is it somehow better to wait on "new"? Why not after the "+= "? Seems
somewhat less optimal.
ctrlshiftspace method list is very nice feature.
Suggestion(s)...
completion available after "+= "
completion highlighted for over type
completion includes a suggested/default method name
method name highlighted for overtype/ctrlshiftspace
R#r preferences includes configuration for EventHandler method names
something like and
- example usage... On
available to build default names , _On, youget the idea
Is it common, or not uncommon, to put event handlers in a different file
than where you hook the event? Or another way... is there any value in
allowing the method body to be inserted into a different Class or source
file? Just curious ;)
I plan to re-install R#r .78 build and I'll get some hands on. Cpu spikes
were killing me (5+/hour infinite spikes) last few builds.
/jhd
"Oleg Stepanov (JetBrains)" <Oleg.Stepanov@JetBrains.Com> wrote in message
news:c659kj$eg0$1@is.intellij.net...
>
>
>
>
>
>
,
>
list
>
easier-to-use
gets
>
>
We invented some approach which will help with this. See
http://www.intellij.net/tracker/resharper/viewSCR?publicId=1975 for more
details.
--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"John Dhom" <a@b.c> wrote in message news:c665km$8ec$1@is.intellij.net...
>
>
>
>
can
>
>
>
>
>
>
>
code:
VS.NET
you
pressing
(you
is
message
soon
You
you
changes...
>
>
Looks workable.
What do you think about the idea of being able to configure default method
names, any merit? Or do you see people just typing them in always?
/jhd
"Valentin Kipiatkov (JetBrains)" <valentin@intellij.com> wrote in message
news:c66f52$4t1$1@is.intellij.net...
>
>
names
you
spikes
message
get
Download),
announced
Where
red.
while
when
rename
>
>
What will people say? We need opinions.
--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"John Dhom" <a@b.c> wrote in message news:c69589$8ea$1@is.intellij.net...
>
>
>
news:c665km$8ec$1@is.intellij.net...
it
file
source
in
automatically
so
actually
http://www.jetbrains.net/confluence/display/ReSharper/Features
(but
case.
the
MethodName
if
that
bug
>
>
Hello Valentin,
>> What do you think about the idea of being able to configure default
>> method names, any merit? Or do you see people just typing them in
>> always?
>>
VK> What will people say? We need opinions.
My preferred naming style (On]]>) is different from the default naming convention of Visual Studio, so I'll appreciate the possibility to configure the template for default method names.
--
Dmitry Jemerov
OmniaMea Project Leader
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
I share this viewpoint. The default naming convention of VS looks oddly to
me, because it includes the name of the instance
variable that is usually irrelevant to what the event handler does. Besides,
after renaming the instance, name of the event handler
looses any sense, unless it is also renamed.
"Dmitry Jemerov (JetBrains)" <yole@jetbrains.com> wrote in message
news:c6b08j$n5q$1@is.intellij.net...
>
>
default naming convention of Visual Studio, so I'll appreciate the
possibility to configure the template for default method names.
>
My preferred name style is Handle]]>. The On* style may conflict with event invoking method. So it would be something like:
name.TextChanged += new EventHandler(HandleNameTextChanged);