| Summary: | [cross file linting] Ordering problem (must click on calling html file to get rid of errors even when tern file present) | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Steve Northover <steve_northover> | ||||||||
| Component: | JS Tools | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | major | ||||||||||
| Priority: | P3 | CC: | libingw, Michael_Rennie, Olivier_Thomann | ||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | 12.0 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows 7 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 259962 [details]
Proposed patch
I found a problem with the way the refs are searched inside the unused-var rule.
This patch should fix it.
Steve, I delivered the patch to master. Please try again and let me know if what you saw is fixed. I tried on my side and it seems to behave well now. I just performed the exact steps and see the exact same error. I am running in beta3. I doubt that the changes I delivered on Friday are on beta3. I tried on beta3 and I could reproduce your failures. I was about to try again on orion.eclipse.org in selg-hosting, but it seems to be down at the moment. I cannot reproduce the problem on orion.eclipse.org in self-hosting. Beta3 and orion.eclipse.org should be equivalent. Both are continuous delivery environments. Libing, are we still building continuously on beta3? Ok, this seems that it has nothing to do with cross file linting. It looks like the tern server is started twice between steps (3) and (4). After the second restart it looks like everything is fine. There is no need to do (6) to get rid of the errors. I followed the steps and still see the problem. If you are still seeing it, then that's good because we don't have a mystery. Should Mike look at this or do you know the next steps? I said the problem occurs in orion.eclipse.org. But there is no need to do step (6). It looks like the tern server is restarted twice. I have no explanation so far why this occurs. I'll see with Michael if we can get an explanation. I don't get that behavior when debugging the same test case in self-hosting. Right it looks the problem only occurs when the opened file in the editor is the .tern-project file. When the errors show up in main.js, reloading the page gets rid of them. Ok, after more debugging, I think this is what happens: 1) Because the project has a .tern-project file, we send a start_server request in the ternProjectManager.js before we process all the loadEagerly files through addFile requests. 2) Sometimes before the addFile requests are started, we get a lint request that will use the tern server state without any of the loadEagerly files being loaded. That request completes and returns the boggus errors. 3) The loadEagerly files are processed and all addFile requests are done (causing some read request because the index.html file contains links to other files). Now the tern server is properly initialized and this explains why touching the file (main.js) will remove the boggus errors. The new lint request that is triggered when the file is touched will use the right tern server state. One way to fix this would be to add a new server state that makes sure any requests that are started before the addFile requests are done for the loadEagerly files are properly queued and run only once all files are loaded. Created attachment 260016 [details]
another patch
Here is a proposed fix that shuffles around the addFile calls and makes sure we are done loading files before we send the message to notify that the server has been started (it is based on Olivier's previous work)
New steps that are still causing issues:
1) get minesweeper-objects
2) make sure there is no .tern-project file.
3) open javascript/js/main.js and you can see errors about Counter not being defined.
4) add a .tern-project file with the following contents
{
"plugins": {},
"libs": ["ecma5"],
"ecmaVersion": 5,
"dependencyBudget": 20000,
"loadEagerly": [
"public/index.html"
]
}
5) go back to main.js
6) errors for Counter still show up. They should be gone.
7) If you edit the file, then the errors go away.
It looks like the lint request on step (5) is sent before we reset the tern server based on the new .tern-project contents.
Created attachment 260025 [details]
Proposed patch
New patch that includes changes from the two previous patches.
All tests are green with the latest patch. Fix delivered to master. |
1) get minesweeper-objects 2) use the following .tern-project file { "plugins": {}, "libs": ["ecma5"], "ecmaVersion": 5, "dependencyBudget": 20000, "loadEagerly": [ "public/index.html" ] } 3) refresh browser 4) click on main.js 5) BUG: "new Counter" etc. shows errors 6) click on index.html 7) click on main.js 8) the errors are gone It seems that the tern file is not being processed and ordering is burning me?