Skip to content

Commit 7b9b9fe

Browse files
committed
Merge tag '0.8.1' into develop
2 parents f2671b4 + d849234 commit 7b9b9fe

6 files changed

Lines changed: 44 additions & 38 deletions

File tree

Core/Sources/Environment/Environment.swift

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,44 @@ public enum Environment {
4040
}
4141
}
4242

43+
#warning("""
44+
The current version causes an issue in real-time suggestion that when completion panel is own,
45+
the command handler can not find the correct workspace, so we are not using it for now.
46+
""")
4347
public static var fetchCurrentProjectRootURL: (_ fileURL: URL?) async throws
4448
-> URL? = { fileURL in
45-
let appleScript = """
46-
tell application "Xcode"
47-
return path of document of the first window
48-
end tell
49-
"""
50-
51-
let path = (try? await runAppleScript(appleScript)) ?? ""
52-
if !path.isEmpty {
53-
let trimmedNewLine = path.trimmingCharacters(in: .newlines)
54-
var url = URL(fileURLWithPath: trimmedNewLine)
55-
while !FileManager.default.fileIsDirectory(atPath: url.path) ||
56-
!url.pathExtension.isEmpty
57-
{
58-
url = url.deletingLastPathComponent()
59-
}
60-
return url
61-
}
62-
63-
guard var currentURL = fileURL else { return nil }
64-
var firstDirectoryURL: URL?
65-
while currentURL.pathComponents.count > 1 {
66-
defer { currentURL.deleteLastPathComponent() }
67-
guard FileManager.default.fileIsDirectory(atPath: currentURL.path) else { continue }
68-
if firstDirectoryURL == nil { firstDirectoryURL = currentURL }
69-
let gitURL = currentURL.appendingPathComponent(".git")
70-
if FileManager.default.fileIsDirectory(atPath: gitURL.path) {
71-
return currentURL
72-
}
73-
}
74-
75-
return firstDirectoryURL ?? fileURL
49+
return URL(fileURLWithPath: "/")
50+
// let appleScript = """
51+
// tell application "Xcode"
52+
// return path of document of the first window
53+
// end tell
54+
// """
55+
//
56+
// let path = (try? await runAppleScript(appleScript)) ?? ""
57+
// if !path.isEmpty {
58+
// let trimmedNewLine = path.trimmingCharacters(in: .newlines)
59+
// var url = URL(fileURLWithPath: trimmedNewLine)
60+
// while !FileManager.default.fileIsDirectory(atPath: url.path) ||
61+
// !url.pathExtension.isEmpty
62+
// {
63+
// url = url.deletingLastPathComponent()
64+
// }
65+
// return url
66+
// }
67+
//
68+
// guard var currentURL = fileURL else { return nil }
69+
// var firstDirectoryURL: URL?
70+
// while currentURL.pathComponents.count > 1 {
71+
// defer { currentURL.deleteLastPathComponent() }
72+
// guard FileManager.default.fileIsDirectory(atPath: currentURL.path) else { continue }
73+
// if firstDirectoryURL == nil { firstDirectoryURL = currentURL }
74+
// let gitURL = currentURL.appendingPathComponent(".git")
75+
// if FileManager.default.fileIsDirectory(atPath: gitURL.path) {
76+
// return currentURL
77+
// }
78+
// }
79+
//
80+
// return firstDirectoryURL ?? fileURL
7681
}
7782

7883
public static var fetchCurrentFileURL: () async throws -> URL = {

Core/Sources/Service/Workspace.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ extension Workspace {
138138
)
139139

140140
filespace.suggestions = completions
141+
filespace.suggestionIndex = 0
141142

142143
return completions
143144
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ Then set it up with the following steps:
6767

6868
The first time the app is open and command run, the extension will ask for the necessary permissions. (except Input Monitoring, you have to enable it manually)
6969

70-
Alternatively, you may manually grant the required permissions by navigating to the `Privacy & Security` tab in the `System Settings.app`. Please note that different permissions must be assigned to different apps.
70+
Alternatively, you may manually grant the required permissions by navigating to the `Privacy & Security` tab in the `System Settings.app`.
7171

7272
- To grant permissions for the Accessibility API, click `Accessibility`, and drag `CopilotForXcodeExtensionService.app` to the list. You can locate the extension app by clicking `Reveal Extension App in Finder` in the host app.
7373

74-
![Accessibility API](/accessibility_api_permision.png)
74+
<img alt="Accessibility API" src="/accessibility_api_permission.png" width="500px">
7575

76-
- To enable Input Monitoring (for real-time suggestions cancellation by pressing esc, arrow keys or clicking the mouse), click `Input Monitoring`, and add `Copilot for Xcode.app` to the list.
76+
- To enable Input Monitoring (for real-time suggestions cancellation by pressing esc, arrow keys or clicking the mouse), click `Input Monitoring`, and drag `CopilotForXcodeExtensionService.app` to the list. You can locate the extension app by clicking `Reveal Extension App in Finder` in the host app.
7777

78-
![Input Monitoring](/input_monitoring_permission.png)
78+
<img alt="Input Monitoring" src="/input_monitoring_permission.png" width="500px">
7979

8080
If you encounter an alert requesting permission that you have previously granted, please remove the permission from the list and add it again to re-grant the necessary permissions.
8181

@@ -95,7 +95,7 @@ brew upgrade --cask copilot-for-xcode
9595

9696
Alternatively, You can download the latest version manually from the latest [release](https://github.com/intitni/CopilotForXcode/releases).
9797

98-
If you are upgrading from a version lower than **0.8.0**, please run `Copilot for Xcode.app` at least once to let it set up the new launch agent for you and re-grant the permissions according to the new rules.
98+
If you are upgrading from a version lower than **0.7.0**, please run `Copilot for Xcode.app` at least once to let it set up the new launch agent for you and re-grant the permissions according to the new rules.
9999

100100
If you want to keep track of the new releases, you can watch the releases of this repo to get notifications about updates.
101101

Version.xcconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
APP_VERSION = 0.8.0
2-
APP_BUILD = 40
1+
APP_VERSION = 0.8.1
2+
APP_BUILD = 41

input_monitoring_permission.png

2.73 KB
Loading

0 commit comments

Comments
 (0)