| Summary: | Computed environment causes unexpected behaviour when .tern-project file is present | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Michael Rennie <Michael_Rennie> |
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | curtis.windatt.public, pahnke.sebastian, steve_northover |
| Version: | 13.0 | Flags: | curtis.windatt.public:
review+
|
| Target Milestone: | 14.0 | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
First cut: If the person is smart enough to have a .tern-project file, we should use it first and then other indications in environment. We should NEVER create the .tern-project file for free. So, if they guy has no .tern-project, we assume browser and Node (and compute other things from the various files). Otherwise, we use .tern-project. Thoughts? (In reply to Steve Northover from comment #1) > First cut: If the person is smart enough to have a .tern-project file, we > should use it first and then other indications in environment. We should > NEVER create the .tern-project file for free. > > So, if they guy has no .tern-project, we assume browser and Node (and > compute other things from the various files). Otherwise, we use > .tern-project. > > Thoughts? Also: if they have a .tern-project, and a package.json file and have not added the node plugin, we should auto-add that. Yes, package.json implies Node. Sounds good to me. This way it's backward compatible and convenient for new users :) Pushed fix to: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=93b526124a20d2bef7498c338173c5f0ff255e97 Sebastian, Curtis, please review. In Orion it works now as expected, only completions for Big.js and ECMA5 are shown. In the CodeEditWidget I still get commonjs and node completions (bad), but the browser completions are now hidden (good). And by adding "browser" to "libs" I can enable them if I need (good). Maybe something to do with the in memory file system? (In reply to Sebastian Pahnke from comment #6) > In Orion it works now as expected, only completions for Big.js and ECMA5 are > shown. In the CodeEditWidget I still get commonjs and node completions > (bad), but the browser completions are now hidden (good). And by adding > "browser" to "libs" I can enable them if I need (good). Maybe something to > do with the in memory file system? I bet the code widget does not support the new fileClient API for getProject. Thanks for trying it Sebastian, I'll check the widget code now. (In reply to Michael Rennie from comment #7) > (In reply to Sebastian Pahnke from comment #6) > > In Orion it works now as expected, only completions for Big.js and ECMA5 are > > shown. In the CodeEditWidget I still get commonjs and node completions > > (bad), but the browser completions are now hidden (good). And by adding > > "browser" to "libs" I can enable them if I need (good). Maybe something to > > do with the in memory file system? > > I bet the code widget does not support the new fileClient API for > getProject. Thanks for trying it Sebastian, I'll check the widget code now. Yup, that was the problem. Added the support in: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=84ce231245e9e2b4bdf0b711919c011da24a60ff. Libing is double-checking the other support to load files in the widget, just to make sure everything is still working properly. I also added support for read-if-exists to the in-memory file client: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=b470861097f28d9039bac66fe51023ee580ab65c I just did a quick test and it seems to work now. Will test it more tomorrow. Thanks Michael, looking forward to using version 14! +1 for this change in 14.0, Sebastian please verify with your application. This works for me. (In reply to Sebastian Pahnke from comment #12) > This works for me. Thank you for verifying! Closing fixed. |
A report came in against the latest tooling in our mattermost channel: "Why do I get completions for commonjs, node and browser environments with the following .tern-project file? It happens in Orion and the CodeEditWidget. It's a rather new behavior which I don't expect. Instead I expect to get completions for ECMA5 and the additional Big.js library only. This is a breaking change for me. I only expect to see additional browser completion if I add "browser" to the libs list." The example .tern-project file used: { "plugins": {}, "libs": [".definitions/big"], "ecmaVersion": 5 } We should re-examine how all the computed information is merged together. Perhaps to maintain backwards compatibility with the idea that ".tern-project files drive project configuration", we should only use whats in the .tern-project iff: 1. there is a .tern-project file present 2. there is no package.json 3. there is no node_modules