Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 492926

Summary: Warn when browser.json or other library isn't loaded in Tern (prev: No proposals found in simple HTML file)
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: curtis.windatt.public
Version: 12.0   
Target Milestone: 13.0   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Rennie CLA 2016-05-03 14:56:27 EDT
Consider the following snippet:

<!DOCTYPE html>
	<head>
		<script language="javascript">
			function f() {
				document.
			};
		</script>
	</head>
<html>
</html>


you get no proposals for document. 

At first I figured this was due to the missing eslint-env directive, but some debugging revealed its not (we are correctly auto-assuming the browser env).
Comment 1 Curtis Windatt CLA 2016-05-03 15:05:14 EDT
This is working for me in both my host and my target up to date with master.  ESLint does give me an annotation for document not being defined because no eslint-env is set.
Comment 2 Michael Rennie CLA 2016-05-03 15:20:32 EDT
The problem is because I have a .tern-project file that does not load the 'browser.json' definition.

We should have a linting rule (or update an existing rule) to check for not- started definitions - or just have one that specifically check for the browser.json / HTML case
Comment 3 Curtis Windatt CLA 2016-06-06 14:34:49 EDT
Just ran into this.  We don't warn about it for the eslint env directive or for usage of types from browser.
Comment 4 Curtis Windatt CLA 2016-07-13 15:58:52 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=ac424b50831814c2d8f23c1c68609ac4222035ea
Fixed in master

New subtype of check-tern-plugin problem.  Has it's own message and quickfix and tests.

Right now there aren't many 'known' libraries (ecma*, browser, chai).

This works for the default browser env set for HTML files.  However, I did have to modify the annotations to include the plugin/lib name because the quickfix can't extract the name from the source when there isn't any.
Comment 5 Curtis Windatt CLA 2016-07-13 16:00:01 EDT
*** Bug 494582 has been marked as a duplicate of this bug. ***