RS options (Language -> Common)

I was looking at some configuration options which I've not had the need to use to yet so I thought I'd experiment. Could someone explain to me what the following are meant to do:

1. Language -> Common -> Naming Style: I can't quite work out what you are meant to put in the text boxes and what to look for in the code so I can see the effect they have. I'm sure there is a simple explanation but it escapes me.

2. Language -> Common -> File Header Text: I added some comment statements in the textbox. I then created a new class and half-expected to see those comments automatically created at the top of the source file but nothing was created. Perhaps this configuration option is doing something else but the name makes me think it should create some text in the source file?

6 comments
Comment actions Permalink

Hello,

1. Language -> Common -> Naming Style: I can't quite work out what
you are meant to put in the text boxes and what to look for in the
code so I can see the effect they have. I'm sure there is a simple
explanation but it escapes me.


If a constructor parameter is called "name", a field its value is stored
in is called "_name", and the property for getting it is called "Name", then
an underscore ("_") is the field name prefix.

They're needed to suggest correct names for fields, remove the field prefix
when a property is generated to expose the field, and so on.

2. Language -> Common -> File Header Text: I added some comment
statements in the textbox. I then created a new class and
half-expected to see those comments automatically created at the top
of the source file but nothing was created. Is that what it's meant to
do?


Basic info in http://www.jetbrains.com/resharper/docs/resharper-help.zip,
"file header" in the index.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

It would be a great feature if RS provided a mechanism to "correct" naming -- i.e. add/remove underscores as configured -- in existing code.

0
Comment actions Permalink

Hello Brian,

This is planned.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


BS> It would be a great feature if RS provided a mechanism to "correct"
BS> naming -- i.e. add/remove underscores as configured -- in existing
BS> code.
BS>


0
Comment actions Permalink

Ilya, I've experimented with it and the header text is inserted at the top of the source file when I do a code cleanup. Why would you want to add header text on a cleanup? For example, If I set the header text and do a cleanup it's inserted. If I then manually add some additional comments at the top of the source file and do another code cleanup, RS deletes them and inserts the file header text. I can't quite see what the file header text is bringing to the party. Granted, it works, but I can't see why you'd want to use the file header text option in the first place. Some of our developers maintain a history of changes at the top of source files. I personally don't but if I ran a cleanup using file header text I'm quite sure they would not thank me for wiping out the history of code changes they've gone to some length to maintain.

From where I sit, I'd rather file header text was added to newly created source files as it would be potentially useful for adding copyright information to newly created source files. In those cases, yes, file header text is useful. But as a one-off insertion at the time of code cleanup is perhaps less intuitive. I don't think you guys would have added it as an option without a reason for doing so. Right now, I can see the solution but I can't quite see the problem it was intended to solve.

Edited by: Peter Hamilton-Scott on Jul 18, 2008 3:00 PM

0
Comment actions Permalink

Nothing against any of your requests, because after all I'm all for R# gaining all sorts of flexible features, but I do just have to make a crack about one thing:

"Some of our developers maintain a history of changes at the top of source files"

Then perhaps you should teach them to instead use the revision control system for, surprise surprise, revision control. :)

0
Comment actions Permalink

Jeremy, I agree with what you say but I'm wearing a different hat from their perspective. I sometimes add some comments before the first namespace. Not often, I admit, but I've sometimes put generic 'TODO' comments up there. I'd hate to lose those to a full header text replacement. I'm at a stage in life where I have the memory retention of a garden slug! :)

0

Please sign in to leave a comment.