{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/75949700","id":75949700,"diff_hunk":"@@ -4464,6 +4503,466 @@ namespace ts {\n             }\r\n         }\r\n \r\n+        function getImportModuleCompletionsAtPosition(fileName: string, position: number): ImportCompletionInfo {\r\n+            synchronizeHostData();\r\n+\r\n+            const sourceFile = getValidSourceFile(fileName);\r\n+            if (isInReferenceComment(sourceFile, position)) {\r\n+                return getTripleSlashReferenceCompletion(sourceFile, position);\r\n+            }\r\n+            else if (isInString(sourceFile, position)) {\r\n+                const node = findPrecedingToken(position, sourceFile);\r\n+                if (!node || node.kind !== SyntaxKind.StringLiteral) {\r\n+                    return undefined;\r\n+                }\r\n+\r\n+                if (node.parent.kind === SyntaxKind.ImportDeclaration || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isRequireCall(node.parent, false)) {\r\n+                    // Get all known external module names or complete a path to a module\r\n+                    return {\r\n+                        entries: getStringLiteralCompletionEntriesFromModuleNames(<StringLiteral>node),\r\n+                        textSpan: getDirectoryFragmentTextSpan((<StringLiteral>node).text, node.getStart() + 1)\r\n+                    };\r\n+                }\r\n+            }\r\n+\r\n+            return undefined;\r\n+\r\n+            function getStringLiteralCompletionEntriesFromModuleNames(node: StringLiteral) {\r\n+                const literalValue = normalizeSlashes(node.text);\r\n+\r\n+                const scriptPath = node.getSourceFile().path;\r\n+                const scriptDirectory = getDirectoryPath(scriptPath);\r\n+                if (isPathRelativeToScript(literalValue) || isRootedDiskPath(literalValue)) {\r\n+                    const compilerOptions = program.getCompilerOptions();\r\n+                    if (compilerOptions.rootDirs) {\r\n+                        return getCompletionEntriesForDirectoryFragmentWithRootDirs(\r\n+                            compilerOptions.rootDirs, literalValue, scriptDirectory, getSupportedExtensions(program.getCompilerOptions()), /*includeExtensions*/false, scriptPath);\r\n+                    }\r\n+                    else {\r\n+                        return getCompletionEntriesForDirectoryFragment(\r\n+                            literalValue, scriptDirectory, getSupportedExtensions(program.getCompilerOptions()), /*includeExtensions*/false, scriptPath);\r\n+                    }\r\n+                }\r\n+                else {\r\n+                    // Check for node modules\r\n+                    return getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory);\r\n+                }\r\n+            }\r\n+\r\n+            /**\r\n+             * Takes a script path and returns paths for all potential folders that could be merged with its\r\n+             * containing folder via the \"rootDirs\" compiler option\r\n+             */\r\n+            function getBaseDirectoriesFromRootDirs(rootDirs: string[], basePath: string, scriptPath: string, ignoreCase: boolean): string[] {\r\n+                // Make all paths absolute/normalized if they are not already\r\n+                rootDirs = map(rootDirs, rootDirectory => normalizePath(isRootedDiskPath(rootDirectory) ? rootDirectory : combinePaths(basePath, rootDirectory)));\r\n+\r\n+                // Determine the path to the directory containing the script relative to the root directory it is contained within\r\n+                let relativeDirectory: string;\r\n+                forEach(rootDirs, rootDirectory => {\r","path":"src/services/services.ts","position":177,"original_position":177,"commit_id":"0ebd19618d4b8b5aa64a0c7b2676898cef09308e","original_commit_id":"0ebd19618d4b8b5aa64a0c7b2676898cef09308e","user":{"login":"rbuckton","id":3902892,"avatar_url":"https://avatars.githubusercontent.com/u/3902892?v=3","gravatar_id":"","url":"https://api.github.com/users/rbuckton","html_url":"https://github.com/rbuckton","followers_url":"https://api.github.com/users/rbuckton/followers","following_url":"https://api.github.com/users/rbuckton/following{/other_user}","gists_url":"https://api.github.com/users/rbuckton/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuckton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuckton/subscriptions","organizations_url":"https://api.github.com/users/rbuckton/orgs","repos_url":"https://api.github.com/users/rbuckton/repos","events_url":"https://api.github.com/users/rbuckton/events{/privacy}","received_events_url":"https://api.github.com/users/rbuckton/received_events","type":"User","site_admin":false},"body":"consider `for..of` to avoid the closure.","created_at":"2016-08-23T20:59:26Z","updated_at":"2016-08-23T20:59:26Z","html_url":"https://github.com/Microsoft/TypeScript/pull/9353#discussion_r75949700","pull_request_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/75949700"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/9353#discussion_r75949700"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353","id":75180308,"html_url":"https://github.com/Microsoft/TypeScript/pull/9353","diff_url":"https://github.com/Microsoft/TypeScript/pull/9353.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/9353.patch","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9353","number":9353,"state":"open","locked":false,"title":"Fix 188: Autocomplete for imports and triple slash reference paths","user":{"login":"riknoll","id":13754588,"avatar_url":"https://avatars.githubusercontent.com/u/13754588?v=3","gravatar_id":"","url":"https://api.github.com/users/riknoll","html_url":"https://github.com/riknoll","followers_url":"https://api.github.com/users/riknoll/followers","following_url":"https://api.github.com/users/riknoll/following{/other_user}","gists_url":"https://api.github.com/users/riknoll/gists{/gist_id}","starred_url":"https://api.github.com/users/riknoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riknoll/subscriptions","organizations_url":"https://api.github.com/users/riknoll/orgs","repos_url":"https://api.github.com/users/riknoll/repos","events_url":"https://api.github.com/users/riknoll/events{/privacy}","received_events_url":"https://api.github.com/users/riknoll/received_events","type":"User","site_admin":false},"body":"Fixes #188 \r\nThis adds text completions in imports and triple slash references for the following items:\r\n\r\nFor triple slash references:\r\n* Relative and absolute paths\r\n\r\nFor imports and require:\r\n* Relative and absolute paths\r\n* Modules discovered by the type checker (via triple slash references, `@types` folder, `tsconfig.json`, etc.)\r\n* Modules listed in your project's `package.json`\r\n\r\nThis is a breaking change that requires surfacing some of the `sys` object's file system reading APIs to the `LanguageServiceHost`\r\n\r\nNote that this will only pick up node modules that are in `package.json`. This was done to improve efficiency and to make sure that sub-dependencies don't crowd the completion list.","created_at":"2016-06-24T22:06:45Z","updated_at":"2016-08-23T20:59:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bcd7d0f1105b4b56408ff83bcbf52acc392bac4f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353/commits","review_comments_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353/comments","review_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9353/comments","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/0ebd19618d4b8b5aa64a0c7b2676898cef09308e","head":{"label":"Microsoft:import_completions_pr","ref":"import_completions_pr","sha":"0ebd19618d4b8b5aa64a0c7b2676898cef09308e","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/TypeScript/deployments","created_at":"2014-06-17T15:28:39Z","updated_at":"2016-08-23T20:32:04Z","pushed_at":"2016-08-23T20:40:31Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":554564,"stargazers_count":14252,"watchers_count":14252,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1904,"mirror_url":null,"open_issues_count":1288,"forks":1904,"open_issues":1288,"watchers":14252,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"8ad2744e9a7d0d7eb30286f0b6718b7b5f6cc4f9","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/TypeScript/deployments","created_at":"2014-06-17T15:28:39Z","updated_at":"2016-08-23T20:32:04Z","pushed_at":"2016-08-23T20:40:31Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":554564,"stargazers_count":14252,"watchers_count":14252,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1904,"mirror_url":null,"open_issues_count":1288,"forks":1904,"open_issues":1288,"watchers":14252,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/9353"},"issue":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/9353"},"comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/9353/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9353/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/TypeScript/statuses/0ebd19618d4b8b5aa64a0c7b2676898cef09308e"}}}}
{"actor":{"display_login":"rbuckton"}}