From c6566148cf33f9117be0eca51c272bff0b875319 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 22 Nov 2016 14:24:52 -0800 Subject: [PATCH] Fix TS/JS Implicit Project Too Large Exclude Action (#15678) Issue #15610 **bug** For implicit js/ts projects that trigger the large project warning in vscode, the action currently tries to create a jsconfig.json file in `/dev/null/...` **Fix** In cases where the `jsconfig.json` file returned by tsserver is not under the root worspace, create an empty `jsconfig.json` at the root of the project instead. --- extensions/typescript/src/utils/projectStatus.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/typescript/src/utils/projectStatus.ts b/extensions/typescript/src/utils/projectStatus.ts index 173a7e8b53f..5ecdb13486f 100644 --- a/extensions/typescript/src/utils/projectStatus.ts +++ b/extensions/typescript/src/utils/projectStatus.ts @@ -8,7 +8,7 @@ import * as vscode from 'vscode'; import { ITypescriptServiceClient } from '../typescriptService'; import { loadMessageBundle } from 'vscode-nls'; -import { dirname } from 'path'; +import { dirname, join } from 'path'; const localize = loadMessageBundle(); const selector = ['javascript', 'javascriptreact']; @@ -77,7 +77,6 @@ export function create(client: ITypescriptServiceClient, isOpen: (path: string) } if (fileNames.length > fileLimit) { - let largeRoots = computeLargeRoots(configFileName, fileNames).map(f => `'/${f}/'`).join(', '); currentHint = { @@ -91,7 +90,14 @@ export function create(client: ITypescriptServiceClient, isOpen: (path: string) projectHinted[configFileName] = true; item.hide(); - return vscode.workspace.openTextDocument(configFileName) + let configFileUri: vscode.Uri; + if (dirname(configFileName).indexOf(vscode.workspace.rootPath) === 0) { + configFileUri = vscode.Uri.file(configFileName); + } else { + configFileUri = vscode.Uri.parse('untitled://' + join(vscode.workspace.rootPath, 'jsconfig.json')); + } + + return vscode.workspace.openTextDocument(configFileUri) .then(vscode.window.showTextDocument); } }] -- GitLab