Wikunia / brackets-FuncDocr

FuncDocr generates JS/PHPDoc annotations for your functions
101 stars 14 forks source link

Adding extra jdoc tags #62

Closed yuretz closed 7 years ago

yuretz commented 9 years ago

Hello, When I add extra jsdoc tags, for example @throws {Error} Will throw if something is wrong, the line sometimes gets indented wrong, so that @throws is aligned with previous annotation description text. It seems it only happen if previous annotation text was wrapped. Is there a way to avoid this behavior? Right now I'm just manually re-indenting those lines, but it gets annoying pretty soon, so I decided to try and ask here :)

Thanks!

BR, Yuriy

Wikunia commented 9 years ago

Hey,

sorry for my late response :/ Can you provide a simple example?

yuretz commented 9 years ago

Yes, sure.

Please see the image below: Indentation bug

So, what happens in this case, is that I'm wrapping the long line by hitting 'Enter' and then trying to re-indent it by hitting 'Tab'. Maybe there were some other cases, when it behaved similarly, but right now I can't remember. FuncDocr 0.8.26, Brackets 1.3 In the screen capture I forgot curly brackets around {Error}, but it doesn't change the behavior anyway.

Wikunia commented 9 years ago

Hmm thanks, yeah I think I will need some time to solve it. Thanks for the issue and stay tuned!

Wikunia commented 8 years ago

Hi @yuretz this one is the new version which isn't good as well :/ brackets-funcdocr- 62 The problem is that I have a maximum padding which aligns the descriptions but probably you would like to see something like this? brackets-funcdocr- 62-opt2

Or the third option would be: brackets-funcdocr- 62-opt3

FYI the current implementation of @throws is: "throws": "@throws [[Description]]", there is no name field for the name of the error.

Wikunia commented 8 years ago

Maybe you would like to test the newest version 0.8.27 (Install from url) It's not perfect but unfortunately it is more complex than I thought of...

yuretz commented 8 years ago

Hi Wikunia, Thanks for your replies. I'll definitely try it tomorrow. Would I be able to install it directly from the repo url?

Wikunia commented 8 years ago

Yes it is in the master branch

yuretz commented 8 years ago

Hi again,

Thanks for the new version. It's really nice to see that small (but very useful) things like FuncDocr get their deal of support and attention!

I have tested the new version a little bit. It seems like it solves part of the issue, but not all of it. And you are probably right, this looks like a more complex general problem with manual editing of auto-generated comments.

When I add @throws, or any other jsdoc tag after existing auto-generated tags, what I do is

Regarding the solution, it's hard to tell which one is the best. There is no doubt that all @<tag_name> parts should be aligned in the start. From there, as I see it, you have two options:

  1. Align the rest of the fields in columns by fields' relative position. Like, 1st field is always in the first column after the tag, 2nd is in the 2nd and so on. This one is probably the easiest option.
  2. Align the rest of the fields in columns, taking into account the field purpose. Like, all names get their own separate column, all type names get their separate column, all textual descriptions too, and so on. This will probably look better, but might be more difficult to implement, and eats more screen space for indentation.

As for me, I could definitely live with any of those options implemented, as long as manual re-indentation is not necessary (or minimal) to make the jsdoc comment block look reasonable.

BTW, would it be possible to support both @throws template with and without exception type included?

Wikunia commented 8 years ago

Again version v0.8.27 ;) Would be great if you would install it from url! Changes:

Thanks for your support. With the current implementation two hints for @throws aren't possible because I might want to use the number of [[...]] for a specified tag for alignment which isn't easily possible with two different implementations for @throws. But I think @throws should have always an exception type, right? Then it's better documented I think ;)

yuretz commented 8 years ago

Hi, Thanks for the updated version. I'm testing it right now, and it looks good so far. I agree that having documentation with explicit exception types is much better than without them. I personally always use it with the type.

Wikunia commented 8 years ago

Okay and then it will look like @throws {[[ExType]]} [[Description]] and ExType can be filled if the syntax throw new UserException("..."); is used right?

yuretz commented 8 years ago

Exactly!

Wikunia commented 7 years ago

Hi @yuretz , It's 2017 now and wow just read our small conversation again. Looks like I can close this issue, right? Otherwise just reopen it! ;)

yuretz commented 7 years ago

Sure, thank you!