[swift-dev] Support for per-project code styles in SourceKit

2017-01-17 Thread Daniel Martín via swift-dev

Hi, all:

I've been planning the implementation of per-project code style support 
for Swift. Hopefully, if implemented correctly, this tweet would not be 
true anymore: https://twitter.com/CodaFi_/status/821142027077238784


As I understand it, right now we have two possible kind of clients for 
formatting Swift code (both are exercising code inside the swiftIDE 
library):


- Xcode: IDELanguageSupportUI, which is a plugin installed by default 
with Xcode, is responsible for sending a message to SourceKit with the 
"format.usetabs", "format.indentwidth", "format.tabwidth" parameters, 
among others. SwiftIDE simply formats the region and updates the buffer. 
I suppose other third party editors also use this mechanism.


- Swift-format: This little internal tool only uses a single function 
from Formatting.cpp, passing the desired format options as a parameter.


In order to support different code styles per project, we need to make, 
at least, the following changes:


- Create some factory methods for the CodeFormatOptions struct, one for 
each supported style (initially, only "Default", or "Apple", ie. no 
tabs, 4 spaces, no case label indentation in switch statements).


- Add support for reading an optional .swift-format file inside the 
current directory. This file would be a simple YAML file with key-value 
pairs like this:


 .swift-format 

Style: Apple

IndentWidth: 2

Does it make sense? I'll try to maintain the same SourceKit interface so 
that Xcode and other editors don't break and at the same time it's easy 
for them to opt-in this feature.


Opinions?

Thanks,

Daniel Martín

___
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


[swift-dev] Differences between Xcode official toolchains and tagged releases from repository

2016-10-03 Thread Daniel Martín via swift-dev
Hello, all:
Is there any difference between the official toolchains included with Xcode and 
the tagged releases from the repository? Maybe the Xcode team is using some 
special flags for compilation or applying internal fixes? I ask this question 
because we're seeing some projects that compile fine with the official 
toolchain, but fail to do so with one downloaded from the repository, from the 
exact tagged version.
Before we investigate this further, is it possible to create an "official" 
Swift toolchain using the build scripts (for internal use, I assume we cannot 
upload to the Store with that toolchain)? Does the Xcode team generate the 
binaries from the repository tags?
Thanks,
Daniel Martín___
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


[swift-dev] Compile an old version of Swift from source

2016-09-08 Thread Daniel Martín via swift-dev
What's the easiest way to compile a 2.2.x version of Swift from source? 
AFAIK there's no clear way to know which ref you have to checkout from 
Swift dependency repos, like LLVM or Swift-Clang, because there's not a 
standard tag naming for release versions across repositories.


Thank you,
Daniel

___
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev