mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)
* Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d * Fix vs unit tests and hygiene issue * Fix strict null check issue
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.12.21",
|
||||
"@types/node": "^10.14.8",
|
||||
"vscode": "1.1.5"
|
||||
},
|
||||
"contributes": {
|
||||
|
||||
@@ -26,10 +26,11 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
progress.report({ message: 'Starting Test Resolver' });
|
||||
outputChannel = vscode.window.createOutputChannel('TestResolver');
|
||||
|
||||
let isStarted = false;
|
||||
let isResolved = false;
|
||||
async function processError(message: string) {
|
||||
outputChannel.appendLine(message);
|
||||
if (!isStarted) {
|
||||
if (!isResolved) {
|
||||
isResolved = true;
|
||||
outputChannel.show();
|
||||
|
||||
const result = await vscode.window.showErrorMessage(message, { modal: true }, ...getActions());
|
||||
@@ -48,7 +49,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
if (chr === CharCode.LineFeed) {
|
||||
const match = lastProgressLine.match(/Extension host agent listening on (\d+)/);
|
||||
if (match) {
|
||||
isStarted = true;
|
||||
isResolved = true;
|
||||
res(new vscode.ResolvedAuthority('localhost', parseInt(match[1], 10))); // success!
|
||||
}
|
||||
lastProgressLine = '';
|
||||
@@ -65,47 +66,30 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { updateUrl, commit, quality } = getProductConfiguration();
|
||||
const { updateUrl, commit, quality, serverDataFolderName, dataFolderName } = getProductConfiguration();
|
||||
const serverCommand = process.platform === 'win32' ? 'server.bat' : 'server.sh';
|
||||
const commandArgs = ['--port=0', '--disable-telemetry'];
|
||||
const env = getNewEnv();
|
||||
const remoteDataDir = process.env['TESTRESOLVER_DATA_FOLDER'] || path.join(os.homedir(), serverDataFolderName || `${dataFolderName}-testresolver`);
|
||||
env['VSCODE_AGENT_FOLDER'] = remoteDataDir;
|
||||
outputChannel.appendLine(`Using data folder at ${remoteDataDir}`);
|
||||
|
||||
if (!commit) { // dev mode
|
||||
const vscodePath = path.resolve(path.join(context.extensionPath, '..', '..'));
|
||||
const nodeExec = process.platform === 'win32' ? 'node.exe' : 'node';
|
||||
const nodePath = path.join(vscodePath, '.build', 'node-remote', nodeExec);
|
||||
|
||||
if (!fs.existsSync(nodePath)) {
|
||||
try {
|
||||
progress.report({ message: 'Installing node' });
|
||||
outputChannel.appendLine(`Installing node at ${nodePath}`);
|
||||
cp.execSync(`node ${path.join(vscodePath, 'node_modules/gulp/bin/gulp.js')} node-remote`);
|
||||
} catch (e) {
|
||||
processError(`Problem downloading node: ${e.message}`);
|
||||
|
||||
}
|
||||
}
|
||||
outputChannel.appendLine(`Using node at ${nodePath}`);
|
||||
|
||||
const env = getNewEnv();
|
||||
env['PATH'] = path.join(vscodePath, 'resources', 'server', 'bin') + path.delimiter + env['PATH']; // allow calling code-dev.sh
|
||||
|
||||
outputChannel.appendLine(env['PATH'] || '');
|
||||
|
||||
extHostProcess = cp.spawn(nodePath, [path.join('out', 'remoteExtensionHostAgent'), '--port=0'], { cwd: vscodePath, env });
|
||||
const serverCommandPath = path.join(vscodePath, 'resources', 'server', 'bin-dev', serverCommand);
|
||||
extHostProcess = cp.spawn(serverCommandPath, commandArgs, { env, cwd: vscodePath });
|
||||
} else {
|
||||
const serverBin = path.resolve(os.homedir(), '.vscode-remote', 'bin');
|
||||
const serverBin = path.join(remoteDataDir, 'bin');
|
||||
progress.report({ message: 'Installing VSCode Server' });
|
||||
const serverLocation = await downloadAndUnzipVSCodeServer(updateUrl, commit, quality, serverBin);
|
||||
outputChannel.appendLine(`Using server build at ${serverLocation}`);
|
||||
|
||||
const commandArgs = ['--port=0', '--disable-telemetry'];
|
||||
|
||||
const env = getNewEnv();
|
||||
env['PATH'] = path.join(serverLocation, 'bin') + path.delimiter + env['PATH']; // code command for the terminal
|
||||
|
||||
extHostProcess = cp.spawn(path.join(serverLocation, 'server.sh'), commandArgs, { env, cwd: serverLocation });
|
||||
extHostProcess = cp.spawn(path.join(serverLocation, serverCommand), commandArgs, { env, cwd: serverLocation });
|
||||
}
|
||||
extHostProcess.stdout.on('data', (data: Buffer) => processOutput(data.toString()));
|
||||
extHostProcess.stderr.on('data', (data: Buffer) => processOutput(data.toString()));
|
||||
extHostProcess.on('error', (error: Error) => processError(`remoteExtensionHostAgent failed with error:\n${error.message}`));
|
||||
extHostProcess.on('close', (code: number) => processError(`remoteExtensionHostAgent closed unexpectedly.\nError code: ${code}`));
|
||||
extHostProcess.on('error', (error: Error) => processError(`server failed with error:\n${error.message}`));
|
||||
extHostProcess.on('close', (code: number) => processError(`server closed unexpectedly.\nError code: ${code}`));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -133,7 +117,6 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
outputChannel.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
type ActionItem = (vscode.MessageItem & { execute: () => void; });
|
||||
@@ -170,6 +153,8 @@ export interface IProductConfiguration {
|
||||
updateUrl: string;
|
||||
commit: string;
|
||||
quality: string;
|
||||
dataFolderName: string;
|
||||
serverDataFolderName?: string;
|
||||
}
|
||||
|
||||
function getProductConfiguration(): IProductConfiguration {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/node@^10.12.21":
|
||||
version "10.12.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.30.tgz#4c2b4f0015f214f8158a347350481322b3b29b2f"
|
||||
integrity sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==
|
||||
"@types/node@^10.14.8":
|
||||
version "10.14.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.8.tgz#fe444203ecef1162348cd6deb76c62477b2cc6e9"
|
||||
integrity sha512-I4+DbJEhLEg4/vIy/2gkWDvXBOOtPKV9EnLhYjMoqxcRW+TTZtUftkHktz/a8suoD5mUL7m6ReLrkPvSsCQQmw==
|
||||
|
||||
ajv@^6.5.5:
|
||||
version "6.10.0"
|
||||
|
||||
Reference in New Issue
Block a user