jpsim / jpsim/SourceKitten

sourcekitten complete on Linux not doing what I expected

Open
#798 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.4k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

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 (https://github.com/jpsim/SourceKitten/issues/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported sourcekitten complete command and compare its Linux output with the expected URI completion. Read issue 113 and verify the behavior using SourceKitten 0.34.1 with Swift 5.9.1-RELEASE; determine whether the result is expected on Linux or indicates a SourceKitten problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.