- This topic has 8 replies, 3 voices, and was last updated 5 years, 5 months ago by raphi.
-
AuthorPosts
-
raphiParticipantI have the problem that I cannot go to definition of functions that are not in the same file.
I try to do it with ctrl + click. I tried this with multiple projects. functions in the same js file seem to work.For example I have a project tree like this
-project
-projectfunctions.js
-webresources
-functions.js (here is the function i cannot go to definition)I am running Eclipse 2018-12 (4.10.0) and newest CodeMix version (2019.6.11)
Thanks for your help!
Greets,
Raphi
Salvador CabreraMemberHi raphi,
I have a few questions in order to help you better.
Are you using Angular, React or any other library/framework?
Are you using NodeJS or is this just a simple Web project?Cheers,
Sal
raphiParticipantHi Sal,
it’s a normal Web project. Only Javascript and JQuery.
Greets,
Raphi- This reply was modified 5 years, 5 months ago by raphi.
Salvador CabreraMemberHi raphi,
Thanks for the info.
I’m attaching a sample project where you can see go to definition working for JS files, please try it on thesome()
function in src/main.js let me know if it works fine for you.
Also note that due the possibility of function and variable collision, jump to definition currently works on JS files that are in the same directory.Cheers,
SalAttachments:
You must be logged in to view attached files.
raphiParticipantHi Sal,
I tried the go to definition on your project like you described it… It doesn’t work :/
Okay that’s bad cause it worked before also with functions in other projects. I don’t need that it looks up functions in every project (cause that will give collisions -> I also saw that sometimes it went to a definition in another project and not the referenced). I just want that it works with referenced projects (like you see in the picture attached).
But as I can see now it looks like it doesn’t work at all. Neither for referenced projects nor in JS files in the same folder (like the project you sent to me).
Hopefully there will be a solution for this issue.
Thanks,
RaphiAttachments:
You must be logged in to view attached files.
support-swapnaModeratorRaphi,
To get the navigation working for JS files, you can create a file named jsconfig.json in the project’s root and paste the below content to the file :
{ "compilerOptions": { "target": "es6" }, "exclude": [ "node_modules" ] }
This should help fix the issue. You can give it a try on the sample project sent by Sal.
Please let us know how it works for you.
–Swapna
Genuitec Support
raphiParticipantHi,
with the jsconfig.json it works for js files in the same project (whole project) 🙂
Is there any possibility to get it working for js files in referenced projects like I described it before?
Or can I maybe define that too in the jsconfig.json file?I have a lot of functions in the webresources project, wich I use in different projects… That would be awesome!
Thanks,
Raphi
Salvador CabreraMemberHi raphi,
You can enable referencing to JS files in other projects by adding a “includes” property with glob patterns and listing the files that are meant to be taken into account.
Let’s say that i’m working 3 projects, cmwebjsa (my main project), cmwebjsb and cmwebjsc.
I can put a jsconfig.json file at the root of cmwebjsa with the following content in order to reference functions from cmwebjsb and cmwebjsc as well.{ "compilerOptions": { "target": "es6" }, "exclude": [ "node_modules" ], "include": [ "src/**/*.js", // Required in order to work with the js files of cmwebjsa (tweak as needed) "../cmwebjsb/src/**/*.js", "../cmwebjsc/src/**/*.js" ] }
I’m attaching an example project which you can use to test.
Cheers,
Sal- This reply was modified 5 years, 5 months ago by Salvador Cabrera.
Attachments:
You must be logged in to view attached files.
raphiParticipantHi Sal,
thank you very much this works!
You guys are awesome 🙂Greets,
Raphi -
AuthorPosts