This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 490332 - [tern] What to do if user adds eslint-env entry for library not available in Tern due to .tern-project file
Summary: [tern] What to do if user adds eslint-env entry for library not available in ...
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 12.0   Edit
Hardware: PC Windows 7
: P2 enhancement (vote)
Target Milestone: 12.0   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 490182
Blocks:
  Show dependency tree
 
Reported: 2016-03-23 15:18 EDT by Curtis Windatt CLA
Modified: 2016-03-30 16:02 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2016-03-23 15:18:42 EDT
1) Create a .tern-project file
2) Add 'plugins: { 'mongodb': [] }' entry to it
3) Create a new JS file in the same project
4) Add '/*eslint-env node, express*/ exp' to the JS file
5) Activate content assist on 'exp'
Result:
No assist proposals from the express plugin.

This will work if you have no .tern-project file or a missing or empty plugin entry in it.  By specifying 'mongodb' you tell Tern to only start the mongodb plugin.

Long term we will support dynamically loading library indexes, but until we have that workflow available, we need some way of informing the user why the tooling doesn't work in their express app.
Comment 1 Curtis Windatt CLA 2016-03-23 15:20:37 EDT
For now my suggestion is a warning annotation on the file explaining that they are trying to use a library that is disabled in their .tern-project file.
Comment 2 Steve Northover CLA 2016-03-23 15:26:28 EDT
Sound fine.  Make sure the guy has enough information to know what to do in the error message (ie. add it to the TPF).  I suppose an insane idea is a quick fix.

Let's start with the warning.
Comment 3 Steve Northover CLA 2016-03-23 15:26:52 EDT
He has to know that code assist won't work for him etc.
Comment 4 Michael Rennie CLA 2016-03-24 11:24:41 EDT
(In reply to Steve Northover from comment #2)
> I suppose an insane idea is a quick fix.

Quick fix would be pretty easy for this particular case - we know the lib they specified and we know we can load it, so the fix would be to update the TPF and issue a restart.

Since bug 485219 is geared towards the general fix for handling unknown libs / requires, we should make sure to focus this bug only on the case when the user has entered a library name that is one of the Tern built-ins that is not currently available in the running server.
Comment 5 Michael Rennie CLA 2016-03-24 11:26:33 EDT
An example of a fix that updates the TPF can be seen in quickFixes.js in the "check-tern-project" function.
Comment 6 Steve Northover CLA 2016-03-24 13:57:42 EDT
Let's do the quickfix and move on.  That way we have a consistent story that point people toward the .tern-project file when they are smart people that care about the contents of the file (and care that is should be honored or not).
Comment 7 Curtis Windatt CLA 2016-03-30 12:41:11 EDT
What do you think of the following text for the annotation:
To get tooling for the 'pg' environment, the 'postgres' plugin must be started. 'postgres' has not been set in the 'plugins' entry of your .tern-project file.
To get tooling for the 'node' environment, the 'node' plugin must be started. 'node' has not been set in the 'plugins' entry of your .tern-project file.
Comment 8 Steve Northover CLA 2016-03-30 13:09:09 EDT
"to get support for" instead of talking about tooling.  Seems fine otherwise.
Comment 9 Curtis Windatt CLA 2016-03-30 13:19:06 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=6b940b3d38555d7bae4eae3702f49a18f8e07c8d
New rule + tests

Please take a look and let me know what you think of the message/setting text.  I will update the wiki once we are happy with it.
Comment 10 Steve Northover CLA 2016-03-30 15:51:59 EDT
I won't get to this until next week.  Go ahead and close the bug and we can tweak and/or reopen if necessary.