Skip to content

Commit

Permalink
Merge pull request #78 from michaelnew/master
Browse files Browse the repository at this point in the history
Thanks for the work on this!
  • Loading branch information
terhechte authored Jul 23, 2021
2 parents 82e8020 + bc85535 commit 6a1751f
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 44 deletions.
64 changes: 41 additions & 23 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,100 @@
{
"package": "Commandant",
"repositoryURL": "https://github.com/Carthage/Commandant.git",
"state": {
"branch": "master",
"revision": "ab68611013dec67413628ac87c1f29e8427bc8e4",
"version": null
}
},
{
"package": "CwlCatchException",
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git",
"state": {
"branch": null,
"revision": "07cad52573bad19d95844035bf0b25acddf6b0f6",
"version": "0.15.0"
"revision": "7cd2f8cacc4d22f21bc0b2309c3b18acf7957b66",
"version": "1.2.0"
}
},
{
"package": "CwlPreconditionTesting",
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state": {
"branch": null,
"revision": "c228db5d2ad1b01ebc84435e823e6cca4e3db98b",
"version": "1.2.0"
}
},
{
"package": "Embassy",
"repositoryURL": "https://github.com/envoy/Embassy.git",
"state": {
"branch": null,
"revision": "43d52f80e79b84eaa7e238d942be59e86db156a6",
"version": "4.0.8"
"branch": "master",
"revision": "189436100c00efbf5fb2653fe7972a9371db0a91",
"version": null
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble.git",
"state": {
"branch": null,
"revision": "cd6dfb86f496fcd96ce0bc6da962cd936bf41903",
"version": "7.3.1"
"revision": "b02b00b30b6353632aa4a5fb6124f8147f7140c0",
"version": "8.0.5"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "5fbf13871d185526993130c3a1fad0b70bfe37ce",
"version": "1.3.2"
"revision": "33682c2f6230c60614861dfc61df267e11a1602f",
"version": "2.2.0"
}
},
{
"package": "Result",
"repositoryURL": "https://github.com/antitypical/Result.git",
"state": {
"branch": null,
"revision": "8fc088dcf72802801efeecba76ea8fb041fb773d",
"version": "4.0.0"
"branch": "master",
"revision": "c30700bfcab7f555bf1d386fdd609407a94f369c",
"version": null
}
},
{
"package": "SourceKitten",
"repositoryURL": "https://github.com/jpsim/SourceKitten.git",
"state": {
"branch": null,
"revision": "4be914be6fa49cd30b1e7ef5d32d06c037d8f469",
"version": "0.21.2"
"branch": "master",
"revision": "1c54dce13d05c6f3b442b904e14d9df9393e80ec",
"version": null
}
},
{
"package": "SWXMLHash",
"repositoryURL": "https://github.com/drmohundro/SWXMLHash.git",
"state": {
"branch": null,
"revision": "0ce63a93a455adb3cd5e4c55f78f1232a590a5a5",
"version": "4.7.2"
"revision": "a4931e5c3bafbedeb1601d3bb76bbe835c6d475a",
"version": "5.0.1"
}
},
{
"package": "XcodeEdit",
"repositoryURL": "https://github.com/felix91gr/XcodeEdit.git",
"repositoryURL": "https://github.com/tomlokhorst/XcodeEdit",
"state": {
"branch": null,
"revision": "cf8e15a35ec5bfa350bf3bb96ebebe733123c4f2",
"version": "1.1.3"
"branch": "develop",
"revision": "70e4f0e3ad5f5de5360ed865e7b7e32a7a042f83",
"version": null
}
},
{
"package": "Yams",
"repositoryURL": "https://github.com/jpsim/Yams.git",
"state": {
"branch": null,
"revision": "26ab35f50ea891e8edefcc9d975db2f6b67e1d68",
"version": "1.0.1"
"revision": "c947a306d2e80ecb2c0859047b35c73b8e1ca27f",
"version": "2.0.0"
}
}
]
Expand Down
27 changes: 16 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
// swift-tools-version:4.2

import PackageDescription

