Something about QuickFixes

Hello.

Currently it is very convinient to generate a readonly member from unused
constructor parameter by applying a quickfix. However as code changes I
sometimes realize that I actually need this kind of field for the parameter
passed to the constructor and already used.

Here is some sort of example:


Everything looks good, but suddenly I realize that I need to access 'view'
and 'selectionManager' parameters from outside of the constructor (e.g. from
an event handler). The fastest way today to get these fields and assignment
statements generated is to
1) comment the body of the constructor
2) apply quickfixes
3) uncomment the body

Sounds weird, does not it? =)

Actually the nature of the problem seems to be even more general. Some of
the quickfixes are not only useful for code-fixing but for code-generating
also. Do you have any plans to make this functionality available in "no
error" context?

Regards.


2 comments
Comment actions Permalink

Actually the nature of the problem seems to be even more general. Some
of the quickfixes are not only useful for code-fixing but for
code-generating also. Do you have any plans to make this functionality
available in "no error" context?


Yes, we plan something like that. In IDEA we had so called "Intention Actions" that look like quickfixes but appear on valid code.

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


Hello.

Currently it is very convinient to generate a readonly member from
unused constructor parameter by applying a quickfix. However as code
changes I sometimes realize that I actually need this kind of field
for the parameter passed to the constructor and already used.

Here is some sort of example:

 public EntitySelectionTracker(IEntitySelectionManager
> selectionManager,
> IEntityCollectionView view)
> {
> view.ListView.SelectedIndexChanged += new
> EventHandler(ListView_OnSelectedIndexChanged);
> selectionManager.BeforeSelectionReset += new
> EntitySelectionManagerEventHandler(SelectionManager_OnBeforeSelectionR
> eset);
> selectionManager.AfterSelectionSet += new
> EntitySelectionManagerEventHandler(SelectionManager_OnAfterSelectionSe
> t);
> }
> ]]>

Everything looks good, but suddenly I realize that I need to access
'view'
and 'selectionManager' parameters from outside of the constructor
(e.g. from
an event handler). The fastest way today to get these fields and
assignment
statements generated is to
1) comment the body of the constructor
2) apply quickfixes
3) uncomment the body
Sounds weird, does not it? =)

Actually the nature of the problem seems to be even more general. Some
of the quickfixes are not only useful for code-fixing but for
code-generating also. Do you have any plans to make this functionality
available in "no error" context?

Regards.


0
Comment actions Permalink

Yes, we plan something like that.

Glad to hear this.

In IDEA we had so called "Intention Actions" that look like quickfixes but

appear on valid code.
Yes, I understand what you are talking about, just forgotten the official
name of that feature.

Regards.


0

Please sign in to leave a comment.