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@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to