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

sourcekitten complete on Linux not doing what I expected #798

Open
dpkirchner opened this issue Dec 5, 2023 · 1 comment
Open

sourcekitten complete on Linux not doing what I expected #798

dpkirchner opened this issue Dec 5, 2023 · 1 comment

Comments

@dpkirchner
Copy link

I'm trying to figure out how to use sourcekitten to parse an app's source and provide useful code completions. I found an old issue (#113) but I'm not sure it's still relevant. Here's what I'm trying (copied from an old post that referenced issue 113, https://forums.swift.org/t/sorting-filtering-results/12588):

$ sourcekitten complete --text "import Foundation; let x = UR" --offset 28 '' | jq -r .
[
  {
    "context": "source.codecompletion.context.thisclass",
    "typeName": "_",
    "kind": "source.lang.swift.keyword",
    "sourcetext": ".self",
    "name": "self",
    "numBytesToErase": 0,
    "descriptionKey": "self"
  }
]

The good news is it doesn't return nothing, but it doesn't return what I expected either. I was hoping it'd return something that indicates UR could be completed with URI from the Foundation module. Am I doing something wrong, and/or are most of the completions still handled by Xcode itself?

I'm running this on Linux. I'm on sourcekitten version 0.34.1 and my toolchain is Swift version 5.9.1-RELEASE.

@jpsim
Copy link
Owner

jpsim commented Dec 14, 2023

As I mentioned in the Swift forums thread, SourceKit's API for completions is really counter-intuitive. Maybe asking the folks who work on SourceKit at Apple will lead you to a more satisfying solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants