mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)
* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 * Bump distro * Upgrade GCC to 4.9 due to yarn install errors * Update build image * Fix bootstrap base url * Bump distro * Fix build errors * Update source map file * Disable checkbox for blocking migration issues (#15131) * disable checkbox for blocking issues * wip * disable checkbox fixes * fix strings * Remove duplicate tsec command * Default to off for tab color if settings not present * re-skip failing tests * Fix mocha error * Bump sqlite version & fix notebooks search view * Turn off esbuild warnings * Update esbuild log level * Fix overflowactionbar tests * Fix ts-ignore in dropdown tests * cleanup/fixes * Fix hygiene * Bundle in entire zone.js module * Remove extra constructor param * bump distro for web compile break * bump distro for web compile break v2 * Undo log level change * New distro * Fix integration test scripts * remove the "no yarn.lock changes" workflow * fix scripts v2 * Update unit test scripts * Ensure ads-kerberos2 updates in .vscodeignore * Try fix unit tests * Upload crash reports * remove nogpu * always upload crashes * Use bash script * Consolidate data/ext dir names * Create in tmp directory Co-authored-by: chlafreniere <hichise@gmail.com> Co-authored-by: Christopher Suh <chsuh@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -4,16 +4,17 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { joinPath, basenameOrAuthority } from 'vs/base/common/resources';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TernarySearchTree } from 'vs/base/common/map';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IWorkspaceIdentifier, IStoredWorkspaceFolder, isRawFileWorkspaceFolder, isRawUriWorkspaceFolder, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspaceIdentifier, IStoredWorkspaceFolder, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspaceFolderProvider } from 'vs/base/common/labels';
|
||||
|
||||
export const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');
|
||||
|
||||
export interface IWorkspaceContextService extends IWorkspaceFolderProvider {
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
/**
|
||||
@@ -58,9 +59,9 @@ export interface IWorkspaceContextService extends IWorkspaceFolderProvider {
|
||||
getWorkspaceFolder(resource: URI): IWorkspaceFolder | null;
|
||||
|
||||
/**
|
||||
* Return `true` if the current workspace has the given identifier otherwise `false`.
|
||||
* Return `true` if the current workspace has the given identifier or root URI otherwise `false`.
|
||||
*/
|
||||
isCurrentWorkspace(workspaceIdentifier: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): boolean;
|
||||
isCurrentWorkspace(workspaceIdOrFolder: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI): boolean;
|
||||
|
||||
/**
|
||||
* Returns if the provided resource is inside the workspace or not.
|
||||
@@ -80,14 +81,6 @@ export interface IWorkspaceFoldersChangeEvent {
|
||||
changed: IWorkspaceFolder[];
|
||||
}
|
||||
|
||||
export namespace IWorkspace {
|
||||
export function isIWorkspace(thing: unknown): thing is IWorkspace {
|
||||
return !!(thing && typeof thing === 'object'
|
||||
&& typeof (thing as IWorkspace).id === 'string'
|
||||
&& Array.isArray((thing as IWorkspace).folders));
|
||||
}
|
||||
}
|
||||
|
||||
export interface IWorkspace {
|
||||
|
||||
/**
|
||||
@@ -106,6 +99,14 @@ export interface IWorkspace {
|
||||
readonly configuration?: URI | null;
|
||||
}
|
||||
|
||||
export function isWorkspace(thing: unknown): thing is IWorkspace {
|
||||
const candidate = thing as IWorkspace | undefined;
|
||||
|
||||
return !!(candidate && typeof candidate === 'object'
|
||||
&& typeof candidate.id === 'string'
|
||||
&& Array.isArray(candidate.folders));
|
||||
}
|
||||
|
||||
export interface IWorkspaceFolderData {
|
||||
|
||||
/**
|
||||
@@ -125,15 +126,6 @@ export interface IWorkspaceFolderData {
|
||||
readonly index: number;
|
||||
}
|
||||
|
||||
export namespace IWorkspaceFolder {
|
||||
export function isIWorkspaceFolder(thing: unknown): thing is IWorkspaceFolder {
|
||||
return !!(thing && typeof thing === 'object'
|
||||
&& URI.isUri((thing as IWorkspaceFolder).uri)
|
||||
&& typeof (thing as IWorkspaceFolder).name === 'string'
|
||||
&& typeof (thing as IWorkspaceFolder).toResource === 'function');
|
||||
}
|
||||
}
|
||||
|
||||
export interface IWorkspaceFolder extends IWorkspaceFolderData {
|
||||
|
||||
/**
|
||||
@@ -142,6 +134,15 @@ export interface IWorkspaceFolder extends IWorkspaceFolderData {
|
||||
toResource: (relativePath: string) => URI;
|
||||
}
|
||||
|
||||
export function isWorkspaceFolder(thing: unknown): thing is IWorkspaceFolder {
|
||||
const candidate = thing as IWorkspaceFolder;
|
||||
|
||||
return !!(candidate && typeof candidate === 'object'
|
||||
&& URI.isUri(candidate.uri)
|
||||
&& typeof candidate.name === 'string'
|
||||
&& typeof candidate.toResource === 'function');
|
||||
}
|
||||
|
||||
export class Workspace implements IWorkspace {
|
||||
|
||||
private _foldersMap: TernarySearchTree<URI, WorkspaceFolder> = TernarySearchTree.forUris<WorkspaceFolder>(this._ignorePathCasing);
|
||||
@@ -222,7 +223,7 @@ export class WorkspaceFolder implements IWorkspaceFolder {
|
||||
}
|
||||
|
||||
toResource(relativePath: string): URI {
|
||||
return resources.joinPath(this.uri, relativePath);
|
||||
return joinPath(this.uri, relativePath);
|
||||
}
|
||||
|
||||
toJSON(): IWorkspaceFolderData {
|
||||
@@ -231,43 +232,5 @@ export class WorkspaceFolder implements IWorkspaceFolder {
|
||||
}
|
||||
|
||||
export function toWorkspaceFolder(resource: URI): WorkspaceFolder {
|
||||
return new WorkspaceFolder({ uri: resource, index: 0, name: resources.basenameOrAuthority(resource) }, { uri: resource.toString() });
|
||||
}
|
||||
|
||||
export function toWorkspaceFolders(configuredFolders: IStoredWorkspaceFolder[], workspaceConfigFile: URI): WorkspaceFolder[] {
|
||||
let result: WorkspaceFolder[] = [];
|
||||
let seen: Set<string> = new Set();
|
||||
|
||||
const relativeTo = resources.dirname(workspaceConfigFile);
|
||||
for (let configuredFolder of configuredFolders) {
|
||||
let uri: URI | null = null;
|
||||
if (isRawFileWorkspaceFolder(configuredFolder)) {
|
||||
if (configuredFolder.path) {
|
||||
uri = resources.resolvePath(relativeTo, configuredFolder.path);
|
||||
}
|
||||
} else if (isRawUriWorkspaceFolder(configuredFolder)) {
|
||||
try {
|
||||
uri = URI.parse(configuredFolder.uri);
|
||||
// this makes sure all workspace folder are absolute
|
||||
if (uri.path[0] !== '/') {
|
||||
uri = uri.with({ path: '/' + uri.path });
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (uri) {
|
||||
// remove duplicates
|
||||
let comparisonKey = resources.getComparisonKey(uri);
|
||||
if (!seen.has(comparisonKey)) {
|
||||
seen.add(comparisonKey);
|
||||
|
||||
const name = configuredFolder.name || resources.basenameOrAuthority(uri);
|
||||
result.push(new WorkspaceFolder({ uri, name, index: result.length }, configuredFolder));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return new WorkspaceFolder({ uri: resource, index: 0, name: basenameOrAuthority(resource) }, { uri: resource.toString() });
|
||||
}
|
||||
|
||||
@@ -4,26 +4,27 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { Workspace, toWorkspaceFolders, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IRawFileWorkspaceFolder } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IRawFileWorkspaceFolder, toWorkspaceFolders } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { isLinux, isWindows } from 'vs/base/common/platform';
|
||||
import { extUriBiasedIgnorePathCase } from 'vs/base/common/resources';
|
||||
|
||||
suite('Workspace', () => {
|
||||
|
||||
const fileFolder = isWindows ? 'c:\\src' : '/src';
|
||||
const abcFolder = isWindows ? 'c:\\abc' : '/abc';
|
||||
|
||||
const testFolderUri = URI.file(path.join(fileFolder, 'test'));
|
||||
const mainFolderUri = URI.file(path.join(fileFolder, 'main'));
|
||||
const test1FolderUri = URI.file(path.join(fileFolder, 'test1'));
|
||||
const test2FolderUri = URI.file(path.join(fileFolder, 'test2'));
|
||||
const test3FolderUri = URI.file(path.join(fileFolder, 'test3'));
|
||||
const abcTest1FolderUri = URI.file(path.join(abcFolder, 'test1'));
|
||||
const abcTest3FolderUri = URI.file(path.join(abcFolder, 'test3'));
|
||||
const testFolderUri = URI.file(join(fileFolder, 'test'));
|
||||
const mainFolderUri = URI.file(join(fileFolder, 'main'));
|
||||
const test1FolderUri = URI.file(join(fileFolder, 'test1'));
|
||||
const test2FolderUri = URI.file(join(fileFolder, 'test2'));
|
||||
const test3FolderUri = URI.file(join(fileFolder, 'test3'));
|
||||
const abcTest1FolderUri = URI.file(join(abcFolder, 'test1'));
|
||||
const abcTest3FolderUri = URI.file(join(abcFolder, 'test3'));
|
||||
|
||||
const workspaceConfigUri = URI.file(path.join(fileFolder, 'test.code-workspace'));
|
||||
const workspaceConfigUri = URI.file(join(fileFolder, 'test.code-workspace'));
|
||||
|
||||
test('getFolder returns the folder with given uri', () => {
|
||||
const expected = new WorkspaceFolder({ uri: testFolderUri, name: '', index: 2 });
|
||||
@@ -31,187 +32,187 @@ suite('Workspace', () => {
|
||||
|
||||
const actual = testObject.getFolder(expected.uri);
|
||||
|
||||
assert.equal(actual, expected);
|
||||
assert.strictEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('getFolder returns the folder if the uri is sub', () => {
|
||||
const expected = new WorkspaceFolder({ uri: testFolderUri, name: '', index: 0 });
|
||||
let testObject = new Workspace('', [expected, new WorkspaceFolder({ uri: mainFolderUri, name: '', index: 1 }), new WorkspaceFolder({ uri: URI.file('/src/code'), name: '', index: 2 })], null, () => !isLinux);
|
||||
|
||||
const actual = testObject.getFolder(URI.file(path.join(fileFolder, 'test/a')));
|
||||
const actual = testObject.getFolder(URI.file(join(fileFolder, 'test/a')));
|
||||
|
||||
assert.equal(actual, expected);
|
||||
assert.strictEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('getFolder returns the closest folder if the uri is sub', () => {
|
||||
const expected = new WorkspaceFolder({ uri: testFolderUri, name: '', index: 2 });
|
||||
let testObject = new Workspace('', [new WorkspaceFolder({ uri: mainFolderUri, name: '', index: 0 }), new WorkspaceFolder({ uri: URI.file('/src/code'), name: '', index: 1 }), expected], null, () => !isLinux);
|
||||
|
||||
const actual = testObject.getFolder(URI.file(path.join(fileFolder, 'test/a')));
|
||||
const actual = testObject.getFolder(URI.file(join(fileFolder, 'test/a')));
|
||||
|
||||
assert.equal(actual, expected);
|
||||
assert.strictEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('getFolder returns the folder even if the uri has query path', () => {
|
||||
const expected = new WorkspaceFolder({ uri: testFolderUri, name: '', index: 2 });
|
||||
let testObject = new Workspace('', [new WorkspaceFolder({ uri: mainFolderUri, name: '', index: 0 }), new WorkspaceFolder({ uri: URI.file('/src/code'), name: '', index: 1 }), expected], null, () => !isLinux);
|
||||
|
||||
const actual = testObject.getFolder(URI.file(path.join(fileFolder, 'test/a')).with({ query: 'somequery' }));
|
||||
const actual = testObject.getFolder(URI.file(join(fileFolder, 'test/a')).with({ query: 'somequery' }));
|
||||
|
||||
assert.equal(actual, expected);
|
||||
assert.strictEqual(actual, expected);
|
||||
});
|
||||
|
||||
test('getFolder returns null if the uri is not sub', () => {
|
||||
let testObject = new Workspace('', [new WorkspaceFolder({ uri: testFolderUri, name: '', index: 0 }), new WorkspaceFolder({ uri: URI.file('/src/code'), name: '', index: 1 })], null, () => !isLinux);
|
||||
|
||||
const actual = testObject.getFolder(URI.file(path.join(fileFolder, 'main/a')));
|
||||
const actual = testObject.getFolder(URI.file(join(fileFolder, 'main/a')));
|
||||
|
||||
assert.equal(actual, undefined);
|
||||
assert.strictEqual(actual, null);
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with single absolute folder', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 1);
|
||||
assert.equal(actual[0].uri.fsPath, testFolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test');
|
||||
assert.strictEqual(actual.length, 1);
|
||||
assert.strictEqual(actual[0].uri.fsPath, testFolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with single relative folder', () => {
|
||||
const actual = toWorkspaceFolders([{ path: './test' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: './test' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 1);
|
||||
assert.equal(actual[0].uri.fsPath, testFolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, './test');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test');
|
||||
assert.strictEqual(actual.length, 1);
|
||||
assert.strictEqual(actual[0].uri.fsPath, testFolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, './test');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with single absolute folder with name', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test', name: 'hello' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test', name: 'hello' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 1);
|
||||
assert.strictEqual(actual.length, 1);
|
||||
|
||||
assert.equal(actual[0].uri.fsPath, testFolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'hello');
|
||||
assert.strictEqual(actual[0].uri.fsPath, testFolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'hello');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with multiple unique absolute folders', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test3' }, { path: '/src/test1' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test3' }, { path: '/src/test1' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 3);
|
||||
assert.equal(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test2');
|
||||
assert.strictEqual(actual.length, 3);
|
||||
assert.strictEqual(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test2');
|
||||
|
||||
assert.equal(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test3');
|
||||
assert.equal(actual[1].index, 1);
|
||||
assert.equal(actual[1].name, 'test3');
|
||||
assert.strictEqual(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test3');
|
||||
assert.strictEqual(actual[1].index, 1);
|
||||
assert.strictEqual(actual[1].name, 'test3');
|
||||
|
||||
assert.equal(actual[2].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[2].raw).path, '/src/test1');
|
||||
assert.equal(actual[2].index, 2);
|
||||
assert.equal(actual[2].name, 'test1');
|
||||
assert.strictEqual(actual[2].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[2].raw).path, '/src/test1');
|
||||
assert.strictEqual(actual[2].index, 2);
|
||||
assert.strictEqual(actual[2].name, 'test1');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with multiple unique absolute folders with names', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test3', name: 'noName' }, { path: '/src/test1' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test3', name: 'noName' }, { path: '/src/test1' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 3);
|
||||
assert.equal(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test2');
|
||||
assert.strictEqual(actual.length, 3);
|
||||
assert.strictEqual(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test2');
|
||||
|
||||
assert.equal(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test3');
|
||||
assert.equal(actual[1].index, 1);
|
||||
assert.equal(actual[1].name, 'noName');
|
||||
assert.strictEqual(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test3');
|
||||
assert.strictEqual(actual[1].index, 1);
|
||||
assert.strictEqual(actual[1].name, 'noName');
|
||||
|
||||
assert.equal(actual[2].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[2].raw).path, '/src/test1');
|
||||
assert.equal(actual[2].index, 2);
|
||||
assert.equal(actual[2].name, 'test1');
|
||||
assert.strictEqual(actual[2].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[2].raw).path, '/src/test1');
|
||||
assert.strictEqual(actual[2].index, 2);
|
||||
assert.strictEqual(actual[2].name, 'test1');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with multiple unique absolute and relative folders', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/abc/test3', name: 'noName' }, { path: './test1' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/abc/test3', name: 'noName' }, { path: './test1' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 3);
|
||||
assert.equal(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test2');
|
||||
assert.strictEqual(actual.length, 3);
|
||||
assert.strictEqual(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test2');
|
||||
|
||||
assert.equal(actual[1].uri.fsPath, abcTest3FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[1].raw).path, '/abc/test3');
|
||||
assert.equal(actual[1].index, 1);
|
||||
assert.equal(actual[1].name, 'noName');
|
||||
assert.strictEqual(actual[1].uri.fsPath, abcTest3FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[1].raw).path, '/abc/test3');
|
||||
assert.strictEqual(actual[1].index, 1);
|
||||
assert.strictEqual(actual[1].name, 'noName');
|
||||
|
||||
assert.equal(actual[2].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[2].raw).path, './test1');
|
||||
assert.equal(actual[2].index, 2);
|
||||
assert.equal(actual[2].name, 'test1');
|
||||
assert.strictEqual(actual[2].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[2].raw).path, './test1');
|
||||
assert.strictEqual(actual[2].index, 2);
|
||||
assert.strictEqual(actual[2].name, 'test1');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with multiple absolute folders with duplicates', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test2', name: 'noName' }, { path: '/src/test1' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test2', name: 'noName' }, { path: '/src/test1' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 2);
|
||||
assert.equal(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test2');
|
||||
assert.strictEqual(actual.length, 2);
|
||||
assert.strictEqual(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test2');
|
||||
|
||||
assert.equal(actual[1].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test1');
|
||||
assert.equal(actual[1].index, 1);
|
||||
assert.equal(actual[1].name, 'test1');
|
||||
assert.strictEqual(actual[1].uri.fsPath, test1FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test1');
|
||||
assert.strictEqual(actual[1].index, 1);
|
||||
assert.strictEqual(actual[1].name, 'test1');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with multiple absolute and relative folders with duplicates', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test3', name: 'noName' }, { path: './test3' }, { path: '/abc/test1' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '/src/test3', name: 'noName' }, { path: './test3' }, { path: '/abc/test1' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 3);
|
||||
assert.equal(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test2');
|
||||
assert.strictEqual(actual.length, 3);
|
||||
assert.strictEqual(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test2');
|
||||
|
||||
assert.equal(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test3');
|
||||
assert.equal(actual[1].index, 1);
|
||||
assert.equal(actual[1].name, 'noName');
|
||||
assert.strictEqual(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[1].raw).path, '/src/test3');
|
||||
assert.strictEqual(actual[1].index, 1);
|
||||
assert.strictEqual(actual[1].name, 'noName');
|
||||
|
||||
assert.equal(actual[2].uri.fsPath, abcTest1FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[2].raw).path, '/abc/test1');
|
||||
assert.equal(actual[2].index, 2);
|
||||
assert.equal(actual[2].name, 'test1');
|
||||
assert.strictEqual(actual[2].uri.fsPath, abcTest1FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[2].raw).path, '/abc/test1');
|
||||
assert.strictEqual(actual[2].index, 2);
|
||||
assert.strictEqual(actual[2].name, 'test1');
|
||||
});
|
||||
|
||||
test('toWorkspaceFolders with multiple absolute and relative folders with invalid paths', () => {
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '', name: 'noName' }, { path: './test3' }, { path: '/abc/test1' }], workspaceConfigUri);
|
||||
const actual = toWorkspaceFolders([{ path: '/src/test2' }, { path: '', name: 'noName' }, { path: './test3' }, { path: '/abc/test1' }], workspaceConfigUri, extUriBiasedIgnorePathCase);
|
||||
|
||||
assert.equal(actual.length, 3);
|
||||
assert.equal(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.equal(actual[0].index, 0);
|
||||
assert.equal(actual[0].name, 'test2');
|
||||
assert.strictEqual(actual.length, 3);
|
||||
assert.strictEqual(actual[0].uri.fsPath, test2FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[0].raw).path, '/src/test2');
|
||||
assert.strictEqual(actual[0].index, 0);
|
||||
assert.strictEqual(actual[0].name, 'test2');
|
||||
|
||||
assert.equal(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[1].raw).path, './test3');
|
||||
assert.equal(actual[1].index, 1);
|
||||
assert.equal(actual[1].name, 'test3');
|
||||
assert.strictEqual(actual[1].uri.fsPath, test3FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[1].raw).path, './test3');
|
||||
assert.strictEqual(actual[1].index, 1);
|
||||
assert.strictEqual(actual[1].name, 'test3');
|
||||
|
||||
assert.equal(actual[2].uri.fsPath, abcTest1FolderUri.fsPath);
|
||||
assert.equal((<IRawFileWorkspaceFolder>actual[2].raw).path, '/abc/test1');
|
||||
assert.equal(actual[2].index, 2);
|
||||
assert.equal(actual[2].name, 'test1');
|
||||
assert.strictEqual(actual[2].uri.fsPath, abcTest1FolderUri.fsPath);
|
||||
assert.strictEqual((<IRawFileWorkspaceFolder>actual[2].raw).path, '/abc/test1');
|
||||
assert.strictEqual(actual[2].index, 2);
|
||||
assert.strictEqual(actual[2].name, 'test1');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user