mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 17:22:42 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import assert = require('assert');
|
||||
import path = require('path');
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'path';
|
||||
import { findBestWindowOrFolderForFile, ISimpleWindow, IBestWindowOrFolderOptions } from 'vs/code/node/windowsFinder';
|
||||
import { OpenContext } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
@@ -48,25 +48,22 @@ suite('WindowsFinder', () => {
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt'),
|
||||
newWindow: true // We assume this implies 'editor' work mode, might need separate CLI option later.
|
||||
newWindow: true
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt'),
|
||||
reuseWindow: true // We assume this implies 'editor' work mode, might need separate CLI option later.
|
||||
reuseWindow: true
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt'),
|
||||
context: OpenContext.API
|
||||
})), null);
|
||||
});
|
||||
|
||||
test('New window with folder when no windows exist', () => {
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt')
|
||||
})), path.join(fixturesFolder, 'vscode_folder'));
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'new_folder', 'new_file.txt')
|
||||
})), path.join(fixturesFolder, 'vscode_folder'));
|
||||
})), null);
|
||||
});
|
||||
|
||||
test('New window without folder when windows exist', () => {
|
||||
@@ -106,19 +103,11 @@ suite('WindowsFinder', () => {
|
||||
windows,
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt')
|
||||
})), vscodeFolderWindow);
|
||||
});
|
||||
|
||||
test('Existing window wins over vscode folder if more specific', () => {
|
||||
const window = { lastFocusTime: 1, openedFolderPath: path.join(fixturesFolder, 'vscode_folder', 'nested_folder') };
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
windows: [window],
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'nested_folder', 'subfolder', 'file.txt')
|
||||
})), window);
|
||||
// check
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
windows: [window],
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'nested_folder2', 'subfolder', 'file.txt')
|
||||
})), path.join(fixturesFolder, 'vscode_folder'));
|
||||
});
|
||||
|
||||
test('More specific existing window wins', () => {
|
||||
@@ -130,37 +119,6 @@ suite('WindowsFinder', () => {
|
||||
})), nestedFolderWindow);
|
||||
});
|
||||
|
||||
test('VSCode folder wins over existing window if more specific', () => {
|
||||
const window = { lastFocusTime: 1, openedFolderPath: path.join(fixturesFolder, 'vscode_folder') };
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
windows: [window],
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'nested_vscode_folder', 'subfolder', 'file.txt')
|
||||
})), path.join(fixturesFolder, 'vscode_folder', 'nested_vscode_folder'));
|
||||
// check
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
windows: [window],
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'nested_folder', 'subfolder', 'file.txt')
|
||||
})), window);
|
||||
});
|
||||
|
||||
test('More specific VSCode folder wins', () => {
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'nested_vscode_folder', 'subfolder', 'file.txt')
|
||||
})), path.join(fixturesFolder, 'vscode_folder', 'nested_vscode_folder'));
|
||||
});
|
||||
|
||||
test('VSCode folder in home folder needs settings.json', () => {
|
||||
// Because ~/.vscode/extensions is used for extensions, ~/.vscode is not enough as a hint.
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt'),
|
||||
userHome: path.join(fixturesFolder, 'vscode_folder')
|
||||
})), null);
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
filePath: path.join(fixturesFolder, 'vscode_home_folder', 'file.txt'),
|
||||
userHome: path.join(fixturesFolder, 'vscode_home_folder')
|
||||
})), path.join(fixturesFolder, 'vscode_home_folder'));
|
||||
});
|
||||
|
||||
test('Workspace folder wins', () => {
|
||||
const window = { lastFocusTime: 1, openedWorkspace: testWorkspace };
|
||||
assert.equal(findBestWindowOrFolderForFile(options({
|
||||
|
||||
Reference in New Issue
Block a user