company-sourcekit icon indicating copy to clipboard operation
company-sourcekit copied to clipboard

Completion of symbols in current module

Open wiruzx opened this issue 8 years ago • 1 comments

import Foundation

let x = "Hello"

func test(x: String) -> String {
    return x + " World"
}

let y = te // Completion doesn't work

But if we write

let y = Temp.te // Completion works perfectly

where Temp is module name

wiruzx avatar Dec 07 '15 15:12 wiruzx

It seems that just like #13 it's running into an issue where sourcekit returns never-ending gibberish for completions that don't have a . or ( or import.

I'm not sure if it's because we're sending the wrong offset to sourcekit or if sourcekittendaemon is sending the wrong flags.

This is how it currently works:

let y = te|
#         ^ Offset: 11, Prefix: ""
#           Results: gibberish

It probably should work like this but even after manually sending the offset it's still getting gibberish:

let y = |te
#       ^ Offset: 9, Prefix: "te"
#         Results: gibberish

I've tried to see how XCode does it using export SOURCEKIT_LOGGING=3 && /Applications/Xcode.app/Contents/MacOS/Xcode but things were too slow with the logging on and I've run out of time today :)

nathankot avatar Dec 08 '15 02:12 nathankot