{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments/54954070","id":54954070,"diff_hunk":"@@ -53,21 +69,53 @@ export class IntellisenseHelper {\n     }\n \n     /**\n-     * Helper method that installs Typescript into a global location.\n+     * Helper method that verifies the correct version of TypeScript is installed.\n+     * If using a newer version of VSCode TypeScript is installed by default and no\n+     * action is needed. If using an older version, verify that the correct TS version is\n+     * installed, if not install it.\n      */\n-    public static installTypescriptNext(isRestartRequired: boolean): Q.Promise<boolean> {\n-        let typeScriptNextDest: string = path.resolve(IntellisenseHelper.getUserHomePath(), \".vscode\");\n-        let typeScriptNextLibPath: string = path.join(typeScriptNextDest, \"node_modules\", \"typescript\", \"lib\");\n-        let fileSystem: FileSystem = new FileSystem();\n+    public static verifyInstallTypeScript(isRestartRequired: boolean): Q.Promise<boolean> {\n \n-        return fileSystem.exists(typeScriptNextLibPath)\n-            .then(function(exists: boolean) {\n-                if (!exists) {\n-                    return Q.nfcall(child_process.exec, `npm install --prefix ${typeScriptNextDest} typescript@next`)\n-                        .then(() => { return true; });\n+        if (IntellisenseHelper.isSalsaSupported()) {\n+            // this is the correct version of vscode, which includes TypeScript (Salsa) support, nothing to do here\n+            return Q.resolve<boolean>(isRestartRequired);\n+        }\n+\n+        return IntellisenseHelper.getInstalledTypeScriptVersion()\n+            .then(function(installProps: InstallProps) {\n+\n+                if (installProps.installed === false) {\n+\n+                    if(semver.neq(IntellisenseHelper.s_typeScriptVersion, installProps.version)) {\n+                        Log.logInternalMessage(LogLevel.Debug, \"TypeScript is installed with the wrong version: \" + installProps.version);\n+                    }\n+                    else {\n+                        Log.logInternalMessage(LogLevel.Debug, \"TypeScript is not installed\");\n+                    }\n+                    return Q.resolve<boolean>(true);\n                 }\n \n-                return isRestartRequired;\n+                Log.logInternalMessage(LogLevel.Debug, \"Installed TypeScript version is correct\");\n+                return Q.resolve<boolean>(false);\n+            })\n+            .then( (install: boolean) => {\n+\n+                if(install) {\n+                    let installPath: string = path.resolve(IntellisenseHelper.getUserHomePath(), \".vscode\");\n+                    let installParam: string = \"npm install --prefix \" + installPath + \" typescript@\" + IntellisenseHelper.s_typeScriptVersion;\n+                    Log.logInternalMessage(LogLevel.Debug, \"Installing TypeScript: \" + installParam);\n+                    return Q.nfcall(child_process.exec, installParam)\n+                        .then(() => {\n+                            return Q.resolve<boolean>(true);\n+                        })\n+                        .catch( (err: any) => {\n+                            Log.logError(\"Error attempting to install TypeScript: \" + err);\n+                            return Q.resolve<boolean>(isRestartRequired);","path":"src/extension/intellisenseHelper.ts","position":97,"original_position":97,"commit_id":"61da97177169f7c5883bee0c73e3482686a56895","original_commit_id":"61da97177169f7c5883bee0c73e3482686a56895","user":{"login":"MSLaguana","id":14098340,"avatar_url":"https://avatars.githubusercontent.com/u/14098340?v=3","gravatar_id":"","url":"https://api.github.com/users/MSLaguana","html_url":"https://github.com/MSLaguana","followers_url":"https://api.github.com/users/MSLaguana/followers","following_url":"https://api.github.com/users/MSLaguana/following{/other_user}","gists_url":"https://api.github.com/users/MSLaguana/gists{/gist_id}","starred_url":"https://api.github.com/users/MSLaguana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSLaguana/subscriptions","organizations_url":"https://api.github.com/users/MSLaguana/orgs","repos_url":"https://api.github.com/users/MSLaguana/repos","events_url":"https://api.github.com/users/MSLaguana/events{/privacy}","received_events_url":"https://api.github.com/users/MSLaguana/received_events","type":"User","site_admin":false},"body":"Should we be attempting to recover from this failure, or should we let it fail the \"prepare the project for salsa\" sequence and report that failure at a higher level?","created_at":"2016-03-03T21:49:02Z","updated_at":"2016-03-03T21:49:02Z","html_url":"https://github.com/Microsoft/vscode-react-native/pull/108#discussion_r54954070","pull_request_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments/54954070"},"html":{"href":"https://github.com/Microsoft/vscode-react-native/pull/108#discussion_r54954070"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108","id":61627198,"html_url":"https://github.com/Microsoft/vscode-react-native/pull/108","diff_url":"https://github.com/Microsoft/vscode-react-native/pull/108.diff","patch_url":"https://github.com/Microsoft/vscode-react-native/pull/108.patch","issue_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/108","number":108,"state":"open","locked":false,"title":"Typescript 1.8","user":{"login":"MShamiltonia","id":17277907,"avatar_url":"https://avatars.githubusercontent.com/u/17277907?v=3","gravatar_id":"","url":"https://api.github.com/users/MShamiltonia","html_url":"https://github.com/MShamiltonia","followers_url":"https://api.github.com/users/MShamiltonia/followers","following_url":"https://api.github.com/users/MShamiltonia/following{/other_user}","gists_url":"https://api.github.com/users/MShamiltonia/gists{/gist_id}","starred_url":"https://api.github.com/users/MShamiltonia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MShamiltonia/subscriptions","organizations_url":"https://api.github.com/users/MShamiltonia/orgs","repos_url":"https://api.github.com/users/MShamiltonia/repos","events_url":"https://api.github.com/users/MShamiltonia/events{/privacy}","received_events_url":"https://api.github.com/users/MShamiltonia/received_events","type":"User","site_admin":false},"body":"- VSCode 0.10.10 supports TypeScript natively - do not manually modify project to use Salsa (as we've done in the past)\r\n- If we have manually modified in the past, fix up the project so that we're no longer interfering\r\n- If we're still running on an older VSCode version ensure that we're using the 1.8.2 (TypeScript 1.8 release), instead of next which may be greater (currently 1.9).","created_at":"2016-03-03T21:21:52Z","updated_at":"2016-03-03T21:49:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"141a4a43fc35d5a3c2b9b62f6913c61124f6de18","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108/commits","review_comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108/comments","review_comment_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/108/comments","statuses_url":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/61da97177169f7c5883bee0c73e3482686a56895","head":{"label":"Microsoft:typescript-1.8","ref":"typescript-1.8","sha":"61da97177169f7c5883bee0c73e3482686a56895","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":50060429,"name":"vscode-react-native","full_name":"Microsoft/vscode-react-native","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/vscode-react-native","description":"vscode extension for react native","fork":false,"url":"https://api.github.com/repos/Microsoft/vscode-react-native","forks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/forks","keys_url":"https://api.github.com/repos/Microsoft/vscode-react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vscode-react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vscode-react-native/teams","hooks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/events","assignees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vscode-react-native/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/tags","blobs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vscode-react-native/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscription","commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vscode-react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vscode-react-native/merges","archive_url":"https://api.github.com/repos/Microsoft/vscode-react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vscode-react-native/downloads","issues_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vscode-react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vscode-react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vscode-react-native/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vscode-react-native/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/deployments","created_at":"2016-01-20T21:10:07Z","updated_at":"2016-03-03T10:55:02Z","pushed_at":"2016-03-03T21:21:52Z","git_url":"git://github.com/Microsoft/vscode-react-native.git","ssh_url":"git@github.com:Microsoft/vscode-react-native.git","clone_url":"https://github.com/Microsoft/vscode-react-native.git","svn_url":"https://github.com/Microsoft/vscode-react-native","homepage":null,"size":3335,"stargazers_count":92,"watchers_count":92,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":25,"forks":2,"open_issues":25,"watchers":92,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"3700fb66d9c3ebb7da5ec8eab604d7ef3f79264f","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":50060429,"name":"vscode-react-native","full_name":"Microsoft/vscode-react-native","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/vscode-react-native","description":"vscode extension for react native","fork":false,"url":"https://api.github.com/repos/Microsoft/vscode-react-native","forks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/forks","keys_url":"https://api.github.com/repos/Microsoft/vscode-react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vscode-react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vscode-react-native/teams","hooks_url":"https://api.github.com/repos/Microsoft/vscode-react-native/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vscode-react-native/events","assignees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vscode-react-native/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/tags","blobs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vscode-react-native/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vscode-react-native/subscription","commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vscode-react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vscode-react-native/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vscode-react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vscode-react-native/merges","archive_url":"https://api.github.com/repos/Microsoft/vscode-react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vscode-react-native/downloads","issues_url":"https://api.github.com/repos/Microsoft/vscode-react-native/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vscode-react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vscode-react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vscode-react-native/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vscode-react-native/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vscode-react-native/deployments","created_at":"2016-01-20T21:10:07Z","updated_at":"2016-03-03T10:55:02Z","pushed_at":"2016-03-03T21:21:52Z","git_url":"git://github.com/Microsoft/vscode-react-native.git","ssh_url":"git@github.com:Microsoft/vscode-react-native.git","clone_url":"https://github.com/Microsoft/vscode-react-native.git","svn_url":"https://github.com/Microsoft/vscode-react-native","homepage":null,"size":3335,"stargazers_count":92,"watchers_count":92,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":25,"forks":2,"open_issues":25,"watchers":92,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108"},"html":{"href":"https://github.com/Microsoft/vscode-react-native/pull/108"},"issue":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/108"},"comments":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/vscode-react-native/statuses/61da97177169f7c5883bee0c73e3482686a56895"}}}}