Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae

This commit is contained in:
ADS Merger
2020-06-18 04:32:54 +00:00
committed by AzureDataStudio
parent a971aee5bd
commit 5e7071e466
1002 changed files with 24201 additions and 13193 deletions

View File

@@ -28,7 +28,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
export abstract class AbstractFileDialogService implements IFileDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(
@IHostService protected readonly hostService: IHostService,

View File

@@ -22,7 +22,7 @@ import { fromNow } from 'vs/base/common/date';
export class DialogService implements IDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
private allowableCommands = ['copy', 'cut'];

View File

@@ -765,6 +765,9 @@ export class SimpleFileDialog {
// File or folder doesn't exist
this.filePickBox.validationMessage = nls.localize('remoteFileDialog.validateNonexistentDir', 'Please enter a path that exists.');
return Promise.resolve(false);
} else if (uri.path === '/' && (await this.isWindowsOS())) {
this.filePickBox.validationMessage = nls.localize('remoteFileDialog.windowsDriveLetter', 'Please start the path with a drive letter.');
return Promise.resolve(false);
} else if (stat.isDirectory && !this.allowFolderSelection) {
// Folder selected when folder selection not permitted
this.filePickBox.validationMessage = nls.localize('remoteFileDialog.validateFileOnly', 'Please select a file.');
@@ -865,7 +868,7 @@ export class SimpleFileDialog {
private createBackItem(currFolder: URI): FileQuickPickItem | null {
const fileRepresentationCurr = this.currentFolder.with({ scheme: Schemas.file });
const fileRepresentationParent = resources.dirname(fileRepresentationCurr);
if (!resources.extUriIgnorePathCase.isEqual(fileRepresentationCurr, fileRepresentationParent)) {
if (!resources.isEqual(fileRepresentationCurr, fileRepresentationParent)) {
const parentFolder = resources.dirname(currFolder);
return { label: '..', uri: resources.addTrailingPathSeparator(parentFolder, this.separator), isFolder: true };
}
@@ -878,8 +881,7 @@ export class SimpleFileDialog {
const backDir = this.createBackItem(currentFolder);
try {
const folder = await this.fileService.resolve(currentFolder);
const fileNames = folder.children ? folder.children.map(child => child.name) : [];
const items = await Promise.all(fileNames.map(fileName => this.createItem(fileName, currentFolder, token)));
const items = folder.children ? await Promise.all(folder.children.map(child => this.createItem(child, currentFolder, token))) : [];
for (let item of items) {
if (item) {
result.push(item);
@@ -922,23 +924,18 @@ export class SimpleFileDialog {
return true;
}
private async createItem(filename: string, parent: URI, token: CancellationToken): Promise<FileQuickPickItem | undefined> {
private async createItem(stat: IFileStat, parent: URI, token: CancellationToken): Promise<FileQuickPickItem | undefined> {
if (token.isCancellationRequested) {
return undefined;
}
let fullPath = resources.joinPath(parent, filename);
try {
const stat = await this.fileService.resolve(fullPath);
if (stat.isDirectory) {
filename = resources.basename(fullPath);
fullPath = resources.addTrailingPathSeparator(fullPath, this.separator);
return { label: filename, uri: fullPath, isFolder: true, iconClasses: getIconClasses(this.modelService, this.modeService, fullPath || undefined, FileKind.FOLDER) };
} else if (!stat.isDirectory && this.allowFileSelection && this.filterFile(fullPath)) {
return { label: filename, uri: fullPath, isFolder: false, iconClasses: getIconClasses(this.modelService, this.modeService, fullPath || undefined) };
}
return undefined;
} catch (e) {
return undefined;
let fullPath = resources.joinPath(parent, stat.name);
if (stat.isDirectory) {
const filename = resources.basename(fullPath);
fullPath = resources.addTrailingPathSeparator(fullPath, this.separator);
return { label: filename, uri: fullPath, isFolder: true, iconClasses: getIconClasses(this.modelService, this.modeService, fullPath || undefined, FileKind.FOLDER) };
} else if (!stat.isDirectory && this.allowFileSelection && this.filterFile(fullPath)) {
return { label: stat.name, uri: fullPath, isFolder: false, iconClasses: getIconClasses(this.modelService, this.modeService, fullPath || undefined) };
}
return undefined;
}
}

View File

@@ -5,7 +5,6 @@
import * as nls from 'vs/nls';
import * as os from 'os';
import product from 'vs/platform/product/common/product';
import Severity from 'vs/base/common/severity';
import { isLinux, isWindows } from 'vs/base/common/platform';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
@@ -42,7 +41,7 @@ interface IMassagedMessageBoxOptions {
export class DialogService implements IDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
private nativeImpl: IDialogService;
private customImpl: IDialogService;
@@ -59,7 +58,7 @@ export class DialogService implements IDialogService {
@IElectronService electronService: IElectronService
) {
this.customImpl = new HTMLDialogService(logService, layoutService, themeService, keybindingService, productService, clipboardService);
this.nativeImpl = new NativeDialogService(logService, sharedProcessService, electronService, clipboardService);
this.nativeImpl = new NativeDialogService(logService, sharedProcessService, electronService, productService, clipboardService);
}
private get useCustomDialog(): boolean {
@@ -89,12 +88,13 @@ export class DialogService implements IDialogService {
class NativeDialogService implements IDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(
@ILogService private readonly logService: ILogService,
@ISharedProcessService sharedProcessService: ISharedProcessService,
@IElectronService private readonly electronService: IElectronService,
@IProductService private readonly productService: IProductService,
@IClipboardService private readonly clipboardService: IClipboardService
) {
sharedProcessService.registerChannel('dialog', new DialogChannel(this));
@@ -205,15 +205,15 @@ class NativeDialogService implements IDialogService {
options.buttons = buttons;
options.cancelId = cancelId;
options.noLink = true;
options.title = options.title || product.nameLong;
options.title = options.title || this.productService.nameLong;
return { options, buttonIndexMap };
}
async about(): Promise<void> {
let version = product.version;
if (product.target) {
version = `${version} (${product.target} setup)`;
let version = this.productService.version;
if (this.productService.target) {
version = `${version} (${this.productService.target} setup)`;
}
const isSnap = process.platform === 'linux' && process.env.SNAP && process.env.SNAP_REVISION;
@@ -222,14 +222,14 @@ class NativeDialogService implements IDialogService {
return nls.localize('aboutDetail',
"Version: {0}\nCommit: {1}\nDate: {2}\nVS Code: {8}\nElectron: {3}\nChrome: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}",
version,
product.commit || 'Unknown',
product.date ? `${product.date}${useAgo ? ' (' + fromNow(new Date(product.date), true) + ')' : ''}` : 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
process.versions['electron'],
process.versions['chrome'],
process.versions['node'],
process.versions['v8'],
`${os.type()} ${os.arch()} ${os.release()}${isSnap ? ' snap' : ''}`,
product.vscodeVersion
this.productService.vscodeVersion
);
};
@@ -246,9 +246,9 @@ class NativeDialogService implements IDialogService {
}
const result = await this.electronService.showMessageBox({
title: product.nameLong,
title: this.productService.nameLong,
type: 'info',
message: product.nameLong,
message: this.productService.nameLong,
detail: `\n${detail}`,
buttons,
noLink: true,

View File

@@ -26,7 +26,7 @@ import { NativeSimpleFileDialog } from 'vs/workbench/services/dialogs/electron-b
export class FileDialogService extends AbstractFileDialogService implements IFileDialogService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
constructor(
@IHostService hostService: IHostService,