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

Bug 496437

Summary: Provide formatting support in the JS tools
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: curtis.windatt.public, Olivier_Thomann, snorthov
Version: 10.0   
Target Milestone: 13.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 423072    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch
none
Proposed patch
none
Proposed patch
none
Proposed patch none

Description Michael Rennie CLA 2016-06-20 17:12:28 EDT
Currently the only way to format your source code is to install the jsbeautifier plugin from https://github.com/orion-plugins/orion-plugins.github.io/tree/master/0.5/plugins/beautify or painfully copy the source to some other tool and back again.
Comment 1 Olivier Thomann CLA 2016-06-20 17:32:54 EDT
Should be pretty straightforward
Comment 2 Michael Rennie CLA 2016-06-20 17:38:47 EDT
CQ is here:

https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11623

We should also provide support for:

1. the jsbeautifyrc files 
2. pref pages
3. html and css formatting (both are also included in the js-beautify source

> Should be pretty straightforward

I agree - all of the versions of js-beautify are built with AMD support out of the box - so in theory we should not have to modify the code (fingers crossed!)
Comment 3 Olivier Thomann CLA 2016-06-24 13:08:11 EDT
Everything is ready to be delivered. Waiting after the CQ 11623 clearance.
Comment 4 Olivier Thomann CLA 2016-06-25 10:15:30 EDT
Delivered. Michael, please give it a try.
Comment 5 Michael Rennie CLA 2016-06-27 11:41:11 EDT
Reopening - the CQ is not approved.
Comment 6 Michael Rennie CLA 2016-06-27 11:47:46 EDT
Once bug 423072 is fixed we should move the formatting support for HTML and CSS out of the JS tools and into the webtools bundle
Comment 7 Michael Rennie CLA 2016-06-27 12:02:14 EDT
We also need to extend the JSON content type with 'jsbeautifyrc' (which is plan JSON content)
Comment 8 Michael Rennie CLA 2016-06-27 12:04:19 EDT
(In reply to Michael Rennie from comment #7)
> We also need to extend the JSON content type with 'jsbeautifyrc' (which is
> plan JSON content)

The banner message for overriding config files mentions Tern, when Tern has nothing to do with formatting:

"Warning: Global settings for tern are overriden by the settings defined in: .jsbeautifyrc"
Comment 9 Olivier Thomann CLA 2016-06-27 12:16:40 EDT
What comes after "for" is the project's name for which the settings are overriden. This is the same message we display for .eslintrc usage. What project were you in when you got this message ?
Comment 10 Olivier Thomann CLA 2016-06-27 12:34:42 EDT
Created attachment 262728 [details]
Proposed patch

Patch that fixes all issues reported so far.
Comment 11 Michael Rennie CLA 2016-06-27 14:03:58 EDT
(In reply to Olivier Thomann from comment #9)
> What comes after "for" is the project's name for which the settings are
> overriden. This is the same message we display for .eslintrc usage. What
> project were you in when you got this message ?

Ha! I didn't even realise I was in a project named 'tern', it makes sense / works.
Comment 12 Olivier Thomann CLA 2016-07-05 10:35:21 EDT
Created attachment 262921 [details]
Proposed patch
Comment 13 Olivier Thomann CLA 2016-07-05 10:53:00 EDT
Created attachment 262923 [details]
Proposed patch
Comment 14 Olivier Thomann CLA 2016-07-05 12:32:37 EDT
Created attachment 262926 [details]
Proposed patch
Comment 15 Olivier Thomann CLA 2016-07-05 12:34:09 EDT
Delivered.