SQL Operations Studio Public Preview 1 (0.23) release source code

This commit is contained in:
Karl Burtram
2017-11-09 14:30:27 -08:00
parent b88ecb8d93
commit 3cdac41339
8829 changed files with 759707 additions and 286 deletions

View File

@@ -0,0 +1,2 @@
out
node_modules

View File

@@ -0,0 +1,17 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["${workspaceRoot}/../../", "${workspaceRoot}/test", "--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out",
"preLaunchTask": "npm"
}
]
}

View File

@@ -0,0 +1,31 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${relativeFile}: the current opened file relative to cwd
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",
// we want to run npm
"command": "npm",
// the command is a shell script
"isShellCommand": true,
// show the output window only if unrecognized errors occur.
"showOutput": "silent",
// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],
// The tsc compiler is started in watching mode
"isWatching": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}

View File

@@ -0,0 +1,19 @@
{
"name": "vscode-colorize-tests",
"description": "Colorize tests for VS Code",
"version": "0.0.1",
"publisher": "vscode",
"private": true,
"engines": {
"vscode": "*"
},
"scripts": {
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json",
"postinstall": "node ./node_modules/vscode/bin/install"
},
"devDependencies": {
"@types/mocha": "^2.2.38",
"@types/node": "^7.0.4",
"vscode": "1.0.1"
}
}

View File

@@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------------------------
* 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 assert from 'assert';
import { commands, Uri } from 'vscode';
import { join, basename, normalize, dirname } from 'path';
import * as fs from 'fs';
function assertUnchangedTokens(testFixurePath: string, done) {
let fileName = basename(testFixurePath);
return commands.executeCommand('_workbench.captureSyntaxTokens', Uri.file(testFixurePath)).then(data => {
try {
let resultsFolderPath = join(dirname(dirname(testFixurePath)), 'colorize-results');
if (!fs.existsSync(resultsFolderPath)) {
fs.mkdirSync(resultsFolderPath);
}
let resultPath = join(resultsFolderPath, fileName.replace('.', '_') + '.json');
if (fs.existsSync(resultPath)) {
let previousData = JSON.parse(fs.readFileSync(resultPath).toString());
try {
assert.deepEqual(data, previousData);
} catch (e) {
fs.writeFileSync(resultPath, JSON.stringify(data, null, '\t'), { flag: 'w' });
if (Array.isArray(data) && Array.isArray(previousData) && data.length === previousData.length) {
for (let i= 0; i < data.length; i++) {
let d = data[i];
let p = previousData[i];
if (d.c !== p.c || hasThemeChange(d.r, p.r)) {
throw e;
}
}
// different but no tokenization ot color change: no failure
} else {
throw e;
}
}
} else {
fs.writeFileSync(resultPath, JSON.stringify(data, null, '\t'));
}
done();
} catch (e) {
done(e);
}
}, done);
}
function hasThemeChange(d: any, p: any) : boolean {
let keys = Object.keys(d);
for (let key of keys) {
if (d[key] !== p[key]) {
return true;
}
}
return false;
};
suite('colorization', () => {
let extensionsFolder = normalize(join(__dirname, '../../'));
let extensions = fs.readdirSync(extensionsFolder);
extensions.forEach(extension => {
let extensionColorizeFixturePath = join(extensionsFolder, extension, 'test', 'colorize-fixtures');
if (fs.existsSync(extensionColorizeFixturePath)) {
let fixturesFiles = fs.readdirSync(extensionColorizeFixturePath);
fixturesFiles.forEach(fixturesFile => {
// define a test for each fixture
test(extension + '-' + fixturesFile, function (done) {
assertUnchangedTokens(join(extensionColorizeFixturePath, fixturesFile), done);
});
});
}
});
});

View File

@@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
//
// This file is providing the test runner to use when running extension tests.
// By default the test runner in use is Mocha based.
//
// You can provide your own test runner if you want to override it by exporting
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
// host can call to run the tests. The test runner is expected to use console.log
// to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none.
const testRunner = require('vscode/lib/testrunner');
// You can directly control Mocha options by uncommenting the following lines
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: process.platform !== 'win32', // colored output from test results (only windows cannot handle)
timeout: 60000
});
export = testRunner;

View File

@@ -0,0 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference types='@types/mocha'/>
/// <reference types='@types/node'/>

View File

@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"outDir": "out",
"lib": [
"es2015"
],
"sourceMap": true
},
"include": [
"src/**/*"
]
}