Skip to content

Commit f3d74fe

Browse files
committed
Updates to keep the cursor stable
1 parent eae0e94 commit f3d74fe

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

PrettySwift for Xcode.xcodeproj/project.pbxproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
attributes = {
226226
BuildIndependentTargetsInParallel = 1;
227227
LastSwiftUpdateCheck = 1430;
228-
LastUpgradeCheck = 1510;
228+
LastUpgradeCheck = 1540;
229229
TargetAttributes = {
230230
F8B924C22A842E2200B60EA9 = {
231231
CreatedOnToolsVersion = 14.3.1;
@@ -451,7 +451,7 @@
451451
"$(inherited)",
452452
"@executable_path/../Frameworks",
453453
);
454-
MARKETING_VERSION = 1.1;
454+
MARKETING_VERSION = 1.2;
455455
PRODUCT_BUNDLE_IDENTIFIER = "com.tonycoco.PrettySwift.PrettySwift-for-Xcode";
456456
PRODUCT_NAME = "$(TARGET_NAME)";
457457
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -483,7 +483,7 @@
483483
"$(inherited)",
484484
"@executable_path/../Frameworks",
485485
);
486-
MARKETING_VERSION = 1.1;
486+
MARKETING_VERSION = 1.2;
487487
PRODUCT_BUNDLE_IDENTIFIER = "com.tonycoco.PrettySwift.PrettySwift-for-Xcode";
488488
PRODUCT_NAME = "$(TARGET_NAME)";
489489
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -511,7 +511,7 @@
511511
"@executable_path/../Frameworks",
512512
"@executable_path/../../../../Frameworks",
513513
);
514-
MARKETING_VERSION = 1.1;
514+
MARKETING_VERSION = 1.2;
515515
PRODUCT_BUNDLE_IDENTIFIER = "com.tonycoco.PrettySwift.PrettySwift-for-Xcode.PrettySwift";
516516
PRODUCT_NAME = "$(TARGET_NAME)";
517517
SKIP_INSTALL = YES;
@@ -540,7 +540,7 @@
540540
"@executable_path/../Frameworks",
541541
"@executable_path/../../../../Frameworks",
542542
);
543-
MARKETING_VERSION = 1.1;
543+
MARKETING_VERSION = 1.2;
544544
PRODUCT_BUNDLE_IDENTIFIER = "com.tonycoco.PrettySwift.PrettySwift-for-Xcode.PrettySwift";
545545
PRODUCT_NAME = "$(TARGET_NAME)";
546546
SKIP_INSTALL = YES;

PrettySwift for Xcode.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2+
"originHash" : "800eed666491e9f56691d6750418f6ae28a149641e18e7d862bed731314eb275",
23
"pins" : [
34
{
45
"identity" : "swift-argument-parser",
56
"kind" : "remoteSourceControl",
67
"location" : "https://github.com/apple/swift-argument-parser.git",
78
"state" : {
8-
"revision" : "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
9-
"version" : "1.2.2"
9+
"revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b",
10+
"version" : "1.4.0"
1011
}
1112
},
1213
{
@@ -32,19 +33,19 @@
3233
"kind" : "remoteSourceControl",
3334
"location" : "https://github.com/apple/swift-system.git",
3435
"state" : {
35-
"revision" : "836bc4557b74fe6d2660218d56e3ce96aff76574",
36-
"version" : "1.1.1"
36+
"revision" : "f9266c85189c2751589a50ea5aec72799797e471",
37+
"version" : "1.3.0"
3738
}
3839
},
3940
{
4041
"identity" : "swift-tools-support-core",
4142
"kind" : "remoteSourceControl",
4243
"location" : "https://github.com/apple/swift-tools-support-core.git",
4344
"state" : {
44-
"revision" : "93784c59434dbca8e8a9e4b700d0d6d94551da6a",
45-
"version" : "0.5.2"
45+
"revision" : "3b13e439a341bbbfe0f710c7d1be37221745ef1a",
46+
"version" : "0.6.1"
4647
}
4748
}
4849
],
49-
"version" : 2
50+
"version" : 3
5051
}

PrettySwift for Xcode.xcodeproj/xcuserdata/coconate.xcuserdatad/xcschemes/xcschememanagement.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<key>PrettySwift for Xcode.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>1</integer>
10+
<integer>0</integer>
1111
</dict>
1212
<key>PrettySwift.xcscheme_^#shared#^_</key>
1313
<dict>
1414
<key>orderHint</key>
15-
<integer>0</integer>
15+
<integer>1</integer>
1616
</dict>
1717
<key>Tools for plug-in “Format Source Code”.xcscheme</key>
1818
<dict>

PrettySwift/FormatCommand.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class FormatCommand: NSObject, XCSourceEditorCommand {
2323
let config = Configuration()
2424
let formatter = SwiftFormatter(configuration: config)
2525
var stream = PrettySwiftOutputStream()
26+
let originalSelections = invocation.buffer.selections as! [XCSourceTextRange]
2627

2728
do {
2829
try formatter.format(source: input, assumingFileURL: nil, to: &stream)
@@ -38,7 +39,10 @@ class FormatCommand: NSObject, XCSourceEditorCommand {
3839

3940
invocation.buffer.completeBuffer = output ?? input
4041

41-
// TODO: Reset cursor positon.
42+
invocation.buffer.selections.removeAllObjects()
43+
for selection in originalSelections {
44+
invocation.buffer.selections.add(selection)
45+
}
4246

4347
return completionHandler(nil)
4448
}

0 commit comments

Comments
 (0)