Community
Participate
Working Groups
1) Get the code from https://hub.jazz.net/git/snorthov/test 2) Click on javascript/test.js 3) BUG: main() is marked as unreferenced but it is referenced from main.html Likely a path is wrong in .tern-project. If I get rid of the "javascript" directory and put index.html and test.js in the same directory, it works.
Mike, can you take a look a this one? Thanks
> ... same directory, it works. Of course I need to edit all the paths in the various places, then refresh the page.
From a chat with Mike, he was seeing errors: Error: Cycle: undefined at Object.p.isExtensionOf (https://hub.jazz.net/code/edit/edit.js:5:22463) at https://hub.jazz.net/code/edit/edit.js:20:3865 at Array.some (native) at https://hub.jazz.net/code/edit/edit.js:20:3818 at Array.filter (native) at m.e.mixin.setContentType (https://hub.jazz.net/code/edit/edit.js:20:3726) at https://hub.jazz.net/code/edit/edit.js:19:31382 at https://hub.jazz.net/code/edit/edit.js:1:4505 at Array.forEach (native) at e.dispatchEvent (https://hub.jazz.net/code/edit/edit.js:1:4460) and after clear() and refresh, things worked for him. For me, I don't see the errors. I have not tried a clear() or anything.
Steve, it works for me out of the box. Went to the link you sent, did "Edit code" and then find references in the project and it worked. I got the reference inside index.html. No sure there is anothing I can do here if I cannot reproduce it.
It is possible that this never was supported although I could have sworn that it worked when I gave a tooling demo before Christmas. It was part of Curtis getting references etc. to work for the plain HTML case.
As far as I can say, the check for unused function (rule named "no-unused-vars") only considers what is defined within the current scope. See load-rules-async.js line 1305. In order to get what you want I think we would need to check if the function not found within the current scope is called from another project file. Michael, do you think this is something we can easily add to that rule? Since that rule is checked by default (warning level), this might be a costly check.
(In reply to Olivier Thomann from comment #6) > As far as I can say, the check for unused function (rule named > "no-unused-vars") only considers what is defined within the current scope. > See load-rules-async.js line 1305. > In order to get what you want I think we would need to check if the function > not found within the current scope is called from another project file. > > Michael, do you think this is something we can easily add to that rule? > Since that rule is checked by default (warning level), this might be a > costly check. We currently do not support cross-file linting (Its on the 11.0 plan). I recall Curtis investigating putting in a hack to silence the rule for HTML-context. The preferred way to denote something is global (defined elsewhere) is to use the globals directive like so: /* globals main */ If you are talking about main in the JS file knowing it is being used from the HTML file for linting, this does not work (and has never worked).
Ok, perhaps what I was seeing was a delay in the Tern loading and the warning going away temporarily? Let's mark this as a dup of the bug for cross file linting.
I seem to get comments doubled quite a bit in bugzilla. Anyway ...
Created attachment 259577 [details] Current draft
Created attachment 259605 [details] New patch Also handle the test case from bug 485693.
Created attachment 259606 [details] New patch Also handles test case from bug 485693.
Work for this is going on in a branch http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/?h=oliviert%2FBug486577_crossFileLint Olivier pushed the implementation there along with 2 rules. I've pushed an additional change with support for the no-undef rule and some tests.
New Gerrit change created: https://git.eclipse.org/r/67079
Gerrit change https://git.eclipse.org/r/67079 was merged to [master]. Commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=53f516d082710df643657dfa20b41ef607d4e604
Fixed. More performance work will be done in separate bug reports if necessary.