Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Suggestion feature is disabled for non-gitignored files. #400

Closed
2 tasks done
GeRryCh opened this issue Dec 4, 2023 · 13 comments
Closed
2 tasks done

[Bug]: Suggestion feature is disabled for non-gitignored files. #400

GeRryCh opened this issue Dec 4, 2023 · 13 comments
Assignees
Labels
bug Something isn't working released

Comments

@GeRryCh
Copy link

GeRryCh commented Dec 4, 2023

Before Reporting

  • I have checked FAQ, and there is no solution to my issue
  • I have searched the existing issues, and there is no existing issue for my issue

What happened?

After the upgrade to 0.28.0, I'm receiving a "suggestion feature is disabled" error for all my files across all projects. Dumping the prior version solved the issue.

How to reproduce the bug.

It just happens!

Relevant log output

No response

macOS version

13.5.2

Xcode version

15.0.1

Copilot for Xcode version

0.28.0

Node version

20.2.0

@GeRryCh GeRryCh added the bug Something isn't working label Dec 4, 2023
@WingCH
Copy link

WingCH commented Dec 4, 2023

same issue

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

Does it work if you turn on "Disable git ignore check" in the advanced settings?

@GeRryCh
Copy link
Author

GeRryCh commented Dec 4, 2023

Does it work if you turn on "Disable git ignore check" in the advanced settings?

Yes.

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

A new build is released that disable the check by default.

I am using this code to check if the file is ignored, I would be great if you can try it in a playground. Please let me know the output. Thanks.

If it throws, that means the file is not ignored.

let filePath = "/Users/intitni/developer/Projects/Copilot for Xcode/PLUS"
let projectPath = "/Users/intitni/developer/Projects/Copilot for Xcode"
let it = Process()
it.arguments = ["-i", "-c", "git check-ignore \"\(filePath)\""]
it.currentDirectoryURL = URL(fileURLWithPath: projectPath)
it.executableURL = .init(fileURLWithPath: "/bin/bash")
let outputPipe = Pipe()
it.standardOutput = outputPipe
it.standardError = outputPipe
it.terminationHandler = { _ in
    do {
        if let data = try outputPipe.fileHandleForReading.readToEnd(),
           let content = String(data: data, encoding: .utf8)
        {
            print("return", content)
        }
    } catch {
        print("throw", error)
    }
}
try it.run()

@GeRryCh
Copy link
Author

GeRryCh commented Dec 4, 2023

A new build is released that disable the check by default.

I am using this code to check if the file is ignored, I would be great if you can try it in a playground. Please let me know the output. Thanks.

If it throws, that means the file is not ignored.

let filePath = "/Users/intitni/developer/Projects/Copilot for Xcode/PLUS"
let projectPath = "/Users/intitni/developer/Projects/Copilot for Xcode"
let it = Process()
it.arguments = ["-i", "-c", "git check-ignore \"\(filePath)\""]
it.currentDirectoryURL = URL(fileURLWithPath: projectPath)
it.executableURL = .init(fileURLWithPath: "/bin/bash")
let outputPipe = Pipe()
it.standardOutput = outputPipe
it.standardError = outputPipe
it.terminationHandler = { _ in
    do {
        if let data = try outputPipe.fileHandleForReading.readToEnd(),
           let content = String(data: data, encoding: .utf8)
        {
            print("return", content)
        }
    } catch {
        print("throw", error)
    }
}
try it.run()

Sorry, but the termination handler is never gets called in my case:
image

@intitni intitni added the help wanted Extra attention is needed label Dec 4, 2023
@WingCH
Copy link

WingCH commented Dec 4, 2023

"Disable git ignore check" is work for me.

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

@GeRryCh How about removing "-i" from the argument list?

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

I think I was wrong about the return value...

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

Something in my configuration is making the task throws on my Mac which made me think that it should throw for not in gitignore. In fact it returns nothing. Which should be handled in the missing else case that the content can't be parsed.

let filePath = "/Users/intitni/developer/Projects/Copilot for Xcode/PLUS"
let projectPath = "/Users/intitni/developer/Projects/Copilot for Xcode"
let it = Process()
it.arguments = ["-c", "git check-ignore \"\(filePath)\""]
it.currentDirectoryURL = URL(fileURLWithPath: projectPath)
it.executableURL = .init(fileURLWithPath: "/bin/bash")
let outputPipe = Pipe()
it.standardOutput = outputPipe
it.standardError = outputPipe
it.terminationHandler = { _ in
    do {
        if let data = try outputPipe.fileHandleForReading.readToEnd(),
           let content = String(data: data, encoding: .utf8)
        {
            print("return", content)
        } else {
            print("not ignored")
        } 
    } catch {
        print("throw", error)
    }
}
try it.run()

@GeRryCh
Copy link
Author

GeRryCh commented Dec 4, 2023

@GeRryCh How about removing "-i" from the argument list?

Removing all arguments gives the error:
return /bin/bash: git check-ignore "<file-path>": No such file or directory although it exists.

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

@GeRryCh Please give this version a try https://github.com/intitni/CopilotForXcode/releases/download/0.28.1/Copilot.for.Xcode.app.fixed.zip

Removing all arguments gives the error:
return /bin/bash: git check-ignore "": No such file or directory although it exists.

You have to keep the "-c" or it will treat the string as the path to program.

@GeRryCh
Copy link
Author

GeRryCh commented Dec 4, 2023

@GeRryCh Please give this version a try https://github.com/intitni/CopilotForXcode/releases/download/0.28.1/Copilot.for.Xcode.app.fixed.zip

Removing all arguments gives the error:
return /bin/bash: git check-ignore "": No such file or directory although it exists.

You have to keep the "-c" or it will treat the string as the path to program.

In the version you've sent, it seems to be working regardless of whether the 'gitignore check' flag is selected! 👏

@intitni
Copy link
Owner

intitni commented Dec 4, 2023

Thank you for reporting, it's now fixed in 0.28.2!

@intitni intitni closed this as completed Dec 4, 2023
@intitni intitni added released and removed help wanted Extra attention is needed labels Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

3 participants