Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import AdsTelemetryReporter from 'ads-extension-telemetry';
import * as Utils from './utils';
@@ -19,8 +18,3 @@ export enum TelemetryViews {
SsmsMinGsw = 'SsmsMinGsw',
SsmsMinDialog = 'SsmsMinDialog'
}

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export enum AgentDialogMode {
CREATE = 1,

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export class AzureResourceCredentialError extends Error {
constructor(
message: string,

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { NodeInfo } from 'azdata';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { extensions, TreeItem } from 'vscode';
import { Account } from 'azdata';
@@ -121,4 +119,4 @@ export class AzureResourceService {
this._treeDataProviders[resourceProvider.providerId] = resourceProvider.getTreeDataProvider();
}
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { NodeInfo } from 'azdata';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import * as nls from 'vscode-nls';
@@ -78,4 +76,4 @@ export class AzureResourceResourceTreeNode extends TreeNode {
return this.resourceNodeWithProviderId.resourceNode.treeItem.id;
}
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Event } from 'vscode';
import { Account, DidChangeAccountsParams } from 'azdata';
import { ApiWrapper } from '../../apiWrapper';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ExtensionContext } from 'vscode';
import { IAzureResourceCacheService } from '../interfaces';
@@ -31,4 +29,4 @@ export class AzureResourceCacheService implements IAzureResourceCacheService {
private _context: ExtensionContext = undefined;
private static readonly cacheKeyPrefix = 'azure.resource.cache';
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { WorkspaceConfiguration, ConfigurationTarget } from 'vscode';
import { Account } from 'azdata';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as request from 'request';
import { azureResource } from '../azure-resource';
@@ -29,4 +27,4 @@ export class AzureResourceTenantService implements IAzureResourceTenantService {
return await requestPromisified;
}
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { NodeInfo } from 'azdata';
import * as nls from 'vscode-nls';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TreeNode } from '../treeNode';
export interface IAzureResourceTreeChangeHandler {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TreeDataProvider, EventEmitter, Event, TreeItem } from 'vscode';
import * as azdata from 'azdata';
import { AppContext } from '../../appContext';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as vscode from 'vscode';
import 'mocha';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as vscode from 'vscode';
import 'mocha';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as TypeMoq from 'typemoq';
import * as azdata from 'azdata';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as should from 'should';
import * as TypeMoq from 'typemoq';

View File

@@ -11,7 +11,7 @@
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
{ "open": "\"", "close": "\"", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import { ApiWrapper } from './apiWrapper';
import { CmsUtils } from './cmsUtils';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import CmsResourceController from './controllers/cmsResourceController';
import { AppContext } from './appContext';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as vscode from 'vscode';
import 'mocha';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as TypeMoq from 'typemoq';
import * as should from 'should';
import * as vscode from 'vscode';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as TypeMoq from 'typemoq';
import * as should from 'should';
import * as vscode from 'vscode';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as TypeMoq from 'typemoq';
import * as should from 'should';
import * as vscode from 'vscode';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as should from 'should';
import * as vscode from 'vscode';
import 'mocha';

View File

@@ -40,7 +40,9 @@
"type": "array",
"description": "An array of extensions that should be installed into the container.",
"items": {
"type": "string"
"type": "string",
"pattern": "^([a-z0-9A-Z][a-z0-9\\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\\-A-Z]*)$",
"errorMessage": "Expected format '${publisher}.${name}'. Example: 'vscode.csharp'."
}
}
}

View File

