[swift-dev] autocompletions for local variables

Jordan Rose jordan_rose at apple.com
Tue Jul 25 13:17:52 CDT 2017


Hi, Mansimar. I don't work on code completion myself, but my recollection was that the results are always computed for the start location of the identifier, ignoring any text that may have already been typed. This is because SourceKit is meant to have an IDE as a client, and so to minimize traffic between SourceKit and the IDE it's better to have a simple filter on the client side than to send multiple requests every time the user types a key (especially backspace!).

SourceKitten may or may not want to follow that philosophy, but that should at least explain what's going on.

Best,
Jordan


> On Jul 24, 2017, at 08:46, Mansimar Kaur via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi
> 
> Sourckitten ( https://github.com/jpsim/SourceKitten <https://github.com/jpsim/SourceKitten> ) uses Sourcekitd to provide autocompletions.
> 
> When trying to generate autocompletions for local variables: wi
> let hello = 5;hell with offset 14
> 
> The autocompletions generated are 344 in number and only one of the returned results even starts with 'h'.
> 
> Why are wrong autocompletions being generated alongwith only one correct one?
> 
> For more context, please take a look at this issue: https://github.com/jpsim/SourceKitten/issues/406 <https://github.com/jpsim/SourceKitten/issues/406>
> 
> Thanks
> Mansimar Kaur
> 
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170725/52c2a99c/attachment.html>


More information about the swift-dev mailing list