var package = Package(
name: "SourceKittenDaemon",

targets: [
Target(name: "SourceKittenDaemon"),
Target(name: "sourcekittend", dependencies: [.Target(name: "SourceKittenDaemon")])
],

dependencies: [
.Package(url: "https://github.com/Carthage/Commandant.git", versions: Version(0, 12, 0)..<Version(0, 15, .max)),
.Package(url: "https://github.com/jpsim/SourceKitten.git", majorVersion: 0, minor: 21),
.Package(url: "https://github.com/envoy/Embassy.git", majorVersion: 4),
.Package(url: "https://github.com/felix91gr/XcodeEdit.git", majorVersion: 1),
.package(url: "https://github.com/Carthage/Commandant.git", .branch("master")),
.package(url: "https://github.com/jpsim/SourceKitten.git", .branch("master")),
.package(url: "https://github.com/envoy/Embassy.git", .branch("master")),
.package(url: "https://github.com/tomlokhorst/XcodeEdit", .branch("develop")),
.package(url: "https://github.com/antitypical/Result.git", .branch("master"))

],

exclude: [
"Tests/SourceKittenDaemonTests/Fixtures/Sources"
targets: [
.target(
name: "SourceKittenDaemon",
dependencies: ["Commandant", "SourceKittenFramework", "XcodeEdit", "Embassy", "Result" ]
),
.target(
name: "sourcekittend",
dependencies: ["SourceKittenDaemon"])
]
)

Expand Down
4 changes: 2 additions & 2 deletions Sources/SourceKittenDaemon/Completer/Completer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class FileSystemEventsWrapper {

FSEventStreamScheduleWithRunLoop(eventStream,
runLoop.getCFRunLoop(),
RunLoopMode.defaultRunLoopMode as CFString)
RunLoop.Mode.default as CFString)

FSEventStreamStart(eventStream)
}
Expand Down Expand Up @@ -146,7 +146,7 @@ class Completer {
let request = Request.codeCompletionRequest(
file: path,
contents: contents,
offset: Int64(offset),
offset: ByteCount(offset),
arguments: compilerArgs)

do {
Expand Down
14 changes: 7 additions & 7 deletions Sources/SourceKittenDaemon/Project/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class Project {
}

var sourceObjects: [ProjectObject] {
guard let phase = pbxTarget.buildPhases.filter({ ($0 as? PBXSourcesBuildPhase) != nil }).first
guard let phase = pbxTarget.buildPhases.filter({ ($0.value as? PBXSourcesBuildPhase) != nil }).first
else { return [] }
return objects.filter { $0.buildPhase.id == phase.id }
}
Expand All @@ -104,23 +104,23 @@ public class Project {

fileprivate lazy var pbxTarget: PBXNativeTarget = {
return self.xcProjectFile.project.targets
.filter({$0.name == self.target }).first!
.filter({$0.value?.name == self.target }).first!.value! as! PBXNativeTarget
}()

fileprivate lazy var objects: [ProjectObject] = {
return self.pbxTarget.buildPhases.reduce([], { (a, phase) -> [ProjectObject] in
return a + phase.files
return a + phase.value!.files
.map({ (file) -> ProjectObject? in
if let fileRef = file.fileRef,
let type = fileRef.string("lastKnownFileType"),
if let fileRef = file.value?.fileRef?.value as? PBXFileReference,
let type = fileRef.lastKnownFileType,
let sourceType = ProjectObjectSourceType(rawValue: type),
let path = fileRef.path,
let name = path.components(separatedBy: "/").last,
let relativePath = self.xcProjectFile.project.allObjects.FullFilePaths[fileRef.id] {
let relativePath = fileRef.fullPath {
return ProjectObject(type: sourceType,
name: name,
relativePath: relativePath,
buildPhase: phase)
buildPhase: phase.value!)
} else {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/sourcekittend/StartCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct StartCommand: CommandProtocol {
do {
let server = try CompletionServer(project: project, port: options.port)
try server.start()
return .success()
return .success(())
} catch let error {
return Result.failure(CommandError.other(error))
}
Expand Down

0 comments on commit 6a1751f

Please sign in to comment.