mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 04:17:37 +00:00
Resolve file before resolving content Fixes #44092
This commit is contained in:
parent
1e2281921d
commit
89ca630051
2 changed files with 23 additions and 14 deletions
|
@ -265,8 +265,11 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
|
|||
}
|
||||
|
||||
private resolveWorkspaceFolderRecommendations(workspaceFolder: IWorkspaceFolder): TPromise<string[]> {
|
||||
return this.fileService.resolveContent(workspaceFolder.toResource(paths.join('.vscode', 'extensions.json')))
|
||||
.then(content => this.processWorkspaceRecommendations(json.parse(content.value, [])), err => []);
|
||||
const extensionsJsonUri = workspaceFolder.toResource(paths.join('.vscode', 'extensions.json'));
|
||||
return this.fileService.resolveFile(extensionsJsonUri).then(() => {
|
||||
return this.fileService.resolveContent(extensionsJsonUri)
|
||||
.then(content => this.processWorkspaceRecommendations(json.parse(content.value, [])), err => []);
|
||||
}, err => []);
|
||||
}
|
||||
|
||||
private processWorkspaceRecommendations(extensionsContent: IExtensionsContent): TPromise<string[]> {
|
||||
|
|
|
@ -139,10 +139,12 @@ export function getHashedRemotesFromConfig(text: string, stripEndingDotGit: bool
|
|||
export function getHashedRemotesFromUri(workspaceUri: URI, fileService: IFileService, stripEndingDotGit: boolean = false): TPromise<string[]> {
|
||||
let path = workspaceUri.path;
|
||||
let uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/.git/config` });
|
||||
return fileService.resolveContent(uri, { acceptTextOnly: true }).then(
|
||||
content => getHashedRemotesFromConfig(content.value, stripEndingDotGit),
|
||||
err => [] // ignore missing or binary file
|
||||
);
|
||||
return fileService.resolveFile(uri).then(() => {
|
||||
return fileService.resolveContent(uri, { acceptTextOnly: true }).then(
|
||||
content => getHashedRemotesFromConfig(content.value, stripEndingDotGit),
|
||||
err => [] // ignore missing or binary file
|
||||
);
|
||||
}, err => []);
|
||||
}
|
||||
|
||||
export class WorkspaceStats implements IWorkbenchContribution {
|
||||
|
@ -323,10 +325,12 @@ export class WorkspaceStats implements IWorkbenchContribution {
|
|||
TPromise.join<string[]>(workspaceUris.map(workspaceUri => {
|
||||
const path = workspaceUri.path;
|
||||
const uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/.git/config` });
|
||||
return this.fileService.resolveContent(uri, { acceptTextOnly: true }).then(
|
||||
content => getDomainsOfRemotes(content.value, SecondLevelDomainWhitelist),
|
||||
err => [] // ignore missing or binary file
|
||||
);
|
||||
return this.fileService.resolveFile(uri).then(() => {
|
||||
return this.fileService.resolveContent(uri, { acceptTextOnly: true }).then(
|
||||
content => getDomainsOfRemotes(content.value, SecondLevelDomainWhitelist),
|
||||
err => [] // ignore missing or binary file
|
||||
);
|
||||
}, err => []);
|
||||
})).then(domains => {
|
||||
const set = domains.reduce((set, list) => list.reduce((set, item) => set.add(item), set), new Set<string>());
|
||||
const list: string[] = [];
|
||||
|
@ -388,10 +392,12 @@ export class WorkspaceStats implements IWorkbenchContribution {
|
|||
return TPromise.join(workspaceUris.map(workspaceUri => {
|
||||
const path = workspaceUri.path;
|
||||
const uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/pom.xml` });
|
||||
return this.fileService.resolveContent(uri, { acceptTextOnly: true }).then(
|
||||
content => !!content.value.match(/azure/i),
|
||||
err => false
|
||||
);
|
||||
return this.fileService.resolveFile(uri).then(stats => {
|
||||
return this.fileService.resolveContent(uri, { acceptTextOnly: true }).then(
|
||||
content => !!content.value.match(/azure/i),
|
||||
err => false
|
||||
);
|
||||
}, err => false);
|
||||
})).then(javas => {
|
||||
if (javas.indexOf(true) !== -1) {
|
||||
tags['java'] = true;
|
||||
|
|
Loading…
Reference in a new issue