Comments (9)
@FezVrasta Thanks for your kind words and feedback. Also, sorry it took me so long to comment on this. I really need to figure out how to get notified when someone opens up an issue on one of my repositories.
To be honest, I'm not really sure how to fix this. The extension is really simple and works be looping over every line in the file and telling CodeMirror (which Brackets uses as the actual editor) to re-indent the line.
Because of this, the problem is I don't actually tell CodeMirror how to indent. That part is magic as far as the extension is concerned.
I'll research other means of indenting the document, though. Know of any good, open-source, Javascript parsers written in Javascript?
from brackets-indentator.
@FezVrasta Also, why does the .remove()
call get indented another level from everything else?
I haven't used jQuery extensively, but it seems like all of the chained function calls would be at the same level.
from brackets-indentator.
It's the syntax of jQuery, each time you select a different element you indent one tab. When you go back to the previous you remove one indent
from brackets-indentator.
$("<a/>") // <a/> is selected so indent the next command
.append("<span/>") // one element is appended to <a/> but we keep staying on <a/>
.find("span") // we move to the <span/> element so we indent the next command
.remove() // we remove the <span/> element but we are not leaving this element
.end() // we go back to the <a/> element so we remove one indentation
.remove(); // we remove the <a/> element so we stay on the same line.
from brackets-indentator.
Gotcha. I don't think I can get the syntax you want, because I don't want to put in a bunch of logic that is specific to jQuery.
I do agree, though, that all of the function calls should at least have one more level of indentation than the $("<a/>")
.
That would end up looking like this:
$("<a/>")
.append("<span/>")
.find("span")
.remove()
.end()
.remove();
As I said before, I'm not really sure how to fix this. I'm thinking we'll have to come up with a different way to indent the source than it does currently. I'm definitely open to suggestions on how to tackle this.
from brackets-indentator.
Just find the /(jQuery|$)(*.)/ regex (not tested) should be enough
from brackets-indentator.
It looks like this is a problem with text-editors in general. Codemirror doesn't recognize that the .whatever()
calls should be indented. The same thing happens in SublimeText 3.
If I type $("</a>")
into Brackets (or SublimeText) and hit enter, the next line is not indented another level. So if the editor doesn't recognize that subsequent lines should be indented, this extension won't be able to indent it that way, either.
The extension should indent code in exactly the same way the editor would in the first place, so we can't change how jQuery functions are indented.
I won't be able to fix this. Sorry.
from brackets-indentator.
from brackets-indentator.
AngularJS proposes a coding style which could possibly be easier to implement. How about that?
$someModule.
doStuff().
doMoreStuff();
from brackets-indentator.
Related Issues (18)
- Indenting documentation comment blocks HOT 3
- Not indented on paste when FuncDocr is installed
- Indentatator does not indent lines with leading `.` HOT 1
- Indenting YAML file destroys the structure
- Indenting TWIG file destroys the structure
- Indentation fails for PHP + HTML
- TypeScript
- Markup to disable indent on part of a document
- Switch case indentation issue
- Spaces insted of tab HOT 2
- No recognition for line breaks in HTML HOT 1
- wrong indent in new Brackets HOT 7
- Indent don't work correctly with last version HOT 6
- Bad indent of <!--[if lt IE 9]> HOT 2
- Bad Indent of Multiple CSS Lines HOT 3
- PHP indents to be aligned with PHP delimiters HOT 2
- Indent part of a document HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brackets-indentator.