anacierdem / vscode-requirejs

Provides goto definition functionality for require js modules.
MIT License
21 stars 14 forks source link

Module definition using arrow function - go to type #50

Closed ladariha closed 6 years ago

ladariha commented 6 years ago

I'm using arrow functions like this:

define(["module1", "module2"], (module1, module2) =>{
   console.log("yeah");
})

In this case e.g. Go To Definition (aka Ctrl+Click on the string "module1" or "module2") does not work. It works if I change it to good old function instead of the arrow function syntax.

Would it be possible to support arrow functions as well? Thank you

anacierdem commented 6 years ago

This will be nice indeed. I'll have a look when I have the time.

ladariha commented 6 years ago

I have no experience with VSCode extensions, but I offer my help if you could point me to some direction :) It looks like maybe the change needed is in getModulesWithPathFromRequireOrDefine with tweaking the params regexp at line 78? At least it's the only place I've found string "function"

anacierdem commented 6 years ago

There are a few issues remaining mainly on getRequireOrDefineStatements.

You may continue from there :)

anacierdem commented 6 years ago

I think I have resolved them. Can you try version 0.1.13 and verify?

ladariha commented 6 years ago

Awesome, thanks a lot for the quick implementation.