Merge from vscode 8aa90d444f5d051984e8055f547c4252d53479b3 (#5587)

* Merge from vscode 8aa90d444f5d051984e8055f547c4252d53479b3

* pipeline errors

* fix build
This commit is contained in:
Anthony Dresser
2019-05-23 11:16:03 -07:00
committed by GitHub
parent ca36f20c6b
commit cf8f8907ee
141 changed files with 6450 additions and 1228 deletions

View File

@@ -96,6 +96,14 @@
{
"fileMatch": "/.vscode/extensions.json",
"url": "vscode://schemas/extensions"
},
{
"fileMatch": "/.devcontainer/devcontainer.json",
"url": "./schemas/devContainer.schema.json"
},
{
"fileMatch": "/.devcontainer.json",
"url": "./schemas/devContainer.schema.json"
}
]
},

View File

@@ -0,0 +1,149 @@
{
"$schema": "http://json-schema.org/schema#",
"description": "Defines a dev container",
"allowComments": true,
"type": "object",
"definitions": {
"devContainerCommon": {
"properties": {
"name": {
"type": "string",
"description": "A name to show for the workspace folder."
},
"extensions": {
"type": "array",
"description": "An array of extensions that should be installed into the container.",
"items": {
"type": "string"
}
},
"settings": {
"type": "object",
"description": "Machine specific settings that should be copied into the container."
},
"postCreateCommand": {
"type": ["string", "array"],
"description": "A command to run after creating the container. If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell.",
"items": {
"type": "string"
}
},
"devPort": {
"type": "integer",
"description": "The port VS Code can use to connect to its backend."
}
}
},
"nonComposeBase": {
"properties": {
"appPort": {
"type": ["integer", "string", "array"],
"description": "Application ports that are exposed by the container. This can be a single port or an array of ports. Each port can be a number or a string. A number is mapped to the same port on the host. A string is passed to Docker unchanged and can be used to map ports differently, e.g. \"8000:8010\".",
"items": {
"type": ["integer", "string"]
}
},
"runArgs": {
"type": "array",
"description": "The arguments required when starting in the container.",
"items": {
"type": "string"
}
},
"shutdownAction": {
"type": "string",
"enum": ["none", "stopContainer"],
"description": "Action to take when VS Code is shutting down. The default is to stop the container."
},
"overrideCommand": {
"type": "boolean",
"description": "Whether to overwrite the command specified in the image. The default is true."
},
"workspaceFolder": {
"type": "string",
"description": "The path of the workspace folder inside the container."
},
"workspaceMount": {
"type": "string",
"description": "The --mount parameter for docker run. The default is to mount the project folder at /workspaces/$project."
}
}
},
"dockerFileContainer": {
"properties": {
"dockerFile": {
"type": "string",
"description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file."
},
"context": {
"type": "string",
"description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file."
}
},
"required": ["dockerFile"]
},
"imageContainer": {
"properties": {
"image": {
"type": "string",
"description": "The docker image that will be used to create the container."
}
},
"required": ["image"]
},
"composeContainer": {
"properties": {
"dockerComposeFile": {
"type": ["string", "array"],
"description": "The name of the docker-compose file(s) used to start the services.",
"items": {
"type": "string"
}
},
"service": {
"type": "string",
"description": "The service you want to work on."
},
"workspaceFolder": {
"type": "string",
"description": "The path of the workspace folder inside the container."
},
"shutdownAction": {
"type": "string",
"enum": ["none", "stopCompose"],
"description": "Action to take when VS Code is shutting down. The default is to stop the containers."
}
},
"required": ["dockerComposeFile", "service", "workspaceFolder"]
}
},
"allOf": [
{
"oneOf": [
{
"allOf": [
{
"oneOf": [
{
"$ref": "#/definitions/dockerFileContainer"
},
{
"$ref": "#/definitions/imageContainer"
}
]
},
{
"$ref": "#/definitions/nonComposeBase"
}
]
},
{
"$ref": "#/definitions/composeContainer"
}
]
},
{
"$ref": "#/definitions/devContainerCommon"
}
]
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
body {
html, body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif;
font-size: 14px;
padding: 0 26px;
@@ -32,7 +32,6 @@ body {
box-shadow: 2px 2px 2px rgba(0,0,0,.25);
}
body.scrollBeyondLastLine {
margin-bottom: calc(100vh - 22px);
}
@@ -169,19 +168,14 @@ blockquote {
code {
font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
font-size: 14px;
line-height: 19px;
font-size: 1rem;
line-height: 1.357rem;
}
body.wordWrap pre {
white-space: pre-wrap;
}
.mac code {
font-size: 12px;
line-height: 18px;
}
pre:not(.hljs),
pre.hljs code > div {
padding: 16px;

View File

@@ -19,12 +19,12 @@ export class ShowPreviewSecuritySelectorCommand implements Command {
public execute(resource: string | undefined) {
if (this.previewManager.activePreviewResource) {
this.previewSecuritySelector.showSecutitySelectorForResource(this.previewManager.activePreviewResource);
this.previewSecuritySelector.showSecuritySelectorForResource(this.previewManager.activePreviewResource);
} else if (resource) {
const source = vscode.Uri.parse(resource);
this.previewSecuritySelector.showSecutitySelectorForResource(source.query ? vscode.Uri.parse(source.query) : source);
this.previewSecuritySelector.showSecuritySelectorForResource(source.query ? vscode.Uri.parse(source.query) : source);
} else if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document)) {
this.previewSecuritySelector.showSecutitySelectorForResource(vscode.window.activeTextEditor.document.uri);
this.previewSecuritySelector.showSecuritySelectorForResource(vscode.window.activeTextEditor.document.uri);
}
}
}

View File

@@ -35,6 +35,10 @@ const previewStrings = {
'Content Disabled Security Warning')
};
function escapeAttribute(value: string): string {
return value.replace(/"/g, '"');
}
export class MarkdownContentProvider {
constructor(
private readonly engine: MarkdownEngine,
@@ -75,9 +79,9 @@ export class MarkdownContentProvider {
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
${csp}
<meta id="vscode-markdown-preview-data"
data-settings="${JSON.stringify(initialData).replace(/"/g, '&quot;')}"
data-strings="${JSON.stringify(previewStrings).replace(/"/g, '&quot;')}"
data-state="${JSON.stringify(state || {}).replace(/"/g, '&quot;')}">
data-settings="${escapeAttribute(JSON.stringify(initialData))}"
data-strings="${escapeAttribute(JSON.stringify(previewStrings))}"
data-state="${escapeAttribute(JSON.stringify(state || {}))}">
<script src="${this.extensionResourcePath('pre.js')}" nonce="${nonce}"></script>
${this.getStyles(sourceUri, nonce, config, state)}
<base href="${markdownDocument.uri.with({ scheme: 'vscode-resource' }).toString(true)}">
@@ -142,7 +146,7 @@ export class MarkdownContentProvider {
private computeCustomStyleSheetIncludes(resource: vscode.Uri, config: MarkdownPreviewConfiguration): string {
if (Array.isArray(config.styles)) {
return config.styles.map(style => {
return `<link rel="stylesheet" class="code-user-style" data-source="${style.replace(/"/g, '&quot;')}" href="${this.fixHref(resource, style).replace(/"/g, '&quot;')}" type="text/css" media="screen">`;
return `<link rel="stylesheet" class="code-user-style" data-source="${escapeAttribute(style)}" href="${escapeAttribute(this.fixHref(resource, style))}" type="text/css" media="screen">`;
}).join('\n');
}
return '';
@@ -150,7 +154,7 @@ export class MarkdownContentProvider {
private getSettingsOverrideStyles(nonce: string, config: MarkdownPreviewConfiguration): string {
return `<style nonce="${nonce}">
body {
html, body {
${config.fontFamily ? `font-family: ${config.fontFamily};` : ''}
${isNaN(config.fontSize) ? '' : `font-size: ${config.fontSize}px;`}
${isNaN(config.lineHeight) ? '' : `line-height: ${config.lineHeight};`}
@@ -175,7 +179,7 @@ export class MarkdownContentProvider {
private getStyles(resource: vscode.Uri, nonce: string, config: MarkdownPreviewConfiguration, state?: any): string {
const baseStyles = this.contributionProvider.contributions.previewStyles
.map(resource => `<link rel="stylesheet" type="text/css" href="${resource.toString()}">`)
.map(resource => `<link rel="stylesheet" type="text/css" href="${escapeAttribute(resource.toString())}">`)
.join('\n');
return `${baseStyles}
@@ -186,7 +190,7 @@ export class MarkdownContentProvider {
private getScripts(nonce: string): string {
return this.contributionProvider.contributions.previewScripts
.map(resource => `<script async src="${resource.toString()}" nonce="${nonce}" charset="UTF-8"></script>`)
.map(resource => `<script async src="${escapeAttribute(resource.toString())}" nonce="${nonce}" charset="UTF-8"></script>`)
.join('\n');
}

View File

@@ -6,32 +6,32 @@
import * as vscode from 'vscode';
import { Logger } from '../logger';
import { MarkdownContributionProvider } from '../markdownExtensions';
import { disposeAll } from '../util/dispose';
import { disposeAll, Disposable } from '../util/dispose';
import { MarkdownFileTopmostLineMonitor } from '../util/topmostLineMonitor';
import { MarkdownPreview, PreviewSettings } from './preview';
import { MarkdownPreviewConfigurationManager } from './previewConfig';
import { MarkdownContentProvider } from './previewContentProvider';
export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
export class MarkdownPreviewManager extends Disposable implements vscode.WebviewPanelSerializer {
private static readonly markdownPreviewActiveContextKey = 'markdownPreviewFocus';
private readonly _topmostLineMonitor = new MarkdownFileTopmostLineMonitor();
private readonly _previewConfigurations = new MarkdownPreviewConfigurationManager();
private readonly _previews: MarkdownPreview[] = [];
private _activePreview: MarkdownPreview | undefined = undefined;
private readonly _disposables: vscode.Disposable[] = [];
public constructor(
private readonly _contentProvider: MarkdownContentProvider,
private readonly _logger: Logger,
private readonly _contributions: MarkdownContributionProvider
) {
this._disposables.push(vscode.window.registerWebviewPanelSerializer(MarkdownPreview.viewType, this));
super();
this._register(vscode.window.registerWebviewPanelSerializer(MarkdownPreview.viewType, this));
}
public dispose(): void {
disposeAll(this._disposables);
super.dispose();
disposeAll(this._previews);
}

View File

@@ -94,7 +94,7 @@ export class PreviewSecuritySelector {
private readonly webviewManager: MarkdownPreviewManager
) { }
public async showSecutitySelectorForResource(resource: vscode.Uri): Promise<void> {
public async showSecuritySelectorForResource(resource: vscode.Uri): Promise<void> {
interface PreviewSecurityPickItem extends vscode.QuickPickItem {
readonly type: 'moreinfo' | 'toggle' | MarkdownPreviewSecurityLevel;
}

View File

@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "3.5.0-dev.20190517"
"typescript": "3.5.0-dev.20190522"
},
"scripts": {
"postinstall": "node ./postinstall"

View File

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

View File

@@ -0,0 +1,22 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--remote=test+test"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]
}
]
}

View File

@@ -0,0 +1,6 @@
.vscode/**
typings/**
**/*.ts
**/*.map
.gitignore
tsconfig.json

View File

@@ -0,0 +1,89 @@
{
"name": "vscode-test-resolver",
"description": "Test resolver for VS Code",
"version": "0.0.1",
"publisher": "vscode",
"enableProposedApi": true,
"private": true,
"engines": {
"vscode": "^1.25.0"
},
"extensionKind": "ui",
"scripts": {
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-test-resolver ./tsconfig.json"
},
"activationEvents": [
"onResolveRemoteAuthority:test",
"onCommand:vscode-testresolver.newWindow",
"onCommand:vscode-testresolver.newWindowWithError",
"onCommand:vscode-testresolver.showLog"
],
"main": "./out/extension",
"devDependencies": {
"@types/node": "^10.12.21",
"vscode": "1.1.5"
},
"contributes": {
"resourceLabelFormatters": [
{
"scheme": "vscode-remote",
"authority": "test+*",
"formatting": {
"label": "${path}",
"separator": "/",
"tildify": true,
"workspaceSuffix": "TestResolver"
}
}
],
"commands": [
{
"title": "New Window",
"category": "Remote-TestResolver",
"command": "vscode-testresolver.newWindow"
},
{
"title": "New Window with Error",
"category": "Remote-TestResolver",
"command": "vscode-testresolver.newWindowWithError"
},
{
"title": "Show Log",
"category": "Remote-TestResolver",
"command": "vscode-testresolver.showLog"
}
],
"menus": {
"statusBar/windowIndicator": [
{
"command": "vscode-testresolver.newWindow",
"when": "!remoteAuthority",
"group": "9_local_testresolver@2"
},
{
"command": "vscode-testresolver.newWindowWithError",
"when": "!remoteAuthority",
"group": "9_local_testresolver@3"
},
{
"command": "vscode-testresolver.showLog",
"when": "remoteAuthority =~ /^test\\+.*$/",
"group": "1_remote_testresolver_open@3"
},
{
"command": "vscode-testresolver.newWindow",
"when": "remoteAuthority =~ /^test\\+.*$/",
"group": "1_remote_testresolver_open@1"
},
{
"command": "vscode-testresolver.newWindowWithError",
"when": "remoteAuthority =~ /^test\\+.*$/",
"group": "1_remote_testresolver_open@2"
}
]
}
}
}

View File

@@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as https from 'https';
import * as fs from 'fs';
import * as path from 'path';
import * as cp from 'child_process';
import { parse as parseUrl } from 'url';
function ensureFolderExists(loc: string) {
if (!fs.existsSync(loc)) {
const parent = path.dirname(loc);
if (parent) {
ensureFolderExists(parent);
}
fs.mkdirSync(loc);
}
}
function getDownloadUrl(updateUrl: string, commit: string, platform: string, quality: string): string {
return `${updateUrl}/commit:${commit}/server-${platform}/${quality}`;
}
async function downloadVSCodeServerArchive(updateUrl: string, commit: string, quality: string, destDir: string): Promise<string> {
ensureFolderExists(destDir);
const platform = process.platform === 'win32' ? 'win32-x64' : process.platform === 'darwin' ? 'darwin' : 'linux-x64';
const downloadUrl = getDownloadUrl(updateUrl, commit, platform, quality);
return new Promise((resolve, reject) => {
console.log(`Downloading VS Code Server from: ${downloadUrl}`);
const requestOptions: https.RequestOptions = parseUrl(downloadUrl);
https.get(requestOptions, res => {
if (res.statusCode !== 302) {
reject('Failed to get VS Code server archive location');
}
const archiveUrl = res.headers.location;
if (!archiveUrl) {
reject('Failed to get VS Code server archive location');
return;
}
const archiveRequestOptions: https.RequestOptions = parseUrl(archiveUrl);
if (archiveUrl.endsWith('.zip')) {
const archivePath = path.resolve(destDir, `vscode-server-${commit}.zip`);
const outStream = fs.createWriteStream(archivePath);
outStream.on('close', () => {
resolve(archivePath);
});
https.get(archiveRequestOptions, res => {
res.pipe(outStream);
});
} else {
const zipPath = path.resolve(destDir, `vscode-server-${commit}.tgz`);
const outStream = fs.createWriteStream(zipPath);
https.get(archiveRequestOptions, res => {
res.pipe(outStream);
});
outStream.on('close', () => {
resolve(zipPath);
});
}
});
});
}
/**
* Unzip a .zip or .tar.gz VS Code archive
*/
function unzipVSCodeServer(vscodeArchivePath: string, extractDir: string) {
if (vscodeArchivePath.endsWith('.zip')) {
const tempDir = fs.mkdtempSync('vscode-server');
if (process.platform === 'win32') {
cp.spawnSync('powershell.exe', [
'-NoProfile',
'-ExecutionPolicy', 'Bypass',
'-NonInteractive',
'-NoLogo',
'-Command',
`Microsoft.PowerShell.Archive\\Expand-Archive -Path "${vscodeArchivePath}" -DestinationPath "${tempDir}"`
]);
} else {
cp.spawnSync('unzip', [vscodeArchivePath, '-d', `${tempDir}`]);
}
fs.renameSync(path.join(tempDir, process.platform === 'win32' ? 'vscode-server-win32-x64' : 'vscode-server-darwin'), extractDir);
} else {
// tar does not create extractDir by default
if (!fs.existsSync(extractDir)) {
fs.mkdirSync(extractDir);
}
cp.spawnSync('tar', ['-xzf', vscodeArchivePath, '-C', extractDir, '--strip-components', '1']);
}
}
export async function downloadAndUnzipVSCodeServer(updateUrl: string, commit: string, quality: string = 'stable', destDir: string): Promise<string> {
const extractDir = path.join(destDir, commit);
if (fs.existsSync(extractDir)) {
console.log(`Found ${extractDir}. Skipping download.`);
} else {
console.log(`Downloading VS Code Server ${quality} - ${commit} into ${extractDir}.`);
try {
const vscodeArchivePath = await downloadVSCodeServerArchive(updateUrl, commit, quality, destDir);
if (fs.existsSync(vscodeArchivePath)) {
unzipVSCodeServer(vscodeArchivePath, extractDir);
// Remove archive
fs.unlinkSync(vscodeArchivePath);
}
} catch (err) {
throw Error(`Failed to download and unzip VS Code ${quality} - ${commit}`);
}
}
return Promise.resolve(extractDir);
}

View File

@@ -0,0 +1,190 @@
/*---------------------------------------------------------------------------------------------
* 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 cp from 'child_process';
import * as path from 'path';
import * as fs from 'fs';
import * as os from 'os';
import { downloadAndUnzipVSCodeServer } from './download';
let startPromise: Thenable<vscode.ResolvedAuthority> | undefined = void 0;
let extHostProcess: cp.ChildProcess | undefined;
const enum CharCode {
Backspace = 8,
LineFeed = 10
}
let outputChannel: vscode.OutputChannel;
export function activate(context: vscode.ExtensionContext) {
function doResolve(_authority: string, progress: vscode.Progress<{ message?: string; increment?: number }>): Promise<vscode.ResolvedAuthority> {
return new Promise(async (res, rej) => {
progress.report({ message: 'Starting Test Resolver' });
outputChannel = vscode.window.createOutputChannel('TestResolver');
let isStarted = false;
async function processError(message: string) {
outputChannel.appendLine(message);
if (!isStarted) {
outputChannel.show();
const result = await vscode.window.showErrorMessage(message, { modal: true }, ...getActions());
if (result) {
await result.execute();
}
rej(vscode.RemoteAuthorityResolverError.NotAvailable(message, true));
}
}
let lastProgressLine = '';
function processOutput(output: string) {
outputChannel.append(output);
for (let i = 0; i < output.length; i++) {
const chr = output.charCodeAt(i);
if (chr === CharCode.LineFeed) {
const match = lastProgressLine.match(/Extension host agent listening on (\d+)/);
if (match) {
isStarted = true;
res(new vscode.ResolvedAuthority('localhost', parseInt(match[1], 10))); // success!
}
lastProgressLine = '';
} else if (chr === CharCode.Backspace) {
lastProgressLine = lastProgressLine.substr(0, lastProgressLine.length - 1);
} else {
lastProgressLine += output.charAt(i);
}
}
}
if (_authority === 'test+error' || vscode.workspace.getConfiguration('testresolver').get('error') === true) {
processError('Unable to start the Test Resolver.');
return;
}
const { updateUrl, commit, quality } = getProductConfiguration();
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 });
} else {
const serverBin = path.resolve(os.homedir(), '.vscode-remote', '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.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}`));
});
}
vscode.workspace.registerRemoteAuthorityResolver('test', {
resolve(_authority: string): Thenable<vscode.ResolvedAuthority> {
if (!startPromise) {
startPromise = vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: 'Open TestResolver Remote ([details](command:remote-testresolver.showLog))',
cancellable: false
}, (progress) => doResolve(_authority, progress));
}
return startPromise;
}
});
vscode.commands.registerCommand('vscode-testresolver.newWindow', () => {
return vscode.commands.executeCommand('vscode.newWindow', { remoteAuthority: 'test+test' });
});
vscode.commands.registerCommand('vscode-testresolver.newWindowWithError', () => {
return vscode.commands.executeCommand('vscode.newWindow', { remoteAuthority: 'test+error' });
});
vscode.commands.registerCommand('vscode-testresolver.showLog', () => {
if (outputChannel) {
outputChannel.show();
}
});
}
type ActionItem = (vscode.MessageItem & { execute: () => void; });
function getActions(): ActionItem[] {
const actions: ActionItem[] = [];
const isDirty = vscode.workspace.textDocuments.some(d => d.isDirty) || vscode.workspace.workspaceFile && vscode.workspace.workspaceFile.scheme === 'untitled';
actions.push({
title: 'Retry',
execute: async () => {
await vscode.commands.executeCommand('workbench.action.reloadWindow');
}
});
if (!isDirty) {
actions.push({
title: 'Close Remote',
execute: async () => {
await vscode.commands.executeCommand('vscode.newWindow', { reuseWindow: true });
}
});
}
actions.push({
title: 'Ignore',
isCloseAffordance: true,
execute: async () => {
vscode.commands.executeCommand('vscode-testresolver.showLog'); // no need to wait
}
});
return actions;
}
export interface IProductConfiguration {
updateUrl: string;
commit: string;
quality: string;
}
function getProductConfiguration(): IProductConfiguration {
const content = fs.readFileSync(path.join(vscode.env.appRoot, 'product.json')).toString();
return JSON.parse(content) as IProductConfiguration;
}
function getNewEnv(): { [x: string]: string | undefined } {
const env = { ...process.env };
delete env['ELECTRON_RUN_AS_NODE'];
return env;
}
export function deactivate() {
if (extHostProcess) {
extHostProcess.kill();
}
}

View File

@@ -0,0 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path="../../../../src/vs/vscode.d.ts" />
/// <reference path="../../../../src/vs/vscode.proposed.d.ts" />
/// <reference types='@types/node'/>

View File

@@ -0,0 +1,9 @@
{
"extends": "../shared.tsconfig.json",
"compilerOptions": {
"outDir": "./out"
},
"include": [
"src/**/*"
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
# yarn lockfile v1
typescript@3.5.0-dev.20190517:
version "3.5.0-dev.20190517"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.0-dev.20190517.tgz#5a85f1091cf33fde39b04f898c5730e30edd3e39"
integrity sha512-KoBHq6ytEApXKTDtmTu4Sp/tC5SPe4FpvwutLEANhwdMPblqZdh7APuH7I/ceMlgfHSa7B00JgF7NokUJQi0/g==
typescript@3.5.0-dev.20190522:
version "3.5.0-dev.20190522"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.0-dev.20190522.tgz#ade4702c6e599a7e8905d7acaaf416f7e32ba0fc"
integrity sha512-V+QsNMtXl8lGwov4O04D+E6vtiL0TWEpz6iDxI2tAZizEn7y8Hh9SXzz3JRWepr7dfdqqxEv9CT3J18zpaZKJQ==