@@ -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 complet ion 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 = {
0 commit comments