@@ -231,14 +231,15 @@ connection.onCompletion(({textDocument, position}): Thenable<CompletionItem[]> =
231231 const offset = document . offsetAt ( position ) //FIXME
232232 return sourcekitProtocol
233233 . codeComplete ( srcText , srcPath , offset )
234- . then ( function ( completions ) {
234+ . then ( function ( completions : Object [ ] | null ) {
235235 let items = [ ] ;
236- for ( let c of < Array < Object > > completions ) {
236+ for ( let c of completions || [ ] ) {
237237 let item = CompletionItem . create ( c [ "key.description" ] )
238238 item . kind = toCompletionItemKind ( c [ "key.kind" ] )
239239 item . detail = `${ c [ "key.modulename" ] } .${ c [ "key.name" ] } `
240240 item . insertText = createSuggest ( c [ "key.sourcetext" ] )
241241 item . insertTextFormat = InsertTextFormat . Snippet
242+ item . documentation = c [ "key.doc.brief" ]
242243 items . push ( item )
243244 }
244245 return items
@@ -510,14 +511,17 @@ export function getShellExecPath() {
510511 * TODO: to use build yaml?
511512 */
512513let argsImportPaths : string [ ] = null
513-
514514export function loadArgsImportPaths ( ) : string [ ] {
515515 if ( ! argsImportPaths ) {
516516 argsImportPaths = [ ]
517517 argsImportPaths . push ( "-I" )
518518 argsImportPaths . push ( path . join ( workspaceRoot , '.build' , 'debug' ) )
519519 //FIXME system paths can not be available automatically?
520520 // rt += " -I"+"/usr/lib/swift/linux/x86_64"
521+ argsImportPaths . push ( "-sdk" )
522+ argsImportPaths . push ( "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk" )
523+ argsImportPaths . push ( "-I" )
524+ argsImportPaths . push ( "/System/Library/Frameworks/" )
521525 argsImportPaths . push ( "-I" )
522526 argsImportPaths . push ( "/usr/lib/swift/pm/" )
523527 return argsImportPaths
0 commit comments