提交 c6566148 编写于 作者: M Matt Bierner 提交者: GitHub

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.
上级 fec95643
......@@ -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);
}
}]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册