Hi,
I recently opened one of my old Java files and remembered I used some snippet to create a method and automatically create a header comment and javadoc comment like this:
/** * doSteps * * calculate n steps each lasting 0.005s * * @param steps number of steps each of which accounts for 0.005s */ public void doSteps(int steps) { //do smth...; }
I can't find this anywhere anymore. Can anyone help me out here? The snippet automatically jumped to the return type, then the function name (also inserting it at the top in the comment), then to the @param thingy to enter text and finally to the function itself to write some code. At least that's how I think it went. Might be that I idealize a bit from bad memory :P
Does someone know of a snippet like this? I already searched the web but couldn't find something. (Yeah I also searched the Javadoc bundle... but it isn't there :( ) Maybe I was just dreaming of this snippet :(
Thanks, Thomas Krajacic
I don't know about JavaDoc, but in PHP, you type doc [tab] directly above a function or method block and it gives you the bones, including any variable names ready to fill in.
Walter
On Apr 23, 2009, at 1:03 PM, Thomas Krajacic wrote:
Hi,
I recently opened one of my old Java files and remembered I used some snippet to create a method and automatically create a header comment and javadoc comment like this:
On 24/04/2009, at 3:20 AM, Walter Lee Davis wrote:
I don't know about JavaDoc, but in PHP, you type doc [tab] directly above a function or method block and it gives you the bones, including any variable names ready to fill in.
I didn't know about this. I'll check it out and see if we can port it over to work on Java/Groovy.
Thanks Walter.
BTW,
When inside a class the bundle doesn't recognize javadoc blocks although they are valid (e.g. for constructor or fields). Is this a quick fix? I looked inside the definition but have never played with language grammars before.
thx Thomas Krajacic
On 24 Apr 2009, at 02:37, Luke Daley wrote:
On 24/04/2009, at 3:20 AM, Walter Lee Davis wrote:
I don't know about JavaDoc, but in PHP, you type doc [tab] directly above a function or method block and it gives you the bones, including any variable names ready to fill in.
I didn't know about this. I'll check it out and see if we can port it over to work on Java/Groovy.
Thanks Walter.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Ah I see the problem.(As usual just after posting :P ) The language grammar can't deal with method declarations like this:
private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44);
Where the parameters are indented (did it because of wrapping requirements) the coloring is also wrong. This is valid Java though....
Maybe someone is up to the task fixing this. Thank you!
Thomas Krajacic
On 24 Apr 2009, at 19:17, Thomas Krajacic wrote:
BTW,
When inside a class the bundle doesn't recognize javadoc blocks although they are valid (e.g. for constructor or fields). Is this a quick fix? I looked inside the definition but have never played with language grammars before.
thx Thomas Krajacic
On 24 Apr 2009, at 02:37, Luke Daley wrote:
On 24/04/2009, at 3:20 AM, Walter Lee Davis wrote:
I don't know about JavaDoc, but in PHP, you type doc [tab] directly above a function or method block and it gives you the bones, including any variable names ready to fill in.
I didn't know about this. I'll check it out and see if we can port it over to work on Java/Groovy.
Thanks Walter.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 25/04/2009, at 3:21 AM, Thomas Krajacic wrote:
Ah I see the problem.(As usual just after posting :P ) The language grammar can't deal with method declarations like this:
private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44);
Where the parameters are indented (did it because of wrapping requirements) the coloring is also wrong. This is valid Java though....
Maybe someone is up to the task fixing this. Thank you!
I am not seeing the same problem. Are you using the latest Java bundle from svn?
Yes I am using latest version from svn but I found the problem:
enter this:
class something { private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44); /** this is wrong because it starts in the fist line * @ */ }
I mistakenly wrote my comment on the first line of the javadoc block. this seems to be wrong, as below it doesn't recognize it as javadoc block anymore. This is my fault then I guess. don't know if it's forbidden to start writing in the first line.
But the syntax coloring for the method above still is wrong. it colors the methodname correctly when I write all the parameters in the same line.
On 27 Apr 2009, at 02:21, Luke Daley wrote:
On 25/04/2009, at 3:21 AM, Thomas Krajacic wrote:
Ah I see the problem.(As usual just after posting :P ) The language grammar can't deal with method declarations like this:
private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44);
Where the parameters are indented (did it because of wrapping requirements) the coloring is also wrong. This is valid Java though....
Maybe someone is up to the task fixing this. Thank you!
I am not seeing the same problem. Are you using the latest Java bundle from svn?
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 27/04/2009, at 5:19 PM, Thomas Krajacic wrote:
Yes I am using latest version from svn but I found the problem:
enter this:
class something { private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44); /** this is wrong because it starts in the fist line
- @
*/ }
I mistakenly wrote my comment on the first line of the javadoc block. this seems to be wrong, as below it doesn't recognize it as javadoc block anymore. This is my fault then I guess. don't know if it's forbidden to start writing in the first line.
That's a very strange style.
If there is anything on the first line after /** then it is strictly not javadoc. It won't be picked up by any tooling looking for javadoc.
I am not sure about putting the javadoc AFTER the method either. I very much doubt that is valid.
But the syntax coloring for the method above still is wrong. it colors the methodname correctly when I write all the parameters in the same line.
There must be more to it because that block of code by itself is recognised fine for me, everything is scoped as it should be.
Well the doc block is of course for the following method. Sorry if I was unclear. And it works as intended. it was just my stupid mistake to put the comment on the first line.
However when I put this in a vanilla Java file:
class test { private native long InitModel(); private native void Step(long modelPtr, int iterationsPerStep); private native void Term(long modelPtr); private native void setValue(long modelPtr, String Key, double Value); private native double getValue(long modelPtr, String Key); private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44); }
the final method () is colored differently (brown) and the two before it are also differently colored (white). Now I understand why the first 3 are yellow (with my theme) and the next 2 are white. This has to do with the capitalization of the methods.
But the last one should be white in my opinion since it is also lowercase like the ones before it. I must correct myself though. even when writing all the params in one line it stays brown...dunno why I remember otherwise. Sorry!
It colors the last method like it thinks it is the implementation... (because all the parameters are also colored like in the implementation, not the "prototype")
Does this coloring scheme make sense to you? Maybe I am just missing something (which I in no way doubt!) BTW I am using the Twilight Theme in TM
Thx for looking into this!
Thomas
On 27 Apr 2009, at 09:47, Luke Daley wrote:
On 27/04/2009, at 5:19 PM, Thomas Krajacic wrote:
Yes I am using latest version from svn but I found the problem:
enter this:
class something { private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44); /** this is wrong because it starts in the fist line
- @
*/ }
I mistakenly wrote my comment on the first line of the javadoc block. this seems to be wrong, as below it doesn't recognize it as javadoc block anymore. This is my fault then I guess. don't know if it's forbidden to start writing in the first line.
That's a very strange style.
If there is anything on the first line after /** then it is strictly not javadoc. It won't be picked up by any tooling looking for javadoc.
I am not sure about putting the javadoc AFTER the method either. I very much doubt that is valid.
But the syntax coloring for the method above still is wrong. it colors the methodname correctly when I write all the parameters in the same line.
There must be more to it because that block of code by itself is recognised fine for me, everything is scoped as it should be.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
I just worked this one out.
The method match was requiring a method body for a match to be made. In particular, it was bailing out of the match if it saw a ; after the params. This was necessary because otherwise simple statements involving method calls can look like method declarations.
What I have done is relaxed this requirement for native and abstract methods.
The code you have provided is now scoped correctly.
Cheers.
On 27/04/2009, at 6:26 PM, Thomas Krajacic wrote:
Well the doc block is of course for the following method. Sorry if I was unclear. And it works as intended. it was just my stupid mistake to put the comment on the first line.
However when I put this in a vanilla Java file:
class test { private native long InitModel(); private native void Step(long modelPtr, int iterationsPerStep); private native void Term(long modelPtr); private native void setValue(long modelPtr, String Key, double Value); private native double getValue(long modelPtr, String Key); private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44); }
the final method () is colored differently (brown) and the two before it are also differently colored (white). Now I understand why the first 3 are yellow (with my theme) and the next 2 are white. This has to do with the capitalization of the methods.
But the last one should be white in my opinion since it is also lowercase like the ones before it. I must correct myself though. even when writing all the params in one line it stays brown...dunno why I remember otherwise. Sorry!
It colors the last method like it thinks it is the implementation... (because all the parameters are also colored like in the implementation, not the "prototype")
Does this coloring scheme make sense to you? Maybe I am just missing something (which I in no way doubt!) BTW I am using the Twilight Theme in TM
Thx for looking into this!
Thomas
On 27 Apr 2009, at 09:47, Luke Daley wrote:
On 27/04/2009, at 5:19 PM, Thomas Krajacic wrote:
Yes I am using latest version from svn but I found the problem:
enter this:
class something { private native void setInitValues(long modelPtr, double n1, double n2, double p2, double p26, double p3, double wf, double t44); /** this is wrong because it starts in the fist line
- @
*/ }
I mistakenly wrote my comment on the first line of the javadoc block. this seems to be wrong, as below it doesn't recognize it as javadoc block anymore. This is my fault then I guess. don't know if it's forbidden to start writing in the first line.
That's a very strange style.
If there is anything on the first line after /** then it is strictly not javadoc. It won't be picked up by any tooling looking for javadoc.
I am not sure about putting the javadoc AFTER the method either. I very much doubt that is valid.
But the syntax coloring for the method above still is wrong. it colors the methodname correctly when I write all the parameters in the same line.
There must be more to it because that block of code by itself is recognised fine for me, everything is scoped as it should be.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 24/04/2009, at 3:03 AM, Thomas Krajacic wrote:
I recently opened one of my old Java files and remembered I used some snippet to create a method and automatically create a header comment and javadoc comment like this:
/** * doSteps * * calculate n steps each lasting 0.005s * * @param steps number of steps each of which accounts for 0.005s */ public void doSteps(int steps) { //do smth...; }
I can't find this anywhere anymore. Can anyone help me out here? The snippet automatically jumped to the return type, then the function name (also inserting it at the top in the comment), then to the @param thingy to enter text and finally to the function itself to write some code. At least that's how I think it went. Might be that I idealize a bit from bad memory :P
Does someone know of a snippet like this? I already searched the web but couldn't find something. (Yeah I also searched the Javadoc bundle... but it isn't there :( ) Maybe I was just dreaming of this snippet :(
Hi Thomas,
I took this snippet out. I tried using it but found that it broke down far too often. By that I mean that I wanted to do something that didn't quite fit in with how the snippet worked. My solution to that was to provide smaller snippets that could be combined for more flexibility.
Thanks Luke!
At least now I know that my memory didn't play tricks on me! :)
Just one thought: It's quite tedious to use the smaller snippets if you write lots of methods with comments over and over again, even when using your smaller snippets. Would it be possible to say create one bigger snippet, that uses the smaller ones in a predefined order? So that I would just have to use one snippet, that would enter lots of the smaller ones for me, since they are always the same order in my case?
Anyway I think that your smaller snippets are well done and a good idea for a clean organisation but I think they need some bigger combos to use them.
Thx for your work, Thomas Krajacic
On 24 Apr 2009, at 02:37, Luke Daley wrote:
On 24/04/2009, at 3:03 AM, Thomas Krajacic wrote:
I recently opened one of my old Java files and remembered I used some snippet to create a method and automatically create a header comment and javadoc comment like this:
/** * doSteps * * calculate n steps each lasting 0.005s * * @param steps number of steps each of which accounts for 0.005s */ public void doSteps(int steps) { //do smth...; }
I can't find this anywhere anymore. Can anyone help me out here? The snippet automatically jumped to the return type, then the function name (also inserting it at the top in the comment), then to the @param thingy to enter text and finally to the function itself to write some code. At least that's how I think it went. Might be that I idealize a bit from bad memory :P
Does someone know of a snippet like this? I already searched the web but couldn't find something. (Yeah I also searched the Javadoc bundle... but it isn't there :( ) Maybe I was just dreaming of this snippet :(
Hi Thomas,
I took this snippet out. I tried using it but found that it broke down far too often. By that I mean that I wanted to do something that didn't quite fit in with how the snippet worked. My solution to that was to provide smaller snippets that could be combined for more flexibility.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate