Comments (3)
I have an example of some multi-line expressions that took a bit of work to format. Here's about what I would like:
let simple = Add(
left: Number(1),
right: Number(2)
)
let complex = Multiply(
left: Add(
left: Number(1),
right: Number(2)
),
right: Number(3)
)
But this is what you currently get:
let expression = Add(
// this level of indent is kind of ok
left: Number(1),
right: Number(2)
)
// <= but it would be nice for this to be back here
// <= indent should be reset back to the previous statement
// but is instead here, and we keep getting deeper!
let complex = Multiply(
left: Add(
left: Number(1),
right: Number(2)
),
right: Number(3)
)
Actually, here's the same thing in Ruby:
simple = Add.new(
Number.new(1),
Number.new(2)
)
complex = Multiply.new(
Number.new(1),
Add.new(
Number.new(2),
Number.new(3)
)
)
Which is probably a much more sane approach:
let simple = Add(
Number(1),
Number(2)
)
let complex = Multiply(
left: Number(1),
right: Add(
left: Number(2),
right: Number(3)
)
)
from swift.vim.
@sharplet this indentation around parens was actually intentional. Rather than aligning on colons like Objective-C this is setup to align on the opening paren similar to python. The second example is definitely an issue though. I'm definitely open to suggestions about this. Xcode currently indents this like this:
let bar = Add(
left: 5,
right: 6
)
from swift.vim.
@supermarin @sharplet if both of you could try the branch from this PR #30 that would be great. It entirely changes indentation. It is not currently handling the parens example any differently, but it should fix the other examples.
from swift.vim.
Related Issues (20)
- ctags config errors HOT 1
- Number ranges aren't displaying properly HOT 2
- Multi line comment continuation is broken HOT 4
- Add @escaping
- where closure is not indenting correctly
- Use tabs for indentation, only in Swift HOT 1
- Multi-line String Literals Aren't Correctly Highlighted HOT 2
- Included ALE linters breaks `swiftlint` with ALE HOT 4
- Highlighting issue when escaping triple quotation marks
- Indent issue
- Incorrect indent after line
- Documentation: PlugInstall HOT 1
- Use swift's language server HOT 1
- Fix triple slash continuations
- Is there a way to get syntax checker working outside of a package? HOT 12
- Add Code Folding Support HOT 3
- swiftAttributes detected incorrectly.
- Indentation for nested switch/case and for cases with code on the same line is incorrect. HOT 1
- Can we PR indent/swift.vim to vim/vim HOT 1
- Indentation for SwiftUI modifiers is incorrect HOT 1
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 swift.vim.