Closed evgygor closed 5 years ago
So, yes, I definitely want to support your request. It just may take a while. A little background information: this project does not currently use a parser. It basically just scans for a few known keywords, and does some very basic formatting. Without an actual parser, formatting most things gets pretty complicated.
There is a great brightscript parser included in the brs project that this project will most likely use in the future, but that would require almost an entire rewrite of brightscript-formatter.
In the mean time, there are a few other things we could do hold us over. For example, we could find all space tokens that are not contained within strings, and replace them all with single space. i.e. replace SPACESPACESPACE with SPACE. That would fix your first if statement condition.
However, that would not satisfy your self.states
requirement. What programming languages have you worked on that supported formatting, yet preserved the spacing like in your self.states
example? Typescript, for example, will kill your perfect spacing in your example.
So, yes, I definitely want to support your request. It just may take a while. A little background information: this project does not currently use a parser. It basically just scans for a few known keywords, and does some very basic formatting. Without an actual parser, formatting most things gets pretty complicated.
There is a great brightscript parser included in the brs project that this project will most likely use in the future, but that would require almost an entire rewrite of brightscript-formatter.
In the mean time, there are a few other things we could do hold us over. For example, we could find all space tokens that are not contained within strings, and replace them all with single space. i.e. replace SPACESPACESPACE with SPACE. That would fix your first if statement condition.
However, that would not satisfy your
self.states
requirement. What programming languages have you worked on that supported formatting, yet preserved the spacing like in yourself.states
example? Typescript, for example, will kill your perfect spacing in your example.
Support this kind of the alignment related to the IDE, no a language. For example, Eclipse doesn't save the alignment like this for Java, but IntelliJ does. But this is nice to have, removing extra spaces from the code more important.
Support this kind of the alignment related to the IDE
This project (brightscript-formatter
) is a standalone tool written in nodejs. It has no access to IDEs at all.
removing extra spaces from the code more important.
I'll try to carve out some time to put the "remove duplicate spaces" feature in.
This was mostly implemented in release v1.6.0
Please add formatting for spaces between elements, actually remove extra spaces.
Example. The following code
should be formatted to
No spaces removal needed inside the strings.
Would be nice to have same formatting as in Typescript: 'a>b' formatted to 'a > b' 'foo ()' formatted to 'foo()'
Use same spacing rules from typescript. But save the following indentation too
Thanks