jEdit Community - Resources for users of the jEdit Text Editor
Comment indentation
Submitted by iutinvg on Friday, 2 March, 2007 - 04:21
Hi,

jEdit indent the comment block as following:
/**
* Blah...
*/

Is it possible to make him do it as following:
/**
.* Blah...
.*/

Did anybody find a way todo it without patching?

Thank you very much for advance!
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Me too
by jedi on Mon, 15/10/2007 - 20:46
Did you find a solution to this one? I'm having the same problem...

Thanks
 
auto-indentation seems to do it right
by taylor_venable on Wed, 17/10/2007 - 16:10
The default automatic indentation seems to handle it correctly, with soft tabs enabled anyway. As long as you don't enter a character that forces jEdit to re-calculate indentation (like while defining nested hash-tables in Perl, for example) the current indentation level will be kept. So you only have to indent the first star manually, and then when you hit enter to go down to the next line the cursor should be on the column on which the first star was placed.
 
Auto-indent the first start as well?
by jedi on Thu, 25/10/2007 - 21:10
Thanks for your response.

I use auto-indenting with soft-tabs as well. I realize that it works if I indent the first star (actually the third star but the first star of the second line) manually but I wouldn't want to do that.

Firstly, because it's extra work but mainly because I often have to look at code written by others (and it can be quite messy) and I have written a small macro which indents the whole buffer with one keystroke. When I indent the whole buffer like this it will put those stars back into wrong place anyway.

Is it not possible to auto-indent the first star correctly?

Thanks again.
 
How exactly are you generatin
by elberry on Wed, 31/10/2007 - 20:32
How exactly are you generating the comments? What is the mode? From what I've read, jedit is acting as it should. It seems that maybe you're asking jedit to have a different tab scheme when it's in a comment vs. not. Like, "Add one space on next line". Currently, as far as I know the mode files don't provide for this functionality. However, it seems that maybe this should be the responsibility of a code formatter/beautifier. You could also use SuperAbbrevs to create an abbreviation to start these comments for you.

I have one for Javadoc comments.
abbrev: jdoc
Template text:
[code]
/**
 * ${1:Your Javadoc Comment}$end
 */
[/code]

Learn from the past. Live in the present. Plan for the future.
 
Not generating
by jedi on Fri, 02/11/2007 - 12:57
I've tried this in Java and C++ mode. I "generate" comments by writing them. I'm not using any macros or abbreviations. So, for example, if I open a new Hello.java file and start typing /** [enter] *, it looks like this:

/**
*

And it doesn't matter if I hit TAB on that second line. Is this the normal behavior in JEdit?

Thanks.
 
In short: Yes.
by elberry on Sat, 03/11/2007 - 09:33
Yes, I would consider this to be normal jEdit behavior because jEdit really isn't an IDE, it's an extremely excellent text editor with tons of features.

I'm not completely familiar with writing mode files, but I don't think there is currently a way to specify that a new space should be added before each new line when inside a comment.

My best suggestion would be to use the SuperAbbrevs plugin, and to create an abbreviation.

I have some for java that handle javadoc comments. I'll upload them in the files section here (on the community site), then you can import them (if you're using the version for 4.3preX).

Some of them are:
"jdoc" expands to:
/**
 * Your Javadoc comment
 */


"auth" expands to:
* @author [author global variable]


So to get a javadoc comment with the author attr, you'd type: "jdoc" tab, type your comment, tab, enter, "auth" tab again.

There are others for the rest of the jdoc attributes.

Hope that helps.

Learn from the past. Live in the present. Plan for the future.
 
Thanks for your quick replies
by jedi on Sun, 04/11/2007 - 20:01
Thanks for your quick replies. I have been thinking about using an abbreviation for the comment-generation, but it doesn't solve the problem of indenting the whole buffer with one keystroke.

Currently I'm using following macro:


car_line = textArea.getCaretLine();
textArea.selectAll();
textArea.indentSelectedLines();
textArea.setCaretPosition(textArea.getLineStartOffset(car_line));


Seems a bit odd that the mode can't indent the comments correctly automatically, but I guess I'll just have to write a more clever macro and have a look at those abbreviations you mentioned.

Thanks again.
 
I think the mode files can "i
by elberry on Sun, 04/11/2007 - 20:44
I think the mode files can "indent" the next line for you, because they do when you create a new function.
Eg.

You create a new Java file, and you type:
"public void myMethod() {" When you hit the enter key, it automatically indents the next line, which I believe is a mode file thing.

However, it's going to indent it using the "indent" property found in the global settings.

What you want, is to have a different indent value for when you're in comments, which is not available.

If you really want this to be a part of jEdit, you should put in a feature request on the sourceforge site:
http://sourceforge.net/tracker/?group_id=588&atid=350588

This doesn't sound like a bad feature, in fact it could open up the floor for better mode files, and better language support.

As for the tab entire buffer. I'm personally fine with hitting ctrl+a tab, but your macro seems fine. I would only suggest that you add a textArea.selectNone() after you're done indenting.

Learn from the past. Live in the present. Plan for the future.
I don't see the tabs.....
by LDiracDelta on Fri, 23/03/2007 - 21:37
I don't see the tabs.....

You can use this website to "escape" your text for html:
http://accessify.com/tools-and-wizards/developer-tools/quick-escape/
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293