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

Brandon

  • Community Member
  • Posts: 29
  • Hero Points: 4
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: 785
  • Hero Points: 41
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: 29
  • Hero Points: 4
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: 29
  • Hero Points: 4
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: 785
  • Hero Points: 41
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: 29
  • Hero Points: 4
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: 785
  • Hero Points: 41
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.