From: Peter Graves <peter@ar...> - 2004-07-29 01:26:39
Thanks for the patch!
CSharpMode.java appears to be more or less cut-and-pasted from
This isn't necessarily bad per se, but there is a bunch of truly
irrelevant stuff in there. One example is the Java debugger support
(search for "jdb"), which is obviously not needed for C#.
In addition, many of the methods in CSharpMode.java are identical to
methods in JavaMode.java: see, for example, indentComment(),
What I did for C mode and C++ mode was to derive the corresponding mode
class from JavaMode.java, and just change what needed to be changed.
I think in principle this is the right approach, since it minimizes the
duplication of code. The down side, of course, is that future changes
to JavaMode.java might end up unwittingly breaking C# mode.
I realize that you probably wanted to be as unobtrusive as possible,
which is certainly a good thing, and what you've actually done has
the real virtue of providing a C# mode without touching much of
But I'd rather not have the same exact code in more than one place, if
at all possible, and of course there shouldn't be any code in there
at all that isn't relevant to the task at hand.
So, do you think you could try the approach of deriving the CSharpMode
class from the JavaMode class, in order to minimize the duplicated
code? As a side effect, this would probably also get rid of the
irrelevant code mentioned above, since it would, in all likelihood, get
rid of almost all the code in CSharpMode.java. It would also make
clearer exactly what changes you've made, so it would be easier to
audit the patch.