@@ -15,7 +15,9 @@
"type": "array",
"description": "An array of extensions that should be installed into the container.",
"items": {
"type": "string"
"type": "string",
"pattern": "^([a-z0-9A-Z][a-z0-9\\-A-Z]*)\\.([a-z0-9A-Z][a-z0-9\\-A-Z]*)$",
"errorMessage": "Expected format '${publisher}.${name}'. Example: 'vscode.csharp'."
}
},
"settings": {

View File

@@ -34,7 +34,11 @@ export class SettingsDocument {
// files.defaultLanguage
if (location.path[0] === 'files.defaultLanguage') {
return this.provideLanguageCompletionItems(location, range);
return this.provideLanguageCompletionItems(location, range).then(items => {
// Add special item '${activeEditorLanguage}'
return [this.newSimpleCompletionItem(JSON.stringify('${activeEditorLanguage}'), range, localize('activeEditor', "Use the language of the currently active text editor if any")), ...items];
});
}
return this.provideLanguageOverridesCompletionItems(location, position);
@@ -153,7 +157,7 @@ export class SettingsDocument {
return Promise.resolve(completions);
}
private provideLanguageCompletionItems(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): vscode.ProviderResult<vscode.CompletionItem[]> {
private provideLanguageCompletionItems(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): Thenable<vscode.CompletionItem[]> {
return vscode.languages.getLanguages().then(languages => {
const completionItems = [];
const configuration = vscode.workspace.getConfiguration();

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
export default abstract class ControllerBase implements vscode.Disposable {
@@ -26,4 +24,3 @@ export default abstract class ControllerBase implements vscode.Disposable {
this.deactivate();
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import ControllerBase from './controllerBase';
import * as vscode from 'vscode';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import ControllerBase from './controllers/controllerBase';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'mocha';
import * as should from 'should';
@@ -110,4 +109,4 @@ describe('Check for invalid filename tests', function (): void {
function formatFileName(filename: string): string {
return path.join(os.tmpdir(), filename);
}
}

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
import * as vscode from 'vscode';

View File

@@ -1367,7 +1367,10 @@
"default": false
},
"git.defaultCloneDirectory": {
"type": "string",
"type": [
"string",
"null"
],
"default": null,
"description": "%config.defaultCloneDirectory%"
},

View File

@@ -1580,7 +1580,7 @@ export class CommandCenter {
await this._branch(repository, undefined, true);
}
private async promptForBranchName(defaultName?: string): Promise<string> {
private async promptForBranchName(defaultName?: string, initialValue?: string): Promise<string> {
const config = workspace.getConfiguration('git');
const branchWhitespaceChar = config.get<string>('branchWhitespaceChar')!;
const branchValidationRegex = config.get<string>('branchValidationRegex')!;
@@ -1591,6 +1591,7 @@ export class CommandCenter {
const rawBranchName = defaultName || await window.showInputBox({
placeHolder: localize('branch name', "Branch name"),
prompt: localize('provide branch name', "Please provide a branch name"),
value: initialValue,
ignoreFocusOut: true,
validateInput: (name: string) => {
const validateName = new RegExp(branchValidationRegex);
@@ -1668,7 +1669,8 @@ export class CommandCenter {
@command('git.renameBranch', { repository: true })
async renameBranch(repository: Repository): Promise<void> {
const branchName = await this.promptForBranchName();
const currentBranchName = repository.HEAD && repository.HEAD.name;
const branchName = await this.promptForBranchName(undefined, currentBranchName);
if (!branchName) {
return;

View File

@@ -8,6 +8,7 @@ import { debounce, throttle } from './decorators';
import { fromGitUri, toGitUri } from './uri';
import { Model, ModelChangeEvent, OriginalResourceChangeEvent } from './model';
import { filterEvent, eventToPromise, isDescendant, pathEquals, EmptyDisposable } from './util';
import { Repository } from './repository';
interface CacheRow {
uri: Uri;
@@ -17,6 +18,21 @@ interface CacheRow {
const THREE_MINUTES = 1000 * 60 * 3;
const FIVE_MINUTES = 1000 * 60 * 5;
function sanitizeRef(ref: string, path: string, repository: Repository): string {
if (ref === '~') {
const fileUri = Uri.file(path);
const uriString = fileUri.toString();
const [indexStatus] = repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString);
return indexStatus ? '' : 'HEAD';
}
if (/^~\d$/.test(ref)) {
return `:${ref[1]}`;
}
return ref;
}
export class GitFileSystemProvider implements FileSystemProvider {
private _onDidChangeFile = new EventEmitter<FileChangeEvent[]>();
@@ -116,15 +132,21 @@ export class GitFileSystemProvider implements FileSystemProvider {
return EmptyDisposable;
}
stat(uri: Uri): FileStat {
const { submoduleOf } = fromGitUri(uri);
async stat(uri: Uri): Promise<FileStat> {
const { submoduleOf, path, ref } = fromGitUri(uri);
const repository = submoduleOf ? this.model.getRepository(submoduleOf) : this.model.getRepository(uri);
if (!repository) {
throw FileSystemError.FileNotFound();
}
return { type: FileType.File, size: 0, mtime: this.mtime, ctime: 0 };
let size = 0;
try {
const details = await repository.getObjectDetails(sanitizeRef(ref, path, repository), path);
size = details.size;
} catch {
// noop
}
return { type: FileType.File, size: size, mtime: this.mtime, ctime: 0 };
}
readDirectory(): Thenable<[string, FileType][]> {
@@ -136,7 +158,7 @@ export class GitFileSystemProvider implements FileSystemProvider {
}
async readFile(uri: Uri): Promise<Uint8Array> {
let { path, ref, submoduleOf } = fromGitUri(uri);
const { path, ref, submoduleOf } = fromGitUri(uri);
if (submoduleOf) {
const repository = this.model.getRepository(submoduleOf);
@@ -165,17 +187,8 @@ export class GitFileSystemProvider implements FileSystemProvider {
this.cache.set(uri.toString(), cacheValue);
if (ref === '~') {
const fileUri = Uri.file(path);
const uriString = fileUri.toString();
const [indexStatus] = repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString);
ref = indexStatus ? '' : 'HEAD';
} else if (/^~\d$/.test(ref)) {
ref = `:${ref[1]}`;
}
try {
return await repository.buffer(ref, path);
return await repository.buffer(sanitizeRef(ref, path, repository), path);
} catch (err) {
return new Uint8Array(0);
}

View File

@@ -1721,7 +1721,7 @@ export class Repository implements Disposable {
if (branchName) {
// '{0}' will be replaced by the corresponding key-command later in the process, which is why it needs to stay.
this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", "{0}", branchName);
this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", '{0}', branchName);
} else {
this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message ({0} to commit)");
}

View File

@@ -94,16 +94,16 @@ body img {
}
.loading-indicator,
.image-load-error-message {
.image-load-error {
display: none;
}
.loading .loading-indicator,
.error .image-load-error-message {
.error .image-load-error {
display: block;
}
.image-load-error-message {
.image-load-error {
margin: 1em;
}

View File

@@ -305,6 +305,12 @@
image.src = settings.src;
document.querySelector('.open-file-link').addEventListener('click', () => {
vscode.postMessage({
type: 'reopen-as-text',
});
});
window.addEventListener('message', e => {
switch (e.data.type) {
case 'setScale':

View File

@@ -73,6 +73,8 @@ class Preview extends Disposable {
private _imageBinarySize: number | undefined;
private _imageZoom: Scale | undefined;
private readonly emptyPngDataUri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg==';
constructor(
private readonly extensionRoot: vscode.Uri,
private readonly resource: vscode.Uri,
@@ -108,6 +110,12 @@ class Preview extends Disposable {
this.update();
break;
}
case 'reopen-as-text':
{
vscode.commands.executeCommand('vscode.openWith', resource, 'default', webviewEditor.viewColumn);
break;
}
}
}));
@@ -165,9 +173,9 @@ class Preview extends Disposable {
}
}
private render() {
private async render() {
if (this._previewState !== PreviewState.Disposed) {
this.webviewEditor.webview.html = this.getWebiewContents();
this.webviewEditor.webview.html = await this.getWebiewContents();
}
}
@@ -191,11 +199,11 @@ class Preview extends Disposable {
}
}
private getWebiewContents(): string {
private async getWebiewContents(): Promise<string> {
const version = Date.now().toString();
const settings = {
isMac: process.platform === 'darwin',
src: this.getResourcePath(this.webviewEditor, this.resource, version),
src: await this.getResourcePath(this.webviewEditor, this.resource, version),
};
const nonce = Date.now().toString();
@@ -218,28 +226,28 @@ class Preview extends Disposable {
</head>
<body class="container image scale-to-fit loading">
<div class="loading-indicator"></div>
<div class="image-load-error-message">${localize('preview.imageLoadError', "An error occurred while loading the image")}</div>
<div class="image-load-error">
<p>${localize('preview.imageLoadError', "An error occurred while loading the image.")}</p>
<a href="#" class="open-file-link">${localize('preview.imageLoadErrorLink', "Open file using VS Code's standard text/binary editor?")}</a>
</div>
<script src="${escapeAttribute(this.extensionResource('/media/main.js'))}" nonce="${nonce}"></script>
</body>
</html>`;
}
private getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string) {
switch (resource.scheme) {
case 'data':
return resource.toString(true);
case 'git':
// Show blank image
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAEElEQVR42gEFAPr/AP///wAI/AL+Sr4t6gAAAABJRU5ErkJggg==';
default:
// Avoid adding cache busting if there is already a query string
if (resource.query) {
return webviewEditor.webview.asWebviewUri(resource).toString(true);
}
return webviewEditor.webview.asWebviewUri(resource).with({ query: `version=${version}` }).toString(true);
private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise<string> {
if (resource.scheme === 'gitfs') {
const stat = await vscode.workspace.fs.stat(resource);
if (stat.size === 0) {
return this.emptyPngDataUri;
}
}
// Avoid adding cache busting if there is already a query string
if (resource.query) {
return webviewEditor.webview.asWebviewUri(resource).toString(true);
}
return webviewEditor.webview.asWebviewUri(resource).with({ query: `version=${version}` }).toString(true);
}
private extensionResource(path: string) {

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export const extensionConfigSectionName = 'flatFileImport';
export const serviceName = 'Flat File Import Service';
@@ -11,4 +10,3 @@ export const configLogDebugInfo = 'logDebugInfo';
export const sqlConfigSectionName = 'sql';
export const serviceCrashLink = 'https://github.com/Microsoft/azuredatastudio/issues/2090';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
export default abstract class ControllerBase implements vscode.Disposable {
@@ -26,4 +24,3 @@ export default abstract class ControllerBase implements vscode.Disposable {
this.deactivate();
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as constants from '../constants';
import * as azdata from 'azdata';
import ControllerBase from './controllerBase';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import ControllerBase from './controllers/controllerBase';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ImportDataModel } from './models';
import * as azdata from 'azdata';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import * as azdata from 'azdata';
@@ -133,6 +134,3 @@ export class FlatFileWizard {
}

View File

@@ -3,7 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
import { ColumnMetadata, ImportDataModel } from '../api/models';

View File

@@ -14,6 +14,7 @@ import * as vscode from 'vscode';
import { isTestSetupCompleted } from './testContext';
import { getStandaloneServer } from './testConfig';
import * as assert from 'assert';
import { promisify } from 'util';
const retryCount = 24; // 2 minutes
const dacpac1: string = path.join(__dirname, '../testData/Database1.dacpac');
@@ -56,8 +57,8 @@ if (isTestSetupCompleted()) {
// Extract dacpac
const folderPath = path.join(os.tmpdir(), 'DacFxTest');
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const packageFilePath = path.join(folderPath, `${databaseName}.dacpac`);
const extractResult = await dacfxService.extractDacpac(databaseName, packageFilePath, databaseName, '1.0.0.0', ownerUri, azdata.TaskExecutionMode.execute);
@@ -102,8 +103,8 @@ if (isTestSetupCompleted()) {
// Export bacpac
const folderPath = path.join(os.tmpdir(), 'DacFxTest');
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const packageFilePath = path.join(folderPath, `${databaseName}.bacpac`);
const exportResult = await dacfxService.exportBacpac(databaseName, packageFilePath, ownerUri, azdata.TaskExecutionMode.execute);

View File

@@ -19,6 +19,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('test.setupIntegrationTest', async () => {
let extensionInstallersFolder = normalize(join(__dirname, '../extensionInstallers'));
console.info(`extensionInstallersFolder=${extensionInstallersFolder}`);
// eslint-disable-next-line no-sync
let installers = fs.readdirSync(extensionInstallersFolder);
for (let i = 0; i < installers.length; i++) {
if (installers[i].endsWith('.vsix')) {

View File

@@ -13,7 +13,7 @@ import { getConfigValue, EnvironmentVariable_PYTHON_PATH, TestServerProfile, get
import { connectToServer, sleep, testServerProfileToIConnectionProfile } from './utils';
import * as fs from 'fs';
import { stressify } from 'adstest';
import { isNullOrUndefined } from 'util';
import { isNullOrUndefined, promisify } from 'util';
if (isTestSetupCompleted()) {
suite('Notebook integration test suite', function () {
@@ -375,8 +375,8 @@ class NotebookTester {
async cleanup(testName: string): Promise<void> {
try {
let fileName = getFileName(testName + this.invocationCount++);
if (fs.existsSync(fileName)) {
fs.unlinkSync(fileName);
if (await promisify(fs.exists)(fileName)) {
await fs.promises.unlink(fileName);
console.log(`"${fileName}" is deleted.`);
}
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');

View File

@@ -164,6 +164,7 @@ export const pythonKernelSpec: azdata.nb.IKernelSpec = {
export function writeNotebookToFile(pythonNotebook: azdata.nb.INotebookContents, testName: string): vscode.Uri {
let fileName = getFileName(testName);
let notebookContentString = JSON.stringify(pythonNotebook);
// eslint-disable-next-line no-sync
fs.writeFileSync(fileName, notebookContentString);
console.log(`Local file is created: '${fileName}'`);
let uri = vscode.Uri.file(fileName);

View File

@@ -15,6 +15,7 @@ import { isTestSetupCompleted } from './testContext';
import * as assert from 'assert';
import { getStandaloneServer } from './testConfig';
import { stressify } from 'adstest';
import { promisify } from 'util';
let schemaCompareService: mssql.ISchemaCompareService;
let dacfxService: mssql.IDacFxService;
@@ -91,12 +92,12 @@ class SchemaCompareTester {
// save to scmp
const filepath = path.join(folderPath, `ads_schemaCompare_${now.getTime().toString()}.scmp`);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const saveScmpResult = await schemaCompareService.schemaCompareSaveScmp(source, target, azdata.TaskExecutionMode.execute, null, filepath, [], []);
assert(saveScmpResult.success && !saveScmpResult.errorMessage, `Save scmp should succeed. Expected: there should be no error. Actual Error message: "${saveScmpResult.errorMessage}`);
assert(fs.existsSync(filepath), `File ${filepath} is expected to be present`);
assert(await promisify(fs.exists)(filepath), `File ${filepath} is expected to be present`);
// open scmp
const openScmpResult = await schemaCompareService.schemaCompareOpenScmp(filepath);
@@ -165,12 +166,12 @@ class SchemaCompareTester {
// save to scmp
const filepath = path.join(folderPath, `ads_schemaCompare_${now.getTime().toString()}.scmp`);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const saveScmpResult = await schemaCompareService.schemaCompareSaveScmp(source, target, azdata.TaskExecutionMode.execute, null, filepath, [], []);
assert(saveScmpResult.success && !saveScmpResult.errorMessage, `Save scmp should succeed. Expected: there should be no error. Actual Error message: "${saveScmpResult.errorMessage}`);
assert(fs.existsSync(filepath), `File ${filepath} is expected to be present`);
assert(promisify(fs.exists)(filepath), `File ${filepath} is expected to be present`);
// open scmp
const openScmpResult = await schemaCompareService.schemaCompareOpenScmp(filepath);
@@ -178,7 +179,7 @@ class SchemaCompareTester {
assert(openScmpResult.sourceEndpointInfo.databaseName === source.databaseName, `Expected: source database to be ${source.databaseName}, Actual: ${openScmpResult.sourceEndpointInfo.databaseName}`);
assert(openScmpResult.targetEndpointInfo.databaseName === target.databaseName, `Expected: target database to be ${target.databaseName}, Actual: ${openScmpResult.targetEndpointInfo.databaseName}`);
fs.unlinkSync(filepath);
await fs.promises.unlink(filepath);
}
finally {
await utils.deleteDB(server, sourceDB, ownerUri);
@@ -237,12 +238,12 @@ class SchemaCompareTester {
// save to scmp
const filepath = path.join(folderPath, `ads_schemaCompare_${now.getTime().toString()}.scmp`);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const saveScmpResult = await schemaCompareService.schemaCompareSaveScmp(source, target, azdata.TaskExecutionMode.execute, null, filepath, [], []);
assert(saveScmpResult.success && !saveScmpResult.errorMessage, `Save scmp should succeed. Expected: there should be no error. Actual Error message: "${saveScmpResult.errorMessage}`);
assert(fs.existsSync(filepath), `File ${filepath} is expected to be present`);
assert(await promisify(fs.exists)(filepath), `File ${filepath} is expected to be present`);
// open scmp
const openScmpResult = await schemaCompareService.schemaCompareOpenScmp(filepath);

View File

@@ -8,7 +8,7 @@ import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as fs from 'fs';
import { TestServerProfile, TestConnectionInfo } from './testConfig';
import { isNullOrUndefined } from 'util';
import { isNullOrUndefined, promisify } from 'util';
// default server connection timeout
export const DefaultConnectTimeoutInMs: number = 10000;
@@ -217,13 +217,13 @@ export async function assertFileGenerationResult(filepath: string, retryCount: n
let exists = false;
while (retryCount > 0 && !exists) {
--retryCount;
exists = fs.existsSync(filepath);
exists = await promisify(fs.exists)(filepath);
await sleep(5000);
}
assert(exists, `File ${filepath} is expected to be present`);
assert(fs.readFileSync(filepath).byteLength > 0, 'File ${filepath} should not be empty');
fs.unlinkSync(filepath);
assert((await fs.promises.readFile(filepath)).byteLength > 0, 'File ${filepath} should not be empty');
await fs.promises.unlink(filepath);
}
/**

View File

@@ -149,9 +149,8 @@ export function activate(context: ExtensionContext) {
provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult<CompletionItem[] | CompletionList> {
function updateRanges(item: CompletionItem) {
const range = item.range;
if (range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) {
item.range2 = { inserting: new Range(range.start, position), replacing: range };
item.range = undefined;
if (range instanceof Range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) {
item.range = { inserting: new Range(range.start, position), replacing: range };
}
}
function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined {

View File

@@ -9,7 +9,7 @@
const withDefaults = require('../shared.webpack.config');
const path = require('path');
var webpack = require('webpack');
const webpack = require('webpack');
const config = withDefaults({
context: path.join(__dirname, 'client'),
@@ -25,4 +25,4 @@ const config = withDefaults({
// add plugin, don't replace inherited
config.plugins.push(new webpack.IgnorePlugin(/vertx/)); // request-light dependency
module.exports = config;
module.exports = config;

View File

@@ -9,7 +9,7 @@
const withDefaults = require('../../shared.webpack.config');
const path = require('path');
var webpack = require('webpack');
const webpack = require('webpack');
const config = withDefaults({
context: path.join(__dirname),

View File

@@ -11,7 +11,7 @@ import { ConnectionProvider } from './providers/connectionProvider';
import { StatusProvider, LiveShareDocumentState } from './providers/statusProvider';
import { QueryProvider } from './providers/queryProvider';
declare var require: any;
declare let require: any;
let vsls = require('vsls');
export class GuestSessionManager {

View File

@@ -10,7 +10,7 @@ import { QueryProvider } from './providers/queryProvider';
import { StatusProvider } from './providers/statusProvider';
import { LiveShareServiceName } from './constants';
declare var require: any;
declare let require: any;
let vsls = require('vsls');
export class HostSessionManager {

View File

@@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import { GuestSessionManager } from './guestSessionManager';
import { HostSessionManager } from './hostSessionManager';
declare var require: any;
declare let require: any;
let vsls = require('vsls');
export async function activate(context: vscode.ExtensionContext) {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as childProcess from 'child_process';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as nbExtensionApis from '../typings/notebookServices';
import { ApiWrapper } from './apiWrapper';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
import * as path from 'path';
import * as os from 'os';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as nbExtensionApis from '../typings/notebookServices';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import MainController from './controllers/mainController';
import { ApiWrapper } from './common/apiWrapper';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import * as nbExtensionApis from '../typings/notebookServices';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import * as nbExtensionApis from '../typings/notebookServices';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import { ProcessService } from '../../common/processService';
import * as utils from '../../common/utils';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as should from 'should';
import 'mocha';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as should from 'should';
@@ -207,5 +205,3 @@ describe('Package Manager', () => {
return packageManager;
}
});

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as should from 'should';
import 'mocha';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as should from 'should';
import 'mocha';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import * as azdata from 'azdata';
import * as TypeMoq from 'typemoq';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import { ApiWrapper } from '../common/apiWrapper';
import * as TypeMoq from 'typemoq';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import { QueryRunner } from '../../common/queryRunner';
import { ApiWrapper } from '../../common/apiWrapper';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const _typeof = {
undefined: 'undefined'

View File

@@ -10,7 +10,7 @@ import { getEditorLineNumberForPageOffset, scrollToRevealSourceLine, getLineElem
import { getSettings, getData } from './settings';
import throttle = require('lodash.throttle');
declare var acquireVsCodeApi: any;
declare let acquireVsCodeApi: any;
let scrollDisabled = true;
const marker = new ActiveLineMarker();

View File

@@ -49,10 +49,7 @@ function registerMarkdownLanguageFeatures(
symbolProvider: MDDocumentSymbolProvider,
engine: MarkdownEngine
): vscode.Disposable {
const selector: vscode.DocumentSelector = [
{ language: 'markdown', scheme: 'file' },
{ language: 'markdown', scheme: 'untitled' }
];
const selector: vscode.DocumentSelector = { language: 'markdown', scheme: '*' };
const charPattern = '(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import { ApiWrapper } from './apiWrapper';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export const serviceName = 'SQL Tools Service';
export const providerId = 'MSSQL';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export const serviceName = 'SerilizationProvider';
export const providerId = 'serilizationProvider';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { RequestType } from 'vscode-languageclient';
import { Credential } from 'azdata';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as constants from './constants';
@@ -25,4 +23,4 @@ export class MssqlIconProvider implements azdata.IconProvider {
}
return Promise.resolve(iconName);
}
}
}

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Transform } from 'stream';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as constants from '../constants';
export abstract class ProviderBase {

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { ITreeNode } from './types';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as nls from 'vscode-nls';
import * as fspath from 'path';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import * as constants from './constants';
import * as UUID from 'vscode-languageclient/lib/utils/uuid';

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
const _typeof = {
number: 'number',

View File

@@ -83,7 +83,7 @@ export class BookTreeItem extends vscode.TreeItem {
if (this.book.tableOfContents.sections[i].url) {
// TODO: Currently only navigating to notebooks. Need to add logic for markdown.
let pathToNotebook = path.join(this.book.root, 'content', this.book.tableOfContents.sections[i].url.concat('.ipynb'));
// tslint:disable-next-line:no-sync
// eslint-disable-next-line no-sync
if (fs.existsSync(pathToNotebook)) {
this._previousUri = pathToNotebook;
return;
@@ -99,7 +99,7 @@ export class BookTreeItem extends vscode.TreeItem {
if (this.book.tableOfContents.sections[i].url) {
// TODO: Currently only navigating to notebooks. Need to add logic for markdown.
let pathToNotebook = path.join(this.book.root, 'content', this.book.tableOfContents.sections[i].url.concat('.ipynb'));
// tslint:disable-next-line:no-sync
// eslint-disable-next-line no-sync
if (fs.existsSync(pathToNotebook)) {
this._nextUri = pathToNotebook;
return;

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
import { ApiWrapper } from './apiWrapper';

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
@@ -34,6 +32,3 @@ export function openNotebookError(resource: string, error: string): string { ret
export function openMarkdownError(resource: string, error: string): string { return localize('openMarkdownError', "Open markdown {0} failed: {1}", resource, error); }
export function openUntitledNotebookError(resource: string, error: string): string { return localize('openUntitledNotebookError', "Open untitled notebook {0} as untitled failed: {1}", resource, error); }
export function openExternalLinkError(resource: string, error: string): string { return localize('openExternalLinkError', "Open link {0} failed: {1}", resource, error); }

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as crypto from 'crypto';
/**

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
/**
* Deferred promise

View File

@@ -3,8 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export interface INotebook {
readonly cells: ICell[];

Some files were not shown because too many files have changed in this diff Show More