Closed Bug 906632 Opened 11 years ago Closed 10 years ago

Indentation is inconsistent between jsb and Scratchpad

Categories

(DevTools Graveyard :: Graphic Commandline and Toolbar, enhancement)

26 Branch
x86_64
Windows 8
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 33

People

(Reporter: eldmannen+mozilla, Assigned: aryx)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20130818030219

Steps to reproduce:

Used tab in Scratchpad (Shift-F4)
Used jsb (JavaScript beautifier) (Shift+F2)


Actual results:

Scratchpad indented with 4 spaces.
jsb intended with 2 spaces.


Expected results:

Scratchpad and jsb should use same indention.
Component: Untriaged → Developer Tools: Scratchpad
Severity: normal → enhancement
This issue actually belongs in gcli. The Scratchpad's pretty printer and the source editor both use the "devtools.editor.tabsize" pref to determine the indentation (which defaults to 4), where the jsb command uses a hardcoded 2.
Status: UNCONFIRMED → NEW
Component: Developer Tools: Scratchpad → Developer Tools: Graphic Commandline and Toolbar
Ever confirmed: true
Attached patch patch, v1 (obsolete) — Splinter Review
This patch makes jsb use devtools.editor.tabsize. The value has been lowered to 2 on trunk. With the patch applied, changes to the indent size require a restart. Is it possible to make this restartless with the current command structure?
Attachment #8435214 - Flags: review?(mratcliffe)
Attachment #8435214 - Flags: review?(mratcliffe) → review+
(In reply to Archaeopteryx [:aryx] from comment #2)
> Created attachment 8435214 [details] [diff] [review]
> patch, v1
> 
> This patch makes jsb use devtools.editor.tabsize. The value has been lowered
> to 2 on trunk. With the patch applied, changes to the indent size require a
> restart. Is it possible to make this restartless with the current command
> structure?

Out of cursioity, what was the rationale behind lowering the value from 4 to 2?
Or was it dice roll? :p
Assignee: nobody → archaeopteryx
Attachment #8435214 - Attachment is obsolete: true
Status: NEW → ASSIGNED
(In reply to Eldmannen from comment #3)
> (In reply to Archaeopteryx [:aryx] from comment #2)
> > Created attachment 8435214 [details] [diff] [review]
> > patch, v1
> > 
> > This patch makes jsb use devtools.editor.tabsize. The value has been lowered
> > to 2 on trunk. With the patch applied, changes to the indent size require a
> > restart. Is it possible to make this restartless with the current command
> > structure?
> 
> Out of cursioity, what was the rationale behind lowering the value from 4 to
> 2?
> Or was it dice roll? :p

There are at least two coding style guides:

https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style
and
https://github.com/mozilla/addon-sdk/wiki/Coding-style-guide

Both state 2 space indentation.

Both also prefer double-quotes for strings.

Scratchpad [ Pretty Print ] however standardizes on single-quotes.

I guess it makes sense when building a lot of verbatim HTML with attributes inside of JavaScript code.
We're talking about formatting code for the world in general. These choices reflect a quick and dirty study we did to see what the most common choices were.
(In reply to Joe Walker [:jwalker] from comment #7)
> We're talking about formatting code for the world in general. These choices
> reflect a quick and dirty study we did to see what the most common choices
> were.

Which choices, the 2 space indentation in jsb?
https://hg.mozilla.org/mozilla-central/rev/929a6d94fa24
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 33
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: