<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">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!).</div><div class=""><br class=""></div><div class="">SourceKitten may or may not want to follow that philosophy, but that should at least explain what's going on.</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Jordan</div><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 24, 2017, at 08:46, Mansimar Kaur via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi<div class=""><br class=""></div><div class="">Sourckitten ( <a href="https://github.com/jpsim/SourceKitten" class="">https://github.com/jpsim/SourceKitten</a>&nbsp;) uses Sourcekitd to provide autocompletions.</div><div class=""><br class=""></div><div class="">When trying to generate autocompletions for local variables: wi</div><div class=""><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:11.9px;background-color:rgba(27,31,35,0.05)" class="">let hello = 5;hell&nbsp;</span>with offset 14</div><div class=""><br class=""></div><div class="">The autocompletions generated are 344 in number and only one of the returned results even starts with 'h'.</div><div class=""><br class=""></div><div class="">Why are wrong autocompletions being generated alongwith only one correct one?</div><div class=""><br class=""></div><div class="">For more context, please take a look at this issue:&nbsp;<a href="https://github.com/jpsim/SourceKitten/issues/406" class="">https://github.com/jpsim/SourceKitten/issues/406</a></div><div class=""><br class=""></div><div class="">Thanks</div><div class="">Mansimar Kaur</div><div class=""><br class=""></div></div>
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>