Closed
Bug 988155
Opened 11 years ago
Closed 11 years ago
Option to detect indentation in source editor
Categories
(DevTools :: Source Editor, defect)
DevTools
Source Editor
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 31
People
(Reporter: harth, Assigned: harth)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
Details | Diff | Splinter Review |
Our source editor has default 4 space indentation, and no easy way to change this. I usually do 2 spaces depending on the code base. It would be nice to detect the indentation per file.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → fayearthur
Updated•11 years ago
|
Blocks: expose-editor-prefs
Assignee | ||
Comment 1•11 years ago
|
||
This patch adds a default-on pref. When the pref is on, the devtools editor will detect the indentation (2-space, 4-space, tabs, etc.) of a file when it's loaded or when the the text is reset, and set the indentation preference of the editor to that.
Attachment #8402947 -
Flags: review?(mihai.sucan)
Assignee | ||
Comment 2•11 years ago
|
||
The test there is basic, but I did test the indentation detection algorithm a lot. The algorithm there is one I came up with, but I tried it and two other algorithms on 300 random JS/CSS/HTML gist files and it correctly detected the indentation in 96% of the files. Good enough I think.
Comment 3•11 years ago
|
||
Comment on attachment 8402947 [details] [diff] [review]
Detect indention pref, default on
Review of attachment 8402947 [details] [diff] [review]:
-----------------------------------------------------------------
Patch looks good and I'm liking indentation detection. This was bothering me. Thanks for the fix!
::: browser/devtools/sourceeditor/editor.js
@@ +947,5 @@
> /**
> + * A PreferenceObserver observes a pref branch for pref changes.
> + * It emits an event for each preference change.
> + */
> +function PrefObserver(branchName) {
Why not use the same PrefObserver from styleeditor/utils ? Maybe move it to DevToolsUtils.js.
::: browser/devtools/sourceeditor/test/browser.ini
@@ +34,1 @@
> skip-if = os == 'linux'&&debug # bug 981707
skip-if applies to vimemacs test, so please add the new detectindent script after skip-if.
Attachment #8402947 -
Flags: review?(mihai.sucan) → review+
Assignee | ||
Comment 4•11 years ago
|
||
Thanks Mihai. Try: https://tbpl.mozilla.org/?tree=Try&rev=b03daa9a9289
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Heather Arthur [:harth] from comment #4)
> Thanks Mihai. Try: https://tbpl.mozilla.org/?tree=Try&rev=b03daa9a9289
...That didn't go so well. Trying again? https://tbpl.mozilla.org/?tree=Try&rev=148449bab14d
Assignee | ||
Comment 6•11 years ago
|
||
(In reply to Heather Arthur [:harth] from comment #5)
> (In reply to Heather Arthur [:harth] from comment #4)
> > Thanks Mihai. Try: https://tbpl.mozilla.org/?tree=Try&rev=b03daa9a9289
>
> ...That didn't go so well. Trying again?
> https://tbpl.mozilla.org/?tree=Try&rev=148449bab14d
Okay that also didn't go so well either. All the bc failures are due to crashes. I'm going to look for more memory leaks.
Assignee | ||
Comment 7•11 years ago
|
||
Pref listeners were causing memory leaks, so I took them out, to be figured out in a follow up bug. try without them: https://tbpl.mozilla.org/?tree=Try&rev=ea21b90e4c6a
Attachment #8402947 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 9•11 years ago
|
||
Comment 10•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 31
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•