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
[SR-3121] Auto-completion and Syntax coloring don't work most of the time with SwiftPM generated Xcode projects #5182
Comments
Users are reporting that this regressed between using the 3.0.1 and the 3.0 versions of the package manager project generation. I'm not really sure how this is possible, but it has been reported by multiple people... |
Xcode version ? |
More information would be useful. I consistently get code completion in the generated project for SwiftPM itself. I know that there have been some changes re: settings SDKROOT etc... it's possible that that has an effect. I'll try with Zewo specifically, though. |
I can reproduce this for Swift sources (C sources work fine), but oddly, most indexer features work just fine: I can jump-to-definition, I can see all callers in the structure navigator, etc. So the question is what's different in the code completion context between, Zewo and, say, SwiftPM itself. And I have verified that this problem is in the source files that are in the top-level package itself; it's not a case of external dependencies vs internal source files. |
Comment by Paulo Ricardo Lopes de Faria (JIRA) Just so you know. This problem also happens with repos that have no dependency at all like: |
Could this be related to toolchains or the SWIFT_VERSION setting? |
Possibly — when I was able to reproduce this, with Zewo, the problem at the fundamental Xcode level was that the indexing methods reported no compiler settings at all; I haven't been able to get back yet to investigating why not, but since Zewo does interesting things with symlinked source files, I thought that was part of the problem. I'll check GraphQL as well, and if it more traditional in its source layout, that could rule out some of the variables and help narrow this down. |
For GraphQL I am not able to reproduce this — I get code completion (once indexing as finished). |
Comment by Paulo Ricardo Lopes de Faria (JIRA) I was using Xcode 8.1 with Xcode's own toolchain. The code completion is lost after some time when you edit the code. In GraphQL's example I was pasting javascript code and then porting it to Swift. As soon as I pasted js code, code completion disappeared and never came back, even after I correctly translated the code, making it compile and all. The only way to bring it back was to regenerate the project. Not even closing Xcode, cleaning derived folder, etc.. would work. |
Thanks for the information, paulofaria (JIRA User). That sounds like yet another, slightly different case: if everything initially works fine but eventually stops working, then that doesn't sound the same as a project generator bug (since the project generator can't affect the project after it's been generated). It could be a SourceKit crash, or possibly a change to the project that breaks it (and that regenerating the project then "fixes" again). Are you able to reproduce this, and / or do you have a copy of the the old (broken) project I could look at? |
There's also a discussion here: Kitura/Kitura#822 |
Comment by Paulo Ricardo Lopes de Faria (JIRA) The problem is that Xcode projects generated with Swift 3.0 work fine. only the ones generated with Swift 3.0.1 don't. I'll try to reproduce again when I have some time. But it didn't take much. Just generate a project with SwiftPM 3.0.1, paste some rubbish and even if you delete it or fix it, auto-completion is lost forever. some of syntax coloring comes back, but not completely. |
I see. And just to clarify, for you when you generate the project with Swift 3.0, pasting the rubbish and then deleting it restores full functionality? For me, unfortunately, I wasn't able to get the Swift 3.0-generated projects to work fine — if they did it would be great, since that would provide something to compare and contrast. In particular I used Xcode 8.0's Swift (3.0) to generate the project and was not able to get code completion to work in the Kitura-Sample project (from the thread I referenced above). I will try again also with GraphQL again (which did work for me, both in 8.0 and 8.1, but I hadn't tried the part about pasting rubbish and seeing if the code completion went away). |
Comment by Paulo Ricardo Lopes de Faria (JIRA) Looks like they found a solution for Kitura-Sample project. Which is to add back a modulemap. This is still count as a bug because SwiftPM should create the modulemap if we don't provide one, right? |
I investigated this, there is definitely something going on with modulemaps and sourcekit. 1. Working case: 2. Failure 1: 3. Failure 2: 4. Failure 3: |
@ddunbar @abertelrud can you forward this to someone working on sourcekit |
Comment by Andrey Volodin (JIRA) I confirm this. None of my SwiftPM projects has autocompletion. |
This should go to Argyrios. |
Fixed by #907 |
Attachment: Download
Additional Detail from JIRA
md5: 8ac4d586758a2b680111b946a047c3be
is duplicated by:
relates to:
Issue Description:
Auto-completion and Syntax coloring don't work most of the time with Xcode projects generated by SwiftPM 3.0.1
Steps to reproduce:
clone a large SwiftPM package like https://github.com/Zewo/Zewo
generate Xcode project
swift package generate-xcodeproj
notice lack of auto-completion and syntax coloring
The text was updated successfully, but these errors were encountered: