{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/25366067","id":25366067,"diff_hunk":"@@ -536,15 +530,35 @@ module ts.server {\n         updateProjectStructure() {\r\n             this.log(\"updating project structure from ...\", \"Info\");\r\n             this.printProjects();\r\n+\r\n+            // First loop through all open files that are referenced by projects but are not\r\n+            // project roots.  For each referenced file, see if the default project still\r\n+            // references that file.  If so, then just keep the file in the referenced list.\r\n+            // If not, add the file to an unattached list, to be rechecked later.\r\n+\r\n+            var openFilesReferenced: ScriptInfo[] = [];\r\n+            var unattachedOpenFiles: ScriptInfo[] = [];\r\n+\r\n             for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) {\r\n-                var refdFile = this.openFilesReferenced[i];\r\n-                refdFile.defaultProject.updateGraph();\r\n-                var sourceFile = refdFile.defaultProject.getSourceFile(refdFile);\r\n-                if (!sourceFile) {\r\n-                    this.openFilesReferenced = copyListRemovingItem(refdFile, this.openFilesReferenced);\r\n-                    this.addOpenFile(refdFile);\r\n+                var referencedFile = this.openFilesReferenced[i];\r\n+                referencedFile.defaultProject.updateGraph();\r","path":"src/server/editorServices.ts","position":36,"original_position":36,"commit_id":"68049ea5035884216b45215d6d2dcfa37619e798","original_commit_id":"68049ea5035884216b45215d6d2dcfa37619e798","user":{"login":"yuit","id":489742,"avatar_url":"https://avatars.githubusercontent.com/u/489742?v=3","gravatar_id":"","url":"https://api.github.com/users/yuit","html_url":"https://github.com/yuit","followers_url":"https://api.github.com/users/yuit/followers","following_url":"https://api.github.com/users/yuit/following{/other_user}","gists_url":"https://api.github.com/users/yuit/gists{/gist_id}","starred_url":"https://api.github.com/users/yuit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuit/subscriptions","organizations_url":"https://api.github.com/users/yuit/orgs","repos_url":"https://api.github.com/users/yuit/repos","events_url":"https://api.github.com/users/yuit/events{/privacy}","received_events_url":"https://api.github.com/users/yuit/received_events","type":"User","site_admin":false},"body":"Some comment on why calling updateGraph will be helpful in this context","created_at":"2015-02-25T18:42:28Z","updated_at":"2015-02-25T18:42:28Z","html_url":"https://github.com/Microsoft/TypeScript/pull/2125#discussion_r25366067","pull_request_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/25366067"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/2125#discussion_r25366067"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125","id":29876878,"html_url":"https://github.com/Microsoft/TypeScript/pull/2125","diff_url":"https://github.com/Microsoft/TypeScript/pull/2125.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/2125.patch","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2125","number":2125,"state":"open","locked":false,"title":"Update project structure on idle after change","user":{"login":"steveluc","id":4419011,"avatar_url":"https://avatars.githubusercontent.com/u/4419011?v=3","gravatar_id":"","url":"https://api.github.com/users/steveluc","html_url":"https://github.com/steveluc","followers_url":"https://api.github.com/users/steveluc/followers","following_url":"https://api.github.com/users/steveluc/following{/other_user}","gists_url":"https://api.github.com/users/steveluc/gists{/gist_id}","starred_url":"https://api.github.com/users/steveluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveluc/subscriptions","organizations_url":"https://api.github.com/users/steveluc/orgs","repos_url":"https://api.github.com/users/steveluc/repos","events_url":"https://api.github.com/users/steveluc/events{/privacy}","received_events_url":"https://api.github.com/users/steveluc/received_events","type":"User","site_admin":false},"body":"Update project structure after change.  After each change a timer is started.  If timer finishes before another change takes place, project structure will be updated to reflect any changes in reference comments or import statements.","created_at":"2015-02-24T07:48:08Z","updated_at":"2015-02-25T18:42:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca6be5167ef5cd21dc08c21c0ff0c7795609388d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125/commits","review_comments_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125/comments","review_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/2125/comments","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/68049ea5035884216b45215d6d2dcfa37619e798","head":{"label":"Microsoft:updateProjectStructure","ref":"updateProjectStructure","sha":"68049ea5035884216b45215d6d2dcfa37619e798","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}","created_at":"2014-06-17T15:28:39Z","updated_at":"2015-02-25T15:37:02Z","pushed_at":"2015-02-25T08:02:20Z","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":567976,"stargazers_count":3539,"watchers_count":3539,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":335,"mirror_url":null,"open_issues_count":515,"forks":335,"open_issues":515,"watchers":3539,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"55dafb51e3bf54203aa2db82958463d6384684e5","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}","created_at":"2014-06-17T15:28:39Z","updated_at":"2015-02-25T15:37:02Z","pushed_at":"2015-02-25T08:02:20Z","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":567976,"stargazers_count":3539,"watchers_count":3539,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":335,"mirror_url":null,"open_issues_count":515,"forks":335,"open_issues":515,"watchers":3539,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/2125"},"issue":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/2125"},"comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/2125/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/2125/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/TypeScript/statuses/68049ea5035884216b45215d6d2dcfa37619e798"}}}}