Author Topic: Javascript doc comment expansion doesn't work sometimes  (Read 606 times)

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Javascript doc comment expansion doesn't work sometimes
« on: October 11, 2017, 03:45:38 pm »
I've noticed in RC4 as well as previous betas that sometimes the /** doc expansion simply refuses to work on some files.

I can't explain this, as it seems to have something to do with the javascript source file itself...

  • If I try to do a doc comment above a regular function definition, it doesnt do anything except add the closing */.   Pressing ENTER just moves the */ to the next line, and it does NOT start even a blank doc comment (i.e. with the leading *)
  • If I copy that function to a separate .js file, and do it again, it works.
  • If I copy the entire contents of the file to a separate, new test.js file, guess what - doc expansion on the same function as before now works!
I can't understand what is different about the file itself....?   Document mode says javascript so I am at a loss here...

PS - I wish SE would support doc comments on object functions, such as

Code: [Select]
module.myfunc=function(a,b,c)
{
var x=0;
return x;
}

Since a lot of my work involves creation of modules, there are many, many functions like this that really need documenting and it just doesnt work.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #1 on: October 11, 2017, 04:17:04 pm »
I haven't reproduced it, but I'll take a look at the code for ideas. You already checked the document mode, that would have been the first thing I suspected. For the file it doesn't work for, if you look at the "defs" tab, does the entry for the function you're trying to add a doc exist and/or look correct?

Doc comments on object functions like that is doable.  It will actually generate the doc comment if the object function is at the top level.  I suspect the code doing the tag lookup is restricting it to top level functions, which doesn't make so much sense for Javascript where function nesting is the rule.  I'll take a look at fixing that for the point release.

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #2 on: October 11, 2017, 06:12:17 pm »
Yeah it's really intermittent.  Thanks for the quick reply - I was able to fix it by copying the content, saving it, pasting it back, and saving the file again.

If I see it again I'll look at the Defs tab and post.

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #3 on: October 13, 2017, 06:45:01 pm »
...and now it stopped working altogether.  This is with RC4.

Sigh.   I'll try the latest release and see.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #4 on: October 13, 2017, 08:01:12 pm »
So, does the defs tab show the right function information when you have the cursor on the function that Javadoc is failing on?

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #5 on: October 13, 2017, 08:41:35 pm »
Sorry, I did check that and it does.   Typing /**<return> just doesn't do anything.

This seems like a really obscure problem, maybe related to config files(?) because I also use a laptop with RC4 and it works but not on my desktop.   I really don't understand what is happening.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #6 on: October 16, 2017, 01:10:04 pm »
It's possible.  If you post your user.cfg.xml file from your configuration directory, I can try it with your configuration to see if I can reproduce it.  If you're not sure where your configuration directory is, you can bring up "Help -> About SlickEdit" and it will listed at the bottom of Program Information tab.

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #7 on: October 24, 2017, 03:08:59 pm »
I give up.

I installed the release version, and thought I had it.   But it seems that just when I think its working, it will eventually stop.   I've tried copying over the .sta file from a working installation on my laptop, but it appears that eventually over time it breaks for some reason.   I don't know what causes it to stop working.   The doc mode is Javascript.   The Defs panels shows the function correctly.   But typing /** and hitting enter just does nothing except move the */ to the next line.   

Not only is it not inserting my expansion, but it's also just not activating an empty doc comment (i.e. with the leading *).

One other thing:  if I use the command javadoc-comment directly, it works fine.


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #8 on: October 24, 2017, 03:17:37 pm »
That makes me suspect a particular area in the comment editing code. Would be easier if I could get it to happen, but I probably don't edit enough Javascript to run into it.  I'll have to put together a file you can load with with a fix for what I think is the problem, and maybe some debug prints to help me out if I'm wrong.  Probably won't happen today, more likely I'll have it tomorrow. 

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #9 on: October 26, 2017, 03:04:45 pm »
Sorry, fell down a rabbit hole yesterday.  I've attached some .e files for you to try out.  Save the attached files - it's fine just to dump them in your Downloads directory.

For each of the saved files, go to the SlickEdit command line and "load" the file.  So for c.e, you'd do something like "load /some/path/c.e".

As you type, a debug window may come up.  I tried to make the debugging so it's only chatty when something suspicious is happening, but it will probably come up before you have a javadoc failure.  Just iconify the debug window and continue.  When you run into the problem, bring that debug window back up, and hit Ctrl-C when it has focus - that will copy all of the debug messages to the clipboard.  And then paste those messages into a reply.

Afterwards, if you want to kill the debug logging, you can load the versions of the attached .e  that we shipped with, ie: load SLICKEDIT_INSTALL_PATH/macros/c.e

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #10 on: October 26, 2017, 06:44:50 pm »
Will do...thanks for the help! 
It may take a bit of time before I can look at this - big project going on right now.   Will post when I get a chance.

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #11 on: November 01, 2017, 09:15:39 pm »
So far, all I am ever seeing is:
    checkStatus unaccept 0
as soon as I type the first /

It is also showing this for every character I type, so it is way beyond chatty.

Brandon

  • Community Member
  • Posts: 34
  • Hero Points: 5
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #12 on: December 05, 2017, 04:28:35 am »
OK, I think I stumbled on to what is causing it to stop working.

 - If I set Javascript/Indent Style to Auto, the javadoc expansion stops working completely.

 - If I set it back to Syntax Indent, then it works.

This is confirmed with a fresh config folder and a simple javascript function.

Basically, every time I would upgrade and migrate my settings between betas, I would eventually turn syntax indent off because it was annoying me too much.  Or, I would import the old setting (where it was already off) and it wouldn't work from the start, causing me to think the import failed.

Jeez, this one setting has caused a lot of frustration.  I don't like syntax indent, but need javadoc, and don't see why I would have to globally enable that to make it work?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #13 on: December 05, 2017, 02:43:47 pm »
That I can reproduce, and I don't think that's intentional.  I'll take a look at it this morning, and see if it's hot-fixable.  Thanks for the update, I don't think I would have thought of changing that setting.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 821
  • Hero Points: 46
Re: Javascript doc comment expansion doesn't work sometimes
« Reply #14 on: December 05, 2017, 03:28:05 pm »
Yep, unintended behavior, the comment expansion/wrap doesn't need smart indent enabled.  I've put a fix in for the next hotfix.  Thanks for the update.