Format source to make it consistent
This commit is contained in:
Родитель
506e534d1b
Коммит
a8ba6b5394
|
@ -18,14 +18,14 @@ require('./tasks/coverageTasks');
|
||||||
|
|
||||||
// Disable warning about wanting an async function
|
// Disable warning about wanting an async function
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
gulp.task('generateOptionsSchema', () : Promise<void> => {
|
gulp.task('generateOptionsSchema', (): Promise<void> => {
|
||||||
optionsSchemaGenerator.GenerateOptionsSchema();
|
optionsSchemaGenerator.GenerateOptionsSchema();
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable warning about wanting an async function
|
// Disable warning about wanting an async function
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
gulp.task('updatePackageDependencies', () : Promise<void> => {
|
gulp.task('updatePackageDependencies', (): Promise<void> => {
|
||||||
return packageDependencyUpdater.updatePackageDependencies();
|
return packageDependencyUpdater.updatePackageDependencies();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
import { Advisor } from "./features/diagnosticsProvider";
|
import { Advisor } from "./features/diagnosticsProvider";
|
||||||
import { EventStream } from "./EventStream";
|
import { EventStream } from "./EventStream";
|
||||||
|
|
||||||
export default interface CSharpExtensionExports {
|
export default interface CSharpExtensionExports {
|
||||||
initializationFinished: () => Promise<void>;
|
initializationFinished: () => Promise<void>;
|
||||||
getAdvisor: () => Promise<Advisor>;
|
getAdvisor: () => Promise<Advisor>;
|
||||||
eventStream: EventStream;
|
eventStream: EventStream;
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Subscription } from "rxjs";
|
import { Subscription } from "rxjs";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import { Subscription } from "rxjs";
|
import { Subscription } from "rxjs";
|
||||||
|
|
||||||
export default class Disposable implements IDisposable {
|
export default class Disposable implements IDisposable {
|
||||||
private onDispose: { (): void };
|
private onDispose: { (): void };
|
||||||
|
@ -11,7 +11,7 @@ export default class Disposable implements IDisposable {
|
||||||
if (!onDispose) {
|
if (!onDispose) {
|
||||||
throw new Error("onDispose cannot be null or empty.");
|
throw new Error("onDispose cannot be null or empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onDispose instanceof Subscription) {
|
if (onDispose instanceof Subscription) {
|
||||||
this.onDispose = () => onDispose.unsubscribe();
|
this.onDispose = () => onDispose.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import { Subject , Subscription } from "rxjs";
|
import { Subject, Subscription } from "rxjs";
|
||||||
import { BaseEvent } from "./omnisharp/loggingEvents";
|
import { BaseEvent } from "./omnisharp/loggingEvents";
|
||||||
|
|
||||||
export class EventStream {
|
export class EventStream {
|
||||||
|
|
|
@ -60,8 +60,7 @@ export async function execChildProcess(command: string, workingDirectory: string
|
||||||
|
|
||||||
export async function getUnixChildProcessIds(pid: number): Promise<number[]> {
|
export async function getUnixChildProcessIds(pid: number): Promise<number[]> {
|
||||||
return new Promise<number[]>((resolve, reject) => {
|
return new Promise<number[]>((resolve, reject) => {
|
||||||
let ps = cp.exec('ps -A -o ppid,pid', (error, stdout, stderr) =>
|
let ps = cp.exec('ps -A -o ppid,pid', (error, stdout, stderr) => {
|
||||||
{
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return reject(error);
|
return reject(error);
|
||||||
}
|
}
|
||||||
|
@ -108,21 +107,21 @@ export async function fileExists(filePath: string): Promise<boolean> {
|
||||||
|
|
||||||
export async function deleteIfExists(filePath: string): Promise<void> {
|
export async function deleteIfExists(filePath: string): Promise<void> {
|
||||||
return fileExists(filePath)
|
return fileExists(filePath)
|
||||||
.then(async (exists: boolean) => {
|
.then(async (exists: boolean) => {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
|
||||||
|
|
||||||
fs.unlink(filePath, err => {
|
|
||||||
if (err) {
|
|
||||||
return reject(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve();
|
fs.unlink(filePath, err => {
|
||||||
|
if (err) {
|
||||||
|
return reject(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum InstallFileType {
|
export enum InstallFileType {
|
||||||
|
@ -130,7 +129,7 @@ export enum InstallFileType {
|
||||||
Lock
|
Lock
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInstallFilePath(folderPath: AbsolutePath, type: InstallFileType): string {
|
export function getInstallFilePath(folderPath: AbsolutePath, type: InstallFileType): string {
|
||||||
let installFile = 'install.' + InstallFileType[type];
|
let installFile = 'install.' + InstallFileType[type];
|
||||||
return path.resolve(folderPath.value, installFile);
|
return path.resolve(folderPath.value, installFile);
|
||||||
}
|
}
|
||||||
|
@ -172,9 +171,9 @@ export function convertNativePathToPosix(pathString: string): string {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function checks to see if a subfolder is part of folder.
|
* This function checks to see if a subfolder is part of folder.
|
||||||
*
|
*
|
||||||
* Assumes subfolder and folder are absolute paths and have consistent casing.
|
* Assumes subfolder and folder are absolute paths and have consistent casing.
|
||||||
*
|
*
|
||||||
* @param subfolder subfolder to check if it is part of the folder parameter
|
* @param subfolder subfolder to check if it is part of the folder parameter
|
||||||
* @param folder folder to check aganist
|
* @param folder folder to check aganist
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Remove function when https://github.com/OmniSharp/omnisharp-roslyn/issues/909 is resolved.
|
* TODO: Remove function when https://github.com/OmniSharp/omnisharp-roslyn/issues/909 is resolved.
|
||||||
*
|
*
|
||||||
* Note: serverUtils.requestWorkspaceInformation only retrieves one folder for multi-root workspaces. Therefore, generator will be incorrect for all folders
|
* Note: serverUtils.requestWorkspaceInformation only retrieves one folder for multi-root workspaces. Therefore, generator will be incorrect for all folders
|
||||||
* except the first in a workspace. Currently, this only works if the requested folder is the same as the server's solution path or folder.
|
* except the first in a workspace. Currently, this only works if the requested folder is the same as the server's solution path or folder.
|
||||||
*/
|
*/
|
||||||
|
@ -35,8 +35,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
const solutionPathOrFolder: string = this.server.getSolutionPathOrFolder();
|
const solutionPathOrFolder: string = this.server.getSolutionPathOrFolder();
|
||||||
|
|
||||||
// Make sure folder, folder.uri, and solutionPathOrFolder are defined.
|
// Make sure folder, folder.uri, and solutionPathOrFolder are defined.
|
||||||
if (!solutionPathOrFolder)
|
if (!solutionPathOrFolder) {
|
||||||
{
|
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +44,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
return fs.lstat(solutionPathOrFolder).then(stat => {
|
return fs.lstat(solutionPathOrFolder).then(stat => {
|
||||||
return stat.isFile();
|
return stat.isFile();
|
||||||
}).then(isFile => {
|
}).then(isFile => {
|
||||||
if (isFile)
|
if (isFile) {
|
||||||
{
|
|
||||||
serverFolder = path.dirname(solutionPathOrFolder);
|
serverFolder = path.dirname(solutionPathOrFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,38 +71,36 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
let hasWorkspaceMatches: boolean = await this.checkWorkspaceInformationMatchesWorkspaceFolder(folder);
|
||||||
let hasWorkspaceMatches : boolean = await this.checkWorkspaceInformationMatchesWorkspaceFolder(folder);
|
|
||||||
if (!hasWorkspaceMatches) {
|
if (!hasWorkspaceMatches) {
|
||||||
vscode.window.showErrorMessage(`Cannot create .NET debug configurations. The active C# project is not within folder '${folder.uri.fsPath}'.`);
|
vscode.window.showErrorMessage(`Cannot create .NET debug configurations. The active C# project is not within folder '${folder.uri.fsPath}'.`);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let info: WorkspaceInformationResponse = await serverUtils.requestWorkspaceInformation(this.server);
|
let info: WorkspaceInformationResponse = await serverUtils.requestWorkspaceInformation(this.server);
|
||||||
|
|
||||||
const generator = new AssetGenerator(info, folder);
|
const generator = new AssetGenerator(info, folder);
|
||||||
if (generator.hasExecutableProjects()) {
|
if (generator.hasExecutableProjects()) {
|
||||||
|
|
||||||
if (!await generator.selectStartupProject())
|
if (!await generator.selectStartupProject()) {
|
||||||
{
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure .vscode folder exists, addTasksJsonIfNecessary will fail to create tasks.json if the folder does not exist.
|
// Make sure .vscode folder exists, addTasksJsonIfNecessary will fail to create tasks.json if the folder does not exist.
|
||||||
await fs.ensureDir(generator.vscodeFolder);
|
await fs.ensureDir(generator.vscodeFolder);
|
||||||
|
|
||||||
// Add a tasks.json
|
// Add a tasks.json
|
||||||
const buildOperations : AssetOperations = await getBuildOperations(generator);
|
const buildOperations: AssetOperations = await getBuildOperations(generator);
|
||||||
await addTasksJsonIfNecessary(generator, buildOperations);
|
await addTasksJsonIfNecessary(generator, buildOperations);
|
||||||
|
|
||||||
const programLaunchType = generator.computeProgramLaunchType();
|
const programLaunchType = generator.computeProgramLaunchType();
|
||||||
const launchJson: string = generator.createLaunchJsonConfigurations(programLaunchType);
|
const launchJson: string = generator.createLaunchJsonConfigurations(programLaunchType);
|
||||||
|
|
||||||
// jsonc-parser's parse function parses a JSON string with comments into a JSON object. However, this removes the comments.
|
// jsonc-parser's parse function parses a JSON string with comments into a JSON object. However, this removes the comments.
|
||||||
return parse(launchJson);
|
return parse(launchJson);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Error to be caught in the .catch() below to write default C# configurations
|
// Error to be caught in the .catch() below to write default C# configurations
|
||||||
throw new Error("Does not contain .NET Core projects.");
|
throw new Error("Does not contain .NET Core projects.");
|
||||||
}
|
}
|
||||||
|
@ -112,9 +108,9 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// Provider will always create an launch.json file. Providing default C# configurations.
|
// Provider will always create an launch.json file. Providing default C# configurations.
|
||||||
// jsonc-parser's parse to convert to JSON object without comments.
|
// jsonc-parser's parse to convert to JSON object without comments.
|
||||||
return [
|
return [
|
||||||
createFallbackLaunchConfiguration(),
|
createFallbackLaunchConfiguration(),
|
||||||
parse(createAttachConfiguration())
|
parse(createAttachConfiguration())
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -127,7 +123,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
if (envFile) {
|
if (envFile) {
|
||||||
try {
|
try {
|
||||||
const parsedFile: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromFile(envFile, config["env"]);
|
const parsedFile: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromFile(envFile, config["env"]);
|
||||||
|
|
||||||
// show error message if single lines cannot get parsed
|
// show error message if single lines cannot get parsed
|
||||||
if (parsedFile.Warning) {
|
if (parsedFile.Warning) {
|
||||||
CSharpConfigurationProvider.showFileWarningAsync(parsedFile.Warning, envFile);
|
CSharpConfigurationProvider.showFileWarningAsync(parsedFile.Warning, envFile);
|
||||||
|
@ -153,14 +149,12 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
|
||||||
*/
|
*/
|
||||||
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
|
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||||
|
|
||||||
if (!config.type)
|
if (!config.type) {
|
||||||
{
|
|
||||||
// If the config doesn't look functional force VSCode to open a configuration file https://github.com/Microsoft/vscode/issues/54213
|
// If the config doesn't look functional force VSCode to open a configuration file https://github.com/Microsoft/vscode/issues/54213
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.request === "launch")
|
if (config.request === "launch") {
|
||||||
{
|
|
||||||
if (!config.cwd && !config.pipeTransport) {
|
if (!config.cwd && !config.pipeTransport) {
|
||||||
config.cwd = "${workspaceFolder}";
|
config.cwd = "${workspaceFolder}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,11 @@
|
||||||
|
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
|
|
||||||
export class ParsedEnvironmentFile
|
export class ParsedEnvironmentFile {
|
||||||
{
|
|
||||||
public Env: { [key: string]: any };
|
public Env: { [key: string]: any };
|
||||||
public Warning: string | null;
|
public Warning: string | null;
|
||||||
|
|
||||||
private constructor(env: { [key: string]: any }, warning: string | null)
|
private constructor(env: { [key: string]: any }, warning: string | null) {
|
||||||
{
|
|
||||||
this.Env = env;
|
this.Env = env;
|
||||||
this.Warning = warning;
|
this.Warning = warning;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +22,7 @@ export class ParsedEnvironmentFile
|
||||||
public static CreateFromContent(content: string, envFile: string, initialEnv: { [key: string]: any } | undefined): ParsedEnvironmentFile {
|
public static CreateFromContent(content: string, envFile: string, initialEnv: { [key: string]: any } | undefined): ParsedEnvironmentFile {
|
||||||
|
|
||||||
// Remove UTF-8 BOM if present
|
// Remove UTF-8 BOM if present
|
||||||
if(content.charAt(0) === '\uFEFF') {
|
if (content.charAt(0) === '\uFEFF') {
|
||||||
content = content.substr(1);
|
content = content.substr(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +58,7 @@ export class ParsedEnvironmentFile
|
||||||
|
|
||||||
// show error message if single lines cannot get parsed
|
// show error message if single lines cannot get parsed
|
||||||
let warning: string = null;
|
let warning: string = null;
|
||||||
if(parseErrors.length !== 0) {
|
if (parseErrors.length !== 0) {
|
||||||
warning = "Ignoring non-parseable lines in envFile " + envFile + ": ";
|
warning = "Ignoring non-parseable lines in envFile " + envFile + ": ";
|
||||||
parseErrors.forEach(function (value, idx, array) {
|
parseErrors.forEach(function (value, idx, array) {
|
||||||
warning += "\"" + value + "\"" + ((idx !== array.length - 1) ? ", " : ".");
|
warning += "\"" + value + "\"" + ((idx !== array.length - 1) ? ", " : ".");
|
||||||
|
|
|
@ -75,7 +75,7 @@ async function completeDebuggerInstall(platformInformation: PlatformInformation,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showInstallErrorMessage(eventStream : EventStream) {
|
function showInstallErrorMessage(eventStream: EventStream) {
|
||||||
eventStream.post(new DebuggerNotInstalledFailure());
|
eventStream.post(new DebuggerNotInstalledFailure());
|
||||||
vscode.window.showErrorMessage("An error occurred during installation of the .NET Core Debugger. The C# extension may need to be reinstalled.");
|
vscode.window.showErrorMessage("An error occurred during installation of the .NET Core Debugger. The C# extension may need to be reinstalled.");
|
||||||
}
|
}
|
||||||
|
@ -125,11 +125,10 @@ export async function getAdapterExecutionCommand(platformInfo: PlatformInformati
|
||||||
// install.Lock does not exist, need to wait for packages to finish downloading.
|
// install.Lock does not exist, need to wait for packages to finish downloading.
|
||||||
let installLock = false;
|
let installLock = false;
|
||||||
let debuggerPackage = getRuntimeDependencyPackageWithId("Debugger", packageJSON, platformInfo, extensionPath);
|
let debuggerPackage = getRuntimeDependencyPackageWithId("Debugger", packageJSON, platformInfo, extensionPath);
|
||||||
if (debuggerPackage && debuggerPackage.installPath)
|
if (debuggerPackage && debuggerPackage.installPath) {
|
||||||
{
|
|
||||||
installLock = await common.installFileExists(debuggerPackage.installPath, common.InstallFileType.Lock);
|
installLock = await common.installFileExists(debuggerPackage.installPath, common.InstallFileType.Lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!installLock) {
|
if (!installLock) {
|
||||||
eventStream.post(new DebuggerNotInstalledFailure());
|
eventStream.post(new DebuggerNotInstalledFailure());
|
||||||
throw new Error('The C# extension is still downloading packages. Please see progress in the output window below.');
|
throw new Error('The C# extension is still downloading packages. Please see progress in the output window below.');
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
// This contains the definition of messages that VsDbg-UI can send back to a listener which registers itself via the 'debuggerEventsPipeName'
|
// This contains the definition of messages that VsDbg-UI can send back to a listener which registers itself via the 'debuggerEventsPipeName'
|
||||||
// property on a launch or attach request.
|
// property on a launch or attach request.
|
||||||
//
|
//
|
||||||
// All messages are sent as UTF-8 JSON text with a tailing '\n'
|
// All messages are sent as UTF-8 JSON text with a tailing '\n'
|
||||||
export namespace DebuggerEventsProtocol {
|
export namespace DebuggerEventsProtocol {
|
||||||
export module EventType {
|
export module EventType {
|
||||||
|
@ -29,13 +29,13 @@ export namespace DebuggerEventsProtocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decodes a packet received from the debugger into an event
|
// Decodes a packet received from the debugger into an event
|
||||||
export function decodePacket(packet: Buffer) : DebuggerEvent {
|
export function decodePacket(packet: Buffer): DebuggerEvent {
|
||||||
// Verify the message ends in a newline
|
// Verify the message ends in a newline
|
||||||
if (packet[packet.length-1] != 10 /*\n*/) {
|
if (packet[packet.length - 1] != 10 /*\n*/) {
|
||||||
throw new Error("Unexpected message received from debugger.");
|
throw new Error("Unexpected message received from debugger.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = packet.toString('utf-8', 0, packet.length-1);
|
const message = packet.toString('utf-8', 0, packet.length - 1);
|
||||||
return JSON.parse(message);
|
return JSON.parse(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,8 +11,7 @@ import { execChildProcess } from './../common';
|
||||||
|
|
||||||
const MINIMUM_SUPPORTED_DOTNET_CLI: string = '1.0.0';
|
const MINIMUM_SUPPORTED_DOTNET_CLI: string = '1.0.0';
|
||||||
|
|
||||||
export class DotnetInfo
|
export class DotnetInfo {
|
||||||
{
|
|
||||||
public Version: string;
|
public Version: string;
|
||||||
public OsVersion: string;
|
public OsVersion: string;
|
||||||
public RuntimeId: string;
|
public RuntimeId: string;
|
||||||
|
@ -23,8 +22,7 @@ export class DotNetCliError extends Error {
|
||||||
public ErrorString: string; // the string to log for this error
|
public ErrorString: string; // the string to log for this error
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CoreClrDebugUtil
|
export class CoreClrDebugUtil {
|
||||||
{
|
|
||||||
private _extensionDir: string = '';
|
private _extensionDir: string = '';
|
||||||
private _debugAdapterDir: string = '';
|
private _debugAdapterDir: string = '';
|
||||||
private _installCompleteFilePath: string = '';
|
private _installCompleteFilePath: string = '';
|
||||||
|
@ -36,8 +34,7 @@ export class CoreClrDebugUtil
|
||||||
}
|
}
|
||||||
|
|
||||||
public extensionDir(): string {
|
public extensionDir(): string {
|
||||||
if (this._extensionDir === '')
|
if (this._extensionDir === '') {
|
||||||
{
|
|
||||||
throw new Error('Failed to set extension directory');
|
throw new Error('Failed to set extension directory');
|
||||||
}
|
}
|
||||||
return this._extensionDir;
|
return this._extensionDir;
|
||||||
|
@ -51,14 +48,13 @@ export class CoreClrDebugUtil
|
||||||
}
|
}
|
||||||
|
|
||||||
public installCompleteFilePath(): string {
|
public installCompleteFilePath(): string {
|
||||||
if (this._installCompleteFilePath === '')
|
if (this._installCompleteFilePath === '') {
|
||||||
{
|
|
||||||
throw new Error('Failed to set install complete file path');
|
throw new Error('Failed to set install complete file path');
|
||||||
}
|
}
|
||||||
return this._installCompleteFilePath;
|
return this._installCompleteFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async writeEmptyFile(path: string) : Promise<void> {
|
public static async writeEmptyFile(path: string): Promise<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
fs.writeFile(path, '', (err) => {
|
fs.writeFile(path, '', (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -75,53 +71,51 @@ export class CoreClrDebugUtil
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function checks for the presence of dotnet on the path and ensures the Version
|
// This function checks for the presence of dotnet on the path and ensures the Version
|
||||||
// is new enough for us.
|
// is new enough for us.
|
||||||
// Returns: a promise that returns a DotnetInfo class
|
// Returns: a promise that returns a DotnetInfo class
|
||||||
// Throws: An DotNetCliError() from the return promise if either dotnet does not exist or is too old.
|
// Throws: An DotNetCliError() from the return promise if either dotnet does not exist or is too old.
|
||||||
public async checkDotNetCli(): Promise<DotnetInfo>
|
public async checkDotNetCli(): Promise<DotnetInfo> {
|
||||||
{
|
|
||||||
let dotnetInfo = new DotnetInfo();
|
let dotnetInfo = new DotnetInfo();
|
||||||
|
|
||||||
return execChildProcess('dotnet --info', process.cwd())
|
return execChildProcess('dotnet --info', process.cwd())
|
||||||
.then((data: string) => {
|
.then((data: string) => {
|
||||||
let lines: string[] = data.replace(/\r/mg, '').split('\n');
|
let lines: string[] = data.replace(/\r/mg, '').split('\n');
|
||||||
lines.forEach(line => {
|
lines.forEach(line => {
|
||||||
let match: RegExpMatchArray;
|
let match: RegExpMatchArray;
|
||||||
if (match = /^\ Version:\s*([^\s].*)$/.exec(line)) {
|
if (match = /^\ Version:\s*([^\s].*)$/.exec(line)) {
|
||||||
dotnetInfo.Version = match[1];
|
dotnetInfo.Version = match[1];
|
||||||
} else if (match = /^\ OS Version:\s*([^\s].*)$/.exec(line)) {
|
} else if (match = /^\ OS Version:\s*([^\s].*)$/.exec(line)) {
|
||||||
dotnetInfo.OsVersion = match[1];
|
dotnetInfo.OsVersion = match[1];
|
||||||
} else if (match = /^\ RID:\s*([\w\-\.]+)$/.exec(line)) {
|
} else if (match = /^\ RID:\s*([\w\-\.]+)$/.exec(line)) {
|
||||||
dotnetInfo.RuntimeId = match[1];
|
dotnetInfo.RuntimeId = match[1];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
// something went wrong with spawning 'dotnet --info'
|
// something went wrong with spawning 'dotnet --info'
|
||||||
let dotnetError = new DotNetCliError();
|
|
||||||
dotnetError.ErrorMessage = 'The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.';
|
|
||||||
dotnetError.ErrorString = "Failed to spawn 'dotnet --info'";
|
|
||||||
throw dotnetError;
|
|
||||||
}).then(() => {
|
|
||||||
// succesfully spawned 'dotnet --info', check the Version
|
|
||||||
if (semver.lt(dotnetInfo.Version, MINIMUM_SUPPORTED_DOTNET_CLI))
|
|
||||||
{
|
|
||||||
let dotnetError = new DotNetCliError();
|
let dotnetError = new DotNetCliError();
|
||||||
dotnetError.ErrorMessage = 'The .NET Core SDK located on the path is too old. .NET Core debugging will not be enabled. The minimum supported version is ' + MINIMUM_SUPPORTED_DOTNET_CLI + '.';
|
dotnetError.ErrorMessage = 'The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.';
|
||||||
dotnetError.ErrorString = "dotnet cli is too old";
|
dotnetError.ErrorString = "Failed to spawn 'dotnet --info'";
|
||||||
throw dotnetError;
|
throw dotnetError;
|
||||||
}
|
}).then(() => {
|
||||||
|
// succesfully spawned 'dotnet --info', check the Version
|
||||||
|
if (semver.lt(dotnetInfo.Version, MINIMUM_SUPPORTED_DOTNET_CLI)) {
|
||||||
|
let dotnetError = new DotNetCliError();
|
||||||
|
dotnetError.ErrorMessage = 'The .NET Core SDK located on the path is too old. .NET Core debugging will not be enabled. The minimum supported version is ' + MINIMUM_SUPPORTED_DOTNET_CLI + '.';
|
||||||
|
dotnetError.ErrorString = "dotnet cli is too old";
|
||||||
|
throw dotnetError;
|
||||||
|
}
|
||||||
|
|
||||||
return dotnetInfo;
|
return dotnetInfo;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isMacOSSupported() : boolean {
|
public static isMacOSSupported(): boolean {
|
||||||
// .NET Core 2.0 requires macOS 10.12 (Sierra), which is Darwin 16.0+
|
// .NET Core 2.0 requires macOS 10.12 (Sierra), which is Darwin 16.0+
|
||||||
// Darwin version chart: https://en.wikipedia.org/wiki/Darwin_(operating_system)
|
// Darwin version chart: https://en.wikipedia.org/wiki/Darwin_(operating_system)
|
||||||
return semver.gte(os.release(), "16.0.0");
|
return semver.gte(os.release(), "16.0.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static existsSync(path: string) : boolean {
|
public static existsSync(path: string): boolean {
|
||||||
try {
|
try {
|
||||||
fs.accessSync(path, fs.constants.F_OK);
|
fs.accessSync(path, fs.constants.F_OK);
|
||||||
return true;
|
return true;
|
||||||
|
@ -134,7 +128,7 @@ export class CoreClrDebugUtil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getPlatformExeExtension() : string {
|
public static getPlatformExeExtension(): string {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
return '.exe';
|
return '.exe';
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// Sample Request: https://api.nuget.org/v3-flatcontainer/FluentAssertions/index.json
|
// Sample Request: https://api.nuget.org/v3-flatcontainer/FluentAssertions/index.json
|
||||||
|
|
||||||
export default interface NuGetFlatContainerPackageResponse {
|
export default interface NuGetFlatContainerPackageResponse {
|
||||||
versions: string[];
|
versions: string[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// Sample Request: https://api.nuget.org/v3/index.json
|
// Sample Request: https://api.nuget.org/v3/index.json
|
||||||
export default interface NuGetIndexResponse {
|
export default interface NuGetIndexResponse {
|
||||||
resources: NuGetResource[];
|
resources: NuGetResource[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NuGetResource {
|
interface NuGetResource {
|
||||||
'@type': string;
|
'@type': string;
|
||||||
'@id': string;
|
'@id': string;
|
||||||
}
|
}
|
|
@ -5,6 +5,6 @@
|
||||||
|
|
||||||
// Sample Query: https://api-v2v3search-0.nuget.org/autocomplete
|
// Sample Query: https://api-v2v3search-0.nuget.org/autocomplete
|
||||||
|
|
||||||
export default interface NuGetSearchAutocompleteServiceResponse {
|
export default interface NuGetSearchAutocompleteServiceResponse {
|
||||||
data: string[];
|
data: string[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,11 +86,11 @@ export class ProjectJSONContribution implements IJSONContribution {
|
||||||
}
|
}
|
||||||
|
|
||||||
public collectPropertySuggestions(
|
public collectPropertySuggestions(
|
||||||
resource: string,
|
resource: string,
|
||||||
location: Location,
|
location: Location,
|
||||||
currentWord: string,
|
currentWord: string,
|
||||||
addValue: boolean,
|
addValue: boolean,
|
||||||
isLast: boolean,
|
isLast: boolean,
|
||||||
result: ISuggestionsCollector): Thenable<void> {
|
result: ISuggestionsCollector): Thenable<void> {
|
||||||
if ((location.matches(['dependencies']) || location.matches(['frameworks', '*', 'dependencies']) || location.matches(['frameworks', '*', 'frameworkAssemblies']))) {
|
if ((location.matches(['dependencies']) || location.matches(['frameworks', '*', 'dependencies']) || location.matches(['frameworks', '*', 'frameworkAssemblies']))) {
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ function cleanJsonText(text: string) {
|
||||||
function peekPastWhitespace(): number | undefined {
|
function peekPastWhitespace(): number | undefined {
|
||||||
let pos = index;
|
let pos = index;
|
||||||
let code = undefined;
|
let code = undefined;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
code = text.charCodeAt(pos);
|
code = text.charCodeAt(pos);
|
||||||
pos++;
|
pos++;
|
||||||
|
@ -145,7 +145,7 @@ function cleanJsonText(text: string) {
|
||||||
parts.push(text.substring(partStart, index - 1));
|
parts.push(text.substring(partStart, index - 1));
|
||||||
partStart = index;
|
partStart = index;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
case CharCode.doubleQuote:
|
case CharCode.doubleQuote:
|
||||||
scanString();
|
scanString();
|
||||||
|
@ -201,7 +201,7 @@ function cleanJsonText(text: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= length && index > partStart) {
|
if (index >= length && index > partStart) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
let Subscriber: (message: string) => void;
|
let Subscriber: (message: string) => void;
|
||||||
|
|
||||||
export function SubscribeToAllLoggers(subscriber: (message:string) => void) {
|
export function SubscribeToAllLoggers(subscriber: (message: string) => void) {
|
||||||
Subscriber = subscriber;
|
Subscriber = subscriber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ export class Logger {
|
||||||
this._atLineStart = false;
|
this._atLineStart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.write(message);
|
this.write(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public increaseIndent(): void {
|
public increaseIndent(): void {
|
||||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -92,11 +92,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
|
||||||
let errorMessageObserver = new ErrorMessageObserver(vscode);
|
let errorMessageObserver = new ErrorMessageObserver(vscode);
|
||||||
eventStream.subscribe(errorMessageObserver.post);
|
eventStream.subscribe(errorMessageObserver.post);
|
||||||
|
|
||||||
let omnisharpStatusBar = new StatusBarItemAdapter(vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, Number.MIN_VALUE+2));
|
let omnisharpStatusBar = new StatusBarItemAdapter(vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, Number.MIN_VALUE + 2));
|
||||||
let omnisharpStatusBarObserver = new OmnisharpStatusBarObserver(omnisharpStatusBar);
|
let omnisharpStatusBarObserver = new OmnisharpStatusBarObserver(omnisharpStatusBar);
|
||||||
eventStream.subscribe(omnisharpStatusBarObserver.post);
|
eventStream.subscribe(omnisharpStatusBarObserver.post);
|
||||||
|
|
||||||
let projectStatusBar = new StatusBarItemAdapter(vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, Number.MIN_VALUE+1));
|
let projectStatusBar = new StatusBarItemAdapter(vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, Number.MIN_VALUE + 1));
|
||||||
let projectStatusBarObserver = new ProjectStatusBarObserver(projectStatusBar);
|
let projectStatusBarObserver = new ProjectStatusBarObserver(projectStatusBar);
|
||||||
eventStream.subscribe(projectStatusBarObserver.post);
|
eventStream.subscribe(projectStatusBarObserver.post);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
|
||||||
eventStream.subscribe(telemetryObserver.post);
|
eventStream.subscribe(telemetryObserver.post);
|
||||||
|
|
||||||
let networkSettingsProvider = vscodeNetworkSettingsProvider(vscode);
|
let networkSettingsProvider = vscodeNetworkSettingsProvider(vscode);
|
||||||
let installDependencies: IInstallDependencies = async(dependencies: AbsolutePathPackage[]) => downloadAndInstallPackages(dependencies, networkSettingsProvider, eventStream, isValidDownload);
|
let installDependencies: IInstallDependencies = async (dependencies: AbsolutePathPackage[]) => downloadAndInstallPackages(dependencies, networkSettingsProvider, eventStream, isValidDownload);
|
||||||
let runtimeDependenciesExist = await ensureRuntimeDependencies(extension, eventStream, platformInfo, installDependencies);
|
let runtimeDependenciesExist = await ensureRuntimeDependencies(extension, eventStream, platformInfo, installDependencies);
|
||||||
|
|
||||||
// activate language services
|
// activate language services
|
||||||
|
@ -208,8 +208,8 @@ function isSupportedPlatform(platform: PlatformInformation): boolean {
|
||||||
|
|
||||||
if (platform.isLinux()) {
|
if (platform.isLinux()) {
|
||||||
return platform.architecture === "x86_64" ||
|
return platform.architecture === "x86_64" ||
|
||||||
platform.architecture === "x86" ||
|
platform.architecture === "x86" ||
|
||||||
platform.architecture === "i686";
|
platform.architecture === "i686";
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -10,17 +10,14 @@ import { DiagnosticStatus } from '../omnisharp/protocol';
|
||||||
|
|
||||||
export class BackgroundWorkStatusBarObserver extends BaseStatusBarItemObserver {
|
export class BackgroundWorkStatusBarObserver extends BaseStatusBarItemObserver {
|
||||||
public post = (event: BaseEvent) => {
|
public post = (event: BaseEvent) => {
|
||||||
if(event.type === EventType.ProjectDiagnosticStatus)
|
if (event.type === EventType.ProjectDiagnosticStatus) {
|
||||||
{
|
|
||||||
let asProjectEvent = <OmnisharpProjectDiagnosticStatus>event;
|
let asProjectEvent = <OmnisharpProjectDiagnosticStatus>event;
|
||||||
|
|
||||||
if(asProjectEvent.message.Status === DiagnosticStatus.Processing)
|
if (asProjectEvent.message.Status === DiagnosticStatus.Processing) {
|
||||||
{
|
|
||||||
let projectFile = asProjectEvent.message.ProjectFilePath.replace(/^.*[\\\/]/, '');
|
let projectFile = asProjectEvent.message.ProjectFilePath.replace(/^.*[\\\/]/, '');
|
||||||
this.SetAndShowStatusBar(`$(sync~spin) Analyzing ${projectFile}`, 'o.showOutput', null, `Analyzing ${projectFile}`);
|
this.SetAndShowStatusBar(`$(sync~spin) Analyzing ${projectFile}`, 'o.showOutput', null, `Analyzing ${projectFile}`);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
this.ResetAndHideStatusBar();
|
this.ResetAndHideStatusBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ export abstract class BaseLoggerObserver {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.logger = new Logger((message) => channel.append(message));
|
this.logger = new Logger((message) => channel.append(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract post: (event: BaseEvent) => void;
|
abstract post: (event: BaseEvent) => void;
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ export class DotnetLoggerObserver extends BaseLoggerObserver {
|
||||||
break;
|
break;
|
||||||
case EventType.CommandDotNetRestoreSucceeded:
|
case EventType.CommandDotNetRestoreSucceeded:
|
||||||
this.logger.appendLine((<CommandDotNetRestoreSucceeded>event).message);
|
this.logger.appendLine((<CommandDotNetRestoreSucceeded>event).message);
|
||||||
break;
|
break;
|
||||||
case EventType.CommandDotNetRestoreFailed:
|
case EventType.CommandDotNetRestoreFailed:
|
||||||
this.logger.appendLine((<CommandDotNetRestoreFailed>event).message);
|
this.logger.appendLine((<CommandDotNetRestoreFailed>event).message);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,10 +11,10 @@ export default class DotnetTestChannelObserver extends BaseChannelObserver {
|
||||||
public post = (event: BaseEvent) => {
|
public post = (event: BaseEvent) => {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case EventType.DotNetTestRunStart:
|
case EventType.DotNetTestRunStart:
|
||||||
case EventType.DotNetTestRunFailure:
|
case EventType.DotNetTestRunFailure:
|
||||||
case EventType.DotNetTestsInClassRunStart:
|
case EventType.DotNetTestsInClassRunStart:
|
||||||
case EventType.DotNetTestDebugStart:
|
case EventType.DotNetTestDebugStart:
|
||||||
case EventType.DotNetTestsInClassDebugStart:
|
case EventType.DotNetTestsInClassDebugStart:
|
||||||
this.showChannel(true);
|
this.showChannel(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ export class ErrorMessageObserver {
|
||||||
this.handleDotNetTestDebugStartFailure(<DotNetTestDebugStartFailure>event);
|
this.handleDotNetTestDebugStartFailure(<DotNetTestDebugStartFailure>event);
|
||||||
break;
|
break;
|
||||||
case EventType.IntegrityCheckFailure:
|
case EventType.IntegrityCheckFailure:
|
||||||
this.handleIntegrityCheckFailure(<IntegrityCheckFailure> event);
|
this.handleIntegrityCheckFailure(<IntegrityCheckFailure>event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ export class ErrorMessageObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleDotnetTestRunFailure(event: DotNetTestRunFailure) {
|
private handleDotnetTestRunFailure(event: DotNetTestRunFailure) {
|
||||||
showErrorMessage(this.vscode,`Failed to run test because ${event.message}.`);
|
showErrorMessage(this.vscode, `Failed to run test because ${event.message}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleDotNetTestDebugStartFailure(event: DotNetTestDebugStartFailure) {
|
private handleDotNetTestDebugStartFailure(event: DotNetTestDebugStartFailure) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import * as ObservableEvent from "../omnisharp/loggingEvents";
|
import * as ObservableEvent from "../omnisharp/loggingEvents";
|
||||||
import { vscode } from '../vscodeAdapter';
|
import { vscode } from '../vscodeAdapter';
|
||||||
import showInformationMessage from "./utils/ShowInformationMessage";
|
import showInformationMessage from "./utils/ShowInformationMessage";
|
||||||
import { EventType } from "../omnisharp/EventType";
|
import { EventType } from "../omnisharp/EventType";
|
||||||
|
|
||||||
export class InformationMessageObserver {
|
export class InformationMessageObserver {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { vscode } from "../vscodeAdapter";
|
import { vscode } from "../vscodeAdapter";
|
||||||
|
@ -8,11 +8,11 @@ import { Options } from "../omnisharp/options";
|
||||||
import ShowInformationMessage from "./utils/ShowInformationMessage";
|
import ShowInformationMessage from "./utils/ShowInformationMessage";
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
import Disposable from "../Disposable";
|
import Disposable from "../Disposable";
|
||||||
import { filter} from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
|
|
||||||
function ConfigChangeObservable(optionObservable: Observable<Options>): Observable<Options> {
|
function ConfigChangeObservable(optionObservable: Observable<Options>): Observable<Options> {
|
||||||
let options: Options;
|
let options: Options;
|
||||||
return optionObservable.pipe( filter(newOptions => {
|
return optionObservable.pipe(filter(newOptions => {
|
||||||
let changed = (options && hasChanged(options, newOptions));
|
let changed = (options && hasChanged(options, newOptions));
|
||||||
options = newOptions;
|
options = newOptions;
|
||||||
return changed;
|
return changed;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Options } from "../omnisharp/options";
|
import { Options } from "../omnisharp/options";
|
||||||
import { Subscription , Observable } from "rxjs";
|
import { Subscription, Observable } from "rxjs";
|
||||||
export default class OptionProvider {
|
export default class OptionProvider {
|
||||||
private options: Options;
|
private options: Options;
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import {debounceTime} from 'rxjs/operators';
|
import { debounceTime } from 'rxjs/operators';
|
||||||
import { vscode } from '../vscodeAdapter';
|
import { vscode } from '../vscodeAdapter';
|
||||||
import { BaseEvent, OmnisharpServerMsBuildProjectDiagnostics } from "../omnisharp/loggingEvents";
|
import { BaseEvent, OmnisharpServerMsBuildProjectDiagnostics } from "../omnisharp/loggingEvents";
|
||||||
import { Scheduler , Subject } from 'rxjs';
|
import { Scheduler, Subject } from 'rxjs';
|
||||||
|
|
||||||
import showWarningMessage from './utils/ShowWarningMessage';
|
import showWarningMessage from './utils/ShowWarningMessage';
|
||||||
import { EventType } from '../omnisharp/EventType';
|
import { EventType } from '../omnisharp/EventType';
|
||||||
|
|
|
@ -22,17 +22,17 @@ type RemapParameterType<M extends keyof RemapApi> = GetRemapType<NonNullable<Rem
|
||||||
|
|
||||||
export class LanguageMiddlewareFeature implements IDisposable {
|
export class LanguageMiddlewareFeature implements IDisposable {
|
||||||
private readonly _middlewares: LanguageMiddleware[];
|
private readonly _middlewares: LanguageMiddleware[];
|
||||||
private _registration : IDisposable;
|
private _registration: IDisposable;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._middlewares = [];
|
this._middlewares = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose() : void {
|
public dispose(): void {
|
||||||
this._registration.dispose();
|
this._registration.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public register() : void {
|
public register(): void {
|
||||||
this._registration = vscode.commands.registerCommand(
|
this._registration = vscode.commands.registerCommand(
|
||||||
'omnisharp.registerLanguageMiddleware', (middleware: LanguageMiddleware) => {
|
'omnisharp.registerLanguageMiddleware', (middleware: LanguageMiddleware) => {
|
||||||
this._middlewares.push(middleware);
|
this._middlewares.push(middleware);
|
||||||
|
@ -51,7 +51,7 @@ export class LanguageMiddlewareFeature implements IDisposable {
|
||||||
|
|
||||||
for (const middleware of languageMiddlewares) {
|
for (const middleware of languageMiddlewares) {
|
||||||
// Commit a type crime because we know better than the compiler
|
// Commit a type crime because we know better than the compiler
|
||||||
const method = <(p: P, c:vscode.CancellationToken)=>vscode.ProviderResult<P>>middleware[remapType];
|
const method = <(p: P, c: vscode.CancellationToken) => vscode.ProviderResult<P>>middleware[remapType];
|
||||||
if (!method) {
|
if (!method) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class OmnisharpManager {
|
||||||
return await this.InstallLatestAndReturnLaunchInfo(serverUrl, latestVersionFileServerPath, installPath, extensionPath);
|
return await this.InstallLatestAndReturnLaunchInfo(serverUrl, latestVersionFileServerPath, installPath, extensionPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the path is neither a valid path on disk not the string "latest", treat it as a version
|
// If the path is neither a valid path on disk not the string "latest", treat it as a version
|
||||||
return await this.InstallVersionAndReturnLaunchInfo(omnisharpPath, serverUrl, installPath, extensionPath);
|
return await this.InstallVersionAndReturnLaunchInfo(omnisharpPath, serverUrl, installPath, extensionPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ function resourcesToLaunchTargets(resources: vscode.Uri[]): LaunchTarget[] {
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
// * It should be possible to choose a .csproj as a launch target
|
// * It should be possible to choose a .csproj as a launch target
|
||||||
// * It should be possible to choose a .sln file even when no .csproj files are found
|
// * It should be possible to choose a .sln file even when no .csproj files are found
|
||||||
// within the root.
|
// within the root.
|
||||||
|
|
||||||
if (!Array.isArray(resources)) {
|
if (!Array.isArray(resources)) {
|
||||||
|
@ -262,7 +262,7 @@ async function launch(cwd: string, args: string[], launchInfo: LaunchInfo, platf
|
||||||
}
|
}
|
||||||
|
|
||||||
let monoInfo = await monoResolver.getGlobalMonoInfo(options);
|
let monoInfo = await monoResolver.getGlobalMonoInfo(options);
|
||||||
|
|
||||||
if (monoInfo) {
|
if (monoInfo) {
|
||||||
const launchPath = launchInfo.MonoLaunchPath || launchInfo.LaunchPath;
|
const launchPath = launchInfo.MonoLaunchPath || launchInfo.LaunchPath;
|
||||||
let childEnv = monoInfo.env;
|
let childEnv = monoInfo.env;
|
||||||
|
@ -327,16 +327,15 @@ function launchNix(launchPath: string, cwd: string, args: string[]): LaunchResul
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function launchNixMono(launchPath: string, cwd: string, args: string[], environment: NodeJS.ProcessEnv, useDebugger:boolean): LaunchResult {
|
function launchNixMono(launchPath: string, cwd: string, args: string[], environment: NodeJS.ProcessEnv, useDebugger: boolean): LaunchResult {
|
||||||
let argsCopy = args.slice(0); // create copy of details args
|
let argsCopy = args.slice(0); // create copy of details args
|
||||||
argsCopy.unshift(launchPath);
|
argsCopy.unshift(launchPath);
|
||||||
argsCopy.unshift("--assembly-loader=strict");
|
argsCopy.unshift("--assembly-loader=strict");
|
||||||
|
|
||||||
if (useDebugger)
|
if (useDebugger) {
|
||||||
{
|
argsCopy.unshift("--debug");
|
||||||
argsCopy.unshift("--debug");
|
argsCopy.unshift("--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555");
|
||||||
argsCopy.unshift("--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let process = spawn('mono', argsCopy, {
|
let process = spawn('mono', argsCopy, {
|
||||||
detached: false,
|
detached: false,
|
||||||
|
|
|
@ -88,244 +88,244 @@ export class TestExecutionCountReport implements BaseEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerOnError implements BaseEvent {
|
export class OmnisharpServerOnError implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerOnError;
|
type = EventType.OmnisharpServerOnError;
|
||||||
constructor(public errorMessage: protocol.ErrorMessage) { }
|
constructor(public errorMessage: protocol.ErrorMessage) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpProjectDiagnosticStatus implements BaseEvent {
|
export class OmnisharpProjectDiagnosticStatus implements BaseEvent {
|
||||||
type=EventType.ProjectDiagnosticStatus;
|
type = EventType.ProjectDiagnosticStatus;
|
||||||
constructor(public message: protocol.ProjectDiagnosticStatus) { }
|
constructor(public message: protocol.ProjectDiagnosticStatus) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerMsBuildProjectDiagnostics implements BaseEvent {
|
export class OmnisharpServerMsBuildProjectDiagnostics implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerMsBuildProjectDiagnostics;
|
type = EventType.OmnisharpServerMsBuildProjectDiagnostics;
|
||||||
constructor(public diagnostics: protocol.MSBuildProjectDiagnostics) { }
|
constructor(public diagnostics: protocol.MSBuildProjectDiagnostics) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerUnresolvedDependencies implements BaseEvent {
|
export class OmnisharpServerUnresolvedDependencies implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerUnresolvedDependencies;
|
type = EventType.OmnisharpServerUnresolvedDependencies;
|
||||||
constructor(public unresolvedDependencies: protocol.UnresolvedDependenciesMessage) { }
|
constructor(public unresolvedDependencies: protocol.UnresolvedDependenciesMessage) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerEnqueueRequest implements BaseEvent {
|
export class OmnisharpServerEnqueueRequest implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerEnqueueRequest;
|
type = EventType.OmnisharpServerEnqueueRequest;
|
||||||
constructor(public name: string, public command: string) { }
|
constructor(public name: string, public command: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerDequeueRequest implements BaseEvent {
|
export class OmnisharpServerDequeueRequest implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerDequeueRequest;
|
type = EventType.OmnisharpServerDequeueRequest;
|
||||||
constructor(public name: string, public command: string, public id: number) { }
|
constructor(public name: string, public command: string, public id: number) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerProcessRequestStart implements BaseEvent {
|
export class OmnisharpServerProcessRequestStart implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerProcessRequestStart;
|
type = EventType.OmnisharpServerProcessRequestStart;
|
||||||
constructor(public name: string) { }
|
constructor(public name: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpEventPacketReceived implements BaseEvent {
|
export class OmnisharpEventPacketReceived implements BaseEvent {
|
||||||
type=EventType.OmnisharpEventPacketReceived;
|
type = EventType.OmnisharpEventPacketReceived;
|
||||||
constructor(public logLevel: string, public name: string, public message: string) { }
|
constructor(public logLevel: string, public name: string, public message: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpServerOnServerError implements BaseEvent {
|
export class OmnisharpServerOnServerError implements BaseEvent {
|
||||||
type=EventType.OmnisharpServerOnServerError;
|
type = EventType.OmnisharpServerOnServerError;
|
||||||
constructor(public err: any) { }
|
constructor(public err: any) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OmnisharpOnMultipleLaunchTargets implements BaseEvent {
|
export class OmnisharpOnMultipleLaunchTargets implements BaseEvent {
|
||||||
type=EventType.OmnisharpOnMultipleLaunchTargets;
|
type = EventType.OmnisharpOnMultipleLaunchTargets;
|
||||||
constructor(public targets: LaunchTarget[]) { }
|
constructor(public targets: LaunchTarget[]) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ProjectConfiguration implements BaseEvent{
|
export class ProjectConfiguration implements BaseEvent {
|
||||||
type = EventType.ProjectConfigurationReceived;
|
type = EventType.ProjectConfigurationReceived;
|
||||||
constructor(public projectConfiguration: protocol.ProjectConfigurationMessage){}
|
constructor(public projectConfiguration: protocol.ProjectConfigurationMessage) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WorkspaceInformationUpdated implements BaseEvent {
|
export class WorkspaceInformationUpdated implements BaseEvent {
|
||||||
type=EventType.WorkspaceInformationUpdated;
|
type = EventType.WorkspaceInformationUpdated;
|
||||||
constructor(public info: protocol.WorkspaceInformationResponse) { }
|
constructor(public info: protocol.WorkspaceInformationResponse) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class EventWithMessage implements BaseEvent {
|
export class EventWithMessage implements BaseEvent {
|
||||||
type=EventType.EventWithMessage;
|
type = EventType.EventWithMessage;
|
||||||
constructor(public message: string) { }
|
constructor(public message: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DownloadStart implements BaseEvent {
|
export class DownloadStart implements BaseEvent {
|
||||||
type=EventType.DownloadStart;
|
type = EventType.DownloadStart;
|
||||||
constructor(public packageDescription: string) { }
|
constructor(public packageDescription: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DownloadFallBack implements BaseEvent {
|
export class DownloadFallBack implements BaseEvent {
|
||||||
type=EventType.DownloadFallBack;
|
type = EventType.DownloadFallBack;
|
||||||
constructor(public fallbackUrl: string) { }
|
constructor(public fallbackUrl: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DownloadSizeObtained implements BaseEvent {
|
export class DownloadSizeObtained implements BaseEvent {
|
||||||
type=EventType.DownloadSizeObtained;
|
type = EventType.DownloadSizeObtained;
|
||||||
constructor(public packageSize: number) { }
|
constructor(public packageSize: number) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ZipError implements BaseEvent {
|
export class ZipError implements BaseEvent {
|
||||||
type=EventType.ZipError;
|
type = EventType.ZipError;
|
||||||
constructor(public message: string) { }
|
constructor(public message: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ReportDotNetTestResults implements BaseEvent {
|
export class ReportDotNetTestResults implements BaseEvent {
|
||||||
type=EventType.ReportDotNetTestResults;
|
type = EventType.ReportDotNetTestResults;
|
||||||
constructor(public results: protocol.V2.DotNetTestResult[]) { }
|
constructor(public results: protocol.V2.DotNetTestResult[]) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DotNetTestRunStart implements BaseEvent {
|
export class DotNetTestRunStart implements BaseEvent {
|
||||||
type=EventType.DotNetTestRunStart;
|
type = EventType.DotNetTestRunStart;
|
||||||
constructor(public testMethod: string) { }
|
constructor(public testMethod: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DotNetTestDebugStart implements BaseEvent {
|
export class DotNetTestDebugStart implements BaseEvent {
|
||||||
type=EventType.DotNetTestDebugStart;
|
type = EventType.DotNetTestDebugStart;
|
||||||
constructor(public testMethod: string) { }
|
constructor(public testMethod: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DotNetTestDebugProcessStart implements BaseEvent {
|
export class DotNetTestDebugProcessStart implements BaseEvent {
|
||||||
type=EventType.DotNetTestDebugProcessStart;
|
type = EventType.DotNetTestDebugProcessStart;
|
||||||
constructor(public targetProcessId: number) { }
|
constructor(public targetProcessId: number) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DotNetTestsInClassRunStart implements BaseEvent {
|
export class DotNetTestsInClassRunStart implements BaseEvent {
|
||||||
type=EventType.DotNetTestsInClassRunStart;
|
type = EventType.DotNetTestsInClassRunStart;
|
||||||
constructor(public className: string) { }
|
constructor(public className: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DotNetTestsInClassDebugStart implements BaseEvent {
|
export class DotNetTestsInClassDebugStart implements BaseEvent {
|
||||||
type=EventType.DotNetTestsInClassDebugStart;
|
type = EventType.DotNetTestsInClassDebugStart;
|
||||||
constructor(public className: string) { }
|
constructor(public className: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DocumentSynchronizationFailure implements BaseEvent {
|
export class DocumentSynchronizationFailure implements BaseEvent {
|
||||||
type=EventType.DocumentSynchronizationFailure;
|
type = EventType.DocumentSynchronizationFailure;
|
||||||
constructor(public documentPath: string, public errorMessage: string) { }
|
constructor(public documentPath: string, public errorMessage: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class OpenURL {
|
export class OpenURL {
|
||||||
type=EventType.OpenURL;
|
type = EventType.OpenURL;
|
||||||
constructor(public url: string) { }
|
constructor(public url: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IntegrityCheckFailure {
|
export class IntegrityCheckFailure {
|
||||||
type=EventType.IntegrityCheckFailure;
|
type = EventType.IntegrityCheckFailure;
|
||||||
constructor(public packageDescription: string, public url: string, public retry: boolean){ }
|
constructor(public packageDescription: string, public url: string, public retry: boolean) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IntegrityCheckSuccess {
|
export class IntegrityCheckSuccess {
|
||||||
type=EventType.IntegrityCheckSuccess;
|
type = EventType.IntegrityCheckSuccess;
|
||||||
constructor() { }
|
constructor() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RazorPluginPathSpecified implements BaseEvent {
|
export class RazorPluginPathSpecified implements BaseEvent {
|
||||||
type=EventType.RazorPluginPathSpecified;
|
type = EventType.RazorPluginPathSpecified;
|
||||||
constructor(public path: string) {}
|
constructor(public path: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RazorPluginPathDoesNotExist implements BaseEvent {
|
export class RazorPluginPathDoesNotExist implements BaseEvent {
|
||||||
type=EventType.RazorPluginPathDoesNotExist;
|
type = EventType.RazorPluginPathDoesNotExist;
|
||||||
constructor(public path: string) {}
|
constructor(public path: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DebuggerPrerequisiteFailure extends EventWithMessage {
|
export class DebuggerPrerequisiteFailure extends EventWithMessage {
|
||||||
type = EventType.DebuggerPrerequisiteFailure;
|
type = EventType.DebuggerPrerequisiteFailure;
|
||||||
}
|
}
|
||||||
export class DebuggerPrerequisiteWarning extends EventWithMessage {
|
export class DebuggerPrerequisiteWarning extends EventWithMessage {
|
||||||
type = EventType.DebuggerPrerequisiteWarning;
|
type = EventType.DebuggerPrerequisiteWarning;
|
||||||
}
|
}
|
||||||
export class CommandDotNetRestoreProgress extends EventWithMessage {
|
export class CommandDotNetRestoreProgress extends EventWithMessage {
|
||||||
type = EventType.CommandDotNetRestoreProgress;
|
type = EventType.CommandDotNetRestoreProgress;
|
||||||
}
|
}
|
||||||
export class CommandDotNetRestoreSucceeded extends EventWithMessage {
|
export class CommandDotNetRestoreSucceeded extends EventWithMessage {
|
||||||
type = EventType.CommandDotNetRestoreSucceeded;
|
type = EventType.CommandDotNetRestoreSucceeded;
|
||||||
}
|
}
|
||||||
export class CommandDotNetRestoreFailed extends EventWithMessage {
|
export class CommandDotNetRestoreFailed extends EventWithMessage {
|
||||||
type = EventType.CommandDotNetRestoreFailed;
|
type = EventType.CommandDotNetRestoreFailed;
|
||||||
}
|
}
|
||||||
export class DownloadSuccess extends EventWithMessage {
|
export class DownloadSuccess extends EventWithMessage {
|
||||||
type = EventType.DownloadSuccess;
|
type = EventType.DownloadSuccess;
|
||||||
}
|
}
|
||||||
export class DownloadFailure extends EventWithMessage {
|
export class DownloadFailure extends EventWithMessage {
|
||||||
type = EventType.DownloadFailure;
|
type = EventType.DownloadFailure;
|
||||||
}
|
}
|
||||||
export class OmnisharpServerOnStdErr extends EventWithMessage {
|
export class OmnisharpServerOnStdErr extends EventWithMessage {
|
||||||
type = EventType.OmnisharpServerOnStdErr;
|
type = EventType.OmnisharpServerOnStdErr;
|
||||||
}
|
}
|
||||||
export class OmnisharpServerMessage extends EventWithMessage {
|
export class OmnisharpServerMessage extends EventWithMessage {
|
||||||
type = EventType.OmnisharpServerMessage;
|
type = EventType.OmnisharpServerMessage;
|
||||||
}
|
}
|
||||||
export class OmnisharpServerVerboseMessage extends EventWithMessage {
|
export class OmnisharpServerVerboseMessage extends EventWithMessage {
|
||||||
type = EventType.OmnisharpServerVerboseMessage;
|
type = EventType.OmnisharpServerVerboseMessage;
|
||||||
}
|
}
|
||||||
export class DotNetTestMessage extends EventWithMessage {
|
export class DotNetTestMessage extends EventWithMessage {
|
||||||
type = EventType.DotNetTestMessage;
|
type = EventType.DotNetTestMessage;
|
||||||
}
|
}
|
||||||
export class DotNetTestRunFailure extends EventWithMessage {
|
export class DotNetTestRunFailure extends EventWithMessage {
|
||||||
type = EventType.DotNetTestRunFailure;
|
type = EventType.DotNetTestRunFailure;
|
||||||
}
|
}
|
||||||
export class DotNetTestDebugWarning extends EventWithMessage {
|
export class DotNetTestDebugWarning extends EventWithMessage {
|
||||||
type = EventType.DotNetTestDebugWarning;
|
type = EventType.DotNetTestDebugWarning;
|
||||||
}
|
}
|
||||||
export class DotNetTestDebugStartFailure extends EventWithMessage {
|
export class DotNetTestDebugStartFailure extends EventWithMessage {
|
||||||
type = EventType.DotNetTestDebugStartFailure;
|
type = EventType.DotNetTestDebugStartFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RazorDevModeActive implements BaseEvent {
|
export class RazorDevModeActive implements BaseEvent {
|
||||||
type = EventType.RazorDevModeActive;
|
type = EventType.RazorDevModeActive;
|
||||||
}
|
}
|
||||||
export class ProjectModified implements BaseEvent {
|
export class ProjectModified implements BaseEvent {
|
||||||
type = EventType.ProjectModified;
|
type = EventType.ProjectModified;
|
||||||
}
|
}
|
||||||
export class ActivationFailure implements BaseEvent {
|
export class ActivationFailure implements BaseEvent {
|
||||||
type = EventType.ActivationFailure;
|
type = EventType.ActivationFailure;
|
||||||
}
|
}
|
||||||
export class ShowOmniSharpChannel implements BaseEvent {
|
export class ShowOmniSharpChannel implements BaseEvent {
|
||||||
type = EventType.ShowOmniSharpChannel;
|
type = EventType.ShowOmniSharpChannel;
|
||||||
}
|
}
|
||||||
export class DebuggerNotInstalledFailure implements BaseEvent {
|
export class DebuggerNotInstalledFailure implements BaseEvent {
|
||||||
type = EventType.DebuggerNotInstalledFailure;
|
type = EventType.DebuggerNotInstalledFailure;
|
||||||
}
|
}
|
||||||
export class CommandDotNetRestoreStart implements BaseEvent {
|
export class CommandDotNetRestoreStart implements BaseEvent {
|
||||||
type = EventType.CommandDotNetRestoreStart;
|
type = EventType.CommandDotNetRestoreStart;
|
||||||
}
|
}
|
||||||
export class InstallationSuccess implements BaseEvent {
|
export class InstallationSuccess implements BaseEvent {
|
||||||
type = EventType.InstallationSuccess;
|
type = EventType.InstallationSuccess;
|
||||||
}
|
}
|
||||||
export class OmnisharpServerProcessRequestComplete implements BaseEvent {
|
export class OmnisharpServerProcessRequestComplete implements BaseEvent {
|
||||||
type = EventType.OmnisharpServerProcessRequestComplete;
|
type = EventType.OmnisharpServerProcessRequestComplete;
|
||||||
}
|
}
|
||||||
export class ProjectJsonDeprecatedWarning implements BaseEvent {
|
export class ProjectJsonDeprecatedWarning implements BaseEvent {
|
||||||
type = EventType.ProjectJsonDeprecatedWarning;
|
type = EventType.ProjectJsonDeprecatedWarning;
|
||||||
}
|
}
|
||||||
export class OmnisharpOnBeforeServerStart implements BaseEvent {
|
export class OmnisharpOnBeforeServerStart implements BaseEvent {
|
||||||
type = EventType.OmnisharpOnBeforeServerStart;
|
type = EventType.OmnisharpOnBeforeServerStart;
|
||||||
}
|
}
|
||||||
export class OmnisharpOnBeforeServerInstall implements BaseEvent {
|
export class OmnisharpOnBeforeServerInstall implements BaseEvent {
|
||||||
type = EventType.OmnisharpOnBeforeServerInstall;
|
type = EventType.OmnisharpOnBeforeServerInstall;
|
||||||
}
|
}
|
||||||
export class ActiveTextEditorChanged implements BaseEvent {
|
export class ActiveTextEditorChanged implements BaseEvent {
|
||||||
type = EventType.ActiveTextEditorChanged;
|
type = EventType.ActiveTextEditorChanged;
|
||||||
}
|
}
|
||||||
export class OmnisharpServerOnStop implements BaseEvent {
|
export class OmnisharpServerOnStop implements BaseEvent {
|
||||||
type = EventType.OmnisharpServerOnStop;
|
type = EventType.OmnisharpServerOnStop;
|
||||||
}
|
}
|
||||||
export class OmnisharpServerOnStart implements BaseEvent {
|
export class OmnisharpServerOnStart implements BaseEvent {
|
||||||
type = EventType.OmnisharpServerOnStart;
|
type = EventType.OmnisharpServerOnStart;
|
||||||
}
|
}
|
||||||
export class LatestBuildDownloadStart implements BaseEvent {
|
export class LatestBuildDownloadStart implements BaseEvent {
|
||||||
type = EventType.LatestBuildDownloadStart;
|
type = EventType.LatestBuildDownloadStart;
|
||||||
}
|
}
|
||||||
export class OmnisharpRestart implements BaseEvent {
|
export class OmnisharpRestart implements BaseEvent {
|
||||||
type = EventType.OmnisharpRestart;
|
type = EventType.OmnisharpRestart;
|
||||||
}
|
}
|
||||||
export class DotNetTestDebugComplete implements BaseEvent {
|
export class DotNetTestDebugComplete implements BaseEvent {
|
||||||
type = EventType.DotNetTestDebugComplete;
|
type = EventType.DotNetTestDebugComplete;
|
||||||
}
|
}
|
||||||
export class DownloadValidation implements BaseEvent {
|
export class DownloadValidation implements BaseEvent {
|
||||||
type = EventType.DownloadValidation;
|
type = EventType.DownloadValidation;
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ import * as ObservableEvents from './loggingEvents';
|
||||||
import { EventStream } from '../EventStream';
|
import { EventStream } from '../EventStream';
|
||||||
import { NetworkSettingsProvider } from '../NetworkSettings';
|
import { NetworkSettingsProvider } from '../NetworkSettings';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import {debounceTime} from 'rxjs/operators';
|
import { debounceTime } from 'rxjs/operators';
|
||||||
import CompositeDisposable from '../CompositeDisposable';
|
import CompositeDisposable from '../CompositeDisposable';
|
||||||
import Disposable from '../Disposable';
|
import Disposable from '../Disposable';
|
||||||
import OptionProvider from '../observers/OptionProvider';
|
import OptionProvider from '../observers/OptionProvider';
|
||||||
|
@ -333,11 +333,10 @@ export class OmniSharpServer {
|
||||||
args.push('--debug');
|
args.push('--debug');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < options.excludePaths.length; i++)
|
for (let i = 0; i < options.excludePaths.length; i++) {
|
||||||
{
|
|
||||||
args.push(`FileOptions:SystemExcludeSearchPatterns:${i}=${options.excludePaths[i]}`);
|
args.push(`FileOptions:SystemExcludeSearchPatterns:${i}=${options.excludePaths[i]}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.enableMsBuildLoadProjectsOnDemand === true) {
|
if (options.enableMsBuildLoadProjectsOnDemand === true) {
|
||||||
args.push('MsBuild:LoadProjectsOnDemand=true');
|
args.push('MsBuild:LoadProjectsOnDemand=true');
|
||||||
}
|
}
|
||||||
|
@ -390,7 +389,7 @@ export class OmniSharpServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onProjectConfigurationReceived(listener: (e: protocol.ProjectConfigurationMessage) => void){
|
private onProjectConfigurationReceived(listener: (e: protocol.ProjectConfigurationMessage) => void) {
|
||||||
return this._addListener(Events.ProjectConfiguration, listener);
|
return this._addListener(Events.ProjectConfiguration, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { isAbsolute, resolve } from "path";
|
import { isAbsolute, resolve } from "path";
|
||||||
|
|
||||||
export class AbsolutePath{
|
export class AbsolutePath {
|
||||||
constructor(public value: string) {
|
constructor(public value: string) {
|
||||||
if (!isAbsolute(value)) {
|
if (!isAbsolute(value)) {
|
||||||
throw new Error("The path must be absolute");
|
throw new Error("The path must be absolute");
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { Package } from "./Package";
|
||||||
import { IPackage } from "./IPackage";
|
import { IPackage } from "./IPackage";
|
||||||
import { AbsolutePath } from "./AbsolutePath";
|
import { AbsolutePath } from "./AbsolutePath";
|
||||||
|
|
||||||
export class AbsolutePathPackage implements IPackage{
|
export class AbsolutePathPackage implements IPackage {
|
||||||
constructor(public id: string,
|
constructor(public id: string,
|
||||||
public description: string,
|
public description: string,
|
||||||
public url: string,
|
public url: string,
|
||||||
|
@ -15,7 +15,7 @@ export class AbsolutePathPackage implements IPackage{
|
||||||
public architectures: string[],
|
public architectures: string[],
|
||||||
public binaries: AbsolutePath[],
|
public binaries: AbsolutePath[],
|
||||||
public installPath?: AbsolutePath,
|
public installPath?: AbsolutePath,
|
||||||
public installTestPath?: AbsolutePath,
|
public installTestPath?: AbsolutePath,
|
||||||
public fallbackUrl?: string,
|
public fallbackUrl?: string,
|
||||||
public platformId?: string,
|
public platformId?: string,
|
||||||
public integrity?: string) {
|
public integrity?: string) {
|
||||||
|
@ -38,27 +38,27 @@ export class AbsolutePathPackage implements IPackage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAbsoluteInstallTestPath(pkg: Package, extensionPath: string): AbsolutePath {
|
function getAbsoluteInstallTestPath(pkg: Package, extensionPath: string): AbsolutePath {
|
||||||
if (pkg.installTestPath) {
|
if (pkg.installTestPath) {
|
||||||
return AbsolutePath.getAbsolutePath(extensionPath, pkg.installTestPath);
|
return AbsolutePath.getAbsolutePath(extensionPath, pkg.installTestPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAbsoluteBinaries(pkg: Package, extensionPath: string): AbsolutePath[] {
|
function getAbsoluteBinaries(pkg: Package, extensionPath: string): AbsolutePath[] {
|
||||||
let basePath = getAbsoluteInstallPath(pkg, extensionPath).value;
|
let basePath = getAbsoluteInstallPath(pkg, extensionPath).value;
|
||||||
if (pkg.binaries) {
|
if (pkg.binaries) {
|
||||||
return pkg.binaries.map(value => AbsolutePath.getAbsolutePath(basePath, value));
|
return pkg.binaries.map(value => AbsolutePath.getAbsolutePath(basePath, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAbsoluteInstallPath(pkg: Package, extensionPath: string): AbsolutePath {
|
function getAbsoluteInstallPath(pkg: Package, extensionPath: string): AbsolutePath {
|
||||||
if (pkg.installPath) {
|
if (pkg.installPath) {
|
||||||
return AbsolutePath.getAbsolutePath(extensionPath, pkg.installPath);
|
return AbsolutePath.getAbsolutePath(extensionPath, pkg.installPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AbsolutePath(extensionPath);
|
return new AbsolutePath(extensionPath);
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@ export async function DownloadFile(description: string, eventStream: EventStream
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
catch (primaryUrlError) {
|
catch (primaryUrlError) {
|
||||||
// If the package has a fallback Url, and downloading from the primary Url failed, try again from
|
// If the package has a fallback Url, and downloading from the primary Url failed, try again from
|
||||||
// the fallback. This is used for debugger packages as some users have had issues downloading from
|
// the fallback. This is used for debugger packages as some users have had issues downloading from
|
||||||
// the CDN link
|
// the CDN link
|
||||||
if (fallbackUrl) {
|
if (fallbackUrl) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { IPackage } from "./IPackage";
|
import { IPackage } from "./IPackage";
|
||||||
|
|
||||||
export interface Package extends IPackage{
|
export interface Package extends IPackage {
|
||||||
installPath?: string;
|
installPath?: string;
|
||||||
binaries: string[];
|
binaries: string[];
|
||||||
installTestPath?: string;
|
installTestPath?: string;
|
||||||
|
|
|
@ -44,5 +44,5 @@ async function filterAlreadyInstalledPackages(packages: AbsolutePathPackage[]):
|
||||||
}
|
}
|
||||||
|
|
||||||
return !(await util.fileExists(testPath));
|
return !(await util.fileExists(testPath));
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -9,8 +9,7 @@ import { getNotInstalledPackagesForPlatform } from "./PackageFilterer";
|
||||||
import { Package } from "./Package";
|
import { Package } from "./Package";
|
||||||
|
|
||||||
export async function getAbsolutePathPackagesToInstall(packages: Package[], platformInfo: PlatformInformation, extensionPath: string): Promise<AbsolutePathPackage[]> {
|
export async function getAbsolutePathPackagesToInstall(packages: Package[], platformInfo: PlatformInformation, extensionPath: string): Promise<AbsolutePathPackage[]> {
|
||||||
if (packages && packages.length>0)
|
if (packages && packages.length > 0) {
|
||||||
{
|
|
||||||
let absolutePathPackages = packages.map(pkg => AbsolutePathPackage.getAbsolutePathPackage(pkg, extensionPath));
|
let absolutePathPackages = packages.map(pkg => AbsolutePathPackage.getAbsolutePathPackage(pkg, extensionPath));
|
||||||
return getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
|
return getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ export interface DownloadValidator {
|
||||||
export function isValidDownload(buffer: Buffer, integrity: string, eventStream: EventStream): boolean {
|
export function isValidDownload(buffer: Buffer, integrity: string, eventStream: EventStream): boolean {
|
||||||
if (integrity && integrity.length > 0) {
|
if (integrity && integrity.length > 0) {
|
||||||
eventStream.post(new DownloadValidation());
|
eventStream.post(new DownloadValidation());
|
||||||
let value = getBufferIntegrityHash(buffer);
|
let value = getBufferIntegrityHash(buffer);
|
||||||
if (value == integrity.toUpperCase()) {
|
if (value == integrity.toUpperCase()) {
|
||||||
eventStream.post(new IntegrityCheckSuccess());
|
eventStream.post(new IntegrityCheckSuccess());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ export function isValidDownload(buffer: Buffer, integrity: string, eventStream:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBufferIntegrityHash(buffer: Buffer) : string {
|
export function getBufferIntegrityHash(buffer: Buffer): string {
|
||||||
let hash = crypto.createHash('sha256');
|
let hash = crypto.createHash('sha256');
|
||||||
hash.update(buffer);
|
hash.update(buffer);
|
||||||
let value = hash.digest('hex').toUpperCase();
|
let value = hash.digest('hex').toUpperCase();
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function getProxyAgent(requestURL: Url, proxy: string, strictSSL: boolean
|
||||||
if (!proxyURL) {
|
if (!proxyURL) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const proxyEndpoint = parseUrl(proxyURL);
|
const proxyEndpoint = parseUrl(proxyURL);
|
||||||
|
|
||||||
if (!/^https?:$/.test(proxyEndpoint.protocol)) {
|
if (!/^https?:$/.test(proxyEndpoint.protocol)) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ export class LinuxDistribution {
|
||||||
public static FromReleaseInfo(releaseInfo: string, eol: string = os.EOL): LinuxDistribution {
|
public static FromReleaseInfo(releaseInfo: string, eol: string = os.EOL): LinuxDistribution {
|
||||||
let name = unknown;
|
let name = unknown;
|
||||||
let version = unknown;
|
let version = unknown;
|
||||||
let idLike : string[] = null;
|
let idLike: string[] = null;
|
||||||
|
|
||||||
const lines = releaseInfo.split(eol);
|
const lines = releaseInfo.split(eol);
|
||||||
for (let line of lines) {
|
for (let line of lines) {
|
||||||
|
@ -118,8 +118,7 @@ export class PlatformInformation {
|
||||||
public constructor(
|
public constructor(
|
||||||
public platform: string,
|
public platform: string,
|
||||||
public architecture: string,
|
public architecture: string,
|
||||||
public distribution: LinuxDistribution = null)
|
public distribution: LinuxDistribution = null) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public isWindows(): boolean {
|
public isWindows(): boolean {
|
||||||
|
@ -182,7 +181,7 @@ export class PlatformInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
const platformData: [string, LinuxDistribution] = await Promise.all([architecturePromise, distributionPromise]);
|
const platformData: [string, LinuxDistribution] = await Promise.all([architecturePromise, distributionPromise]);
|
||||||
|
|
||||||
return new PlatformInformation(platform, platformData[0], platformData[1]);
|
return new PlatformInformation(platform, platformData[0], platformData[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,15 @@ import * as vscode from 'vscode';
|
||||||
|
|
||||||
export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
|
export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
|
||||||
|
|
||||||
get alignment(): vscodeAdapter.StatusBarAlignment{
|
get alignment(): vscodeAdapter.StatusBarAlignment {
|
||||||
return this.statusBarItem.alignment;
|
return this.statusBarItem.alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
get priority(): number{
|
get priority(): number {
|
||||||
return this.statusBarItem.priority;
|
return this.statusBarItem.priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
get text(): string{
|
get text(): string {
|
||||||
return this.statusBarItem.text;
|
return this.statusBarItem.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,15 @@ export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
|
||||||
this.statusBarItem.text = value;
|
this.statusBarItem.text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get tooltip(): string{
|
get tooltip(): string {
|
||||||
return this.statusBarItem.tooltip;
|
return this.statusBarItem.tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
set tooltip(value: string){
|
set tooltip(value: string) {
|
||||||
this.statusBarItem.tooltip = value;
|
this.statusBarItem.tooltip = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get color(): string{
|
get color(): string {
|
||||||
return this.statusBarItem.color as string;
|
return this.statusBarItem.color as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
|
||||||
this.statusBarItem.color = value;
|
this.statusBarItem.color = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get command(): string{
|
get command(): string {
|
||||||
return this.statusBarItem.command;
|
return this.statusBarItem.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
|
||||||
dispose(): void {
|
dispose(): void {
|
||||||
this.statusBarItem.dispose();
|
this.statusBarItem.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private statusBarItem: vscode.StatusBarItem) {
|
constructor(private statusBarItem: vscode.StatusBarItem) {
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ import * as vscodeAdapter from './vscodeAdapter';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
export class TextEditorAdapter implements vscodeAdapter.TextEditor {
|
export class TextEditorAdapter implements vscodeAdapter.TextEditor {
|
||||||
|
|
||||||
get document(): any {
|
get document(): any {
|
||||||
return this.textEditor.document;
|
return this.textEditor.document;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ function AppendFieldsToObject(reference: any, obj: any) {
|
||||||
// Make sure it is an object type
|
// Make sure it is an object type
|
||||||
if (typeof obj == 'object') {
|
if (typeof obj == 'object') {
|
||||||
for (let referenceKey in reference) {
|
for (let referenceKey in reference) {
|
||||||
// If key exists in original object and is an object.
|
// If key exists in original object and is an object.
|
||||||
if (obj.hasOwnProperty(referenceKey)) {
|
if (obj.hasOwnProperty(referenceKey)) {
|
||||||
obj[referenceKey] = AppendFieldsToObject(reference[referenceKey], obj[referenceKey]);
|
obj[referenceKey] = AppendFieldsToObject(reference[referenceKey], obj[referenceKey]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,7 +24,7 @@ function AppendFieldsToObject(reference: any, obj: any) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combines two object's fields, giving the parentDefault a higher precedence.
|
// Combines two object's fields, giving the parentDefault a higher precedence.
|
||||||
function MergeDefaults(parentDefault: any, childDefault: any) {
|
function MergeDefaults(parentDefault: any, childDefault: any) {
|
||||||
let newDefault: any = {};
|
let newDefault: any = {};
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ function ReplaceReferences(definitions: any, objects: any) {
|
||||||
delete objects[key]['$ref'];
|
delete objects[key]['$ref'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursively replace references if this object has properties.
|
// Recursively replace references if this object has properties.
|
||||||
if (objects[key].hasOwnProperty('type') && objects[key].type === 'object' && objects[key].properties !== null) {
|
if (objects[key].hasOwnProperty('type') && objects[key].type === 'object' && objects[key].properties !== null) {
|
||||||
objects[key].properties = ReplaceReferences(definitions, objects[key].properties);
|
objects[key].properties = ReplaceReferences(definitions, objects[key].properties);
|
||||||
objects[key].properties = UpdateDefaults(objects[key].properties, objects[key].default);
|
objects[key].properties = UpdateDefaults(objects[key].properties, objects[key].default);
|
||||||
|
@ -85,7 +85,7 @@ function ReplaceReferences(definitions: any, objects: any) {
|
||||||
return objects;
|
return objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeReferences(baseDefinitions: any, additionalDefinitions: any) : void {
|
function mergeReferences(baseDefinitions: any, additionalDefinitions: any): void {
|
||||||
for (let key in additionalDefinitions) {
|
for (let key in additionalDefinitions) {
|
||||||
if (baseDefinitions[key]) {
|
if (baseDefinitions[key]) {
|
||||||
throw `Error: '${key}' defined in multiple schema files.`;
|
throw `Error: '${key}' defined in multiple schema files.`;
|
||||||
|
@ -138,7 +138,7 @@ export function GenerateOptionsSchema() {
|
||||||
if (os.platform() === 'win32') {
|
if (os.platform() === 'win32') {
|
||||||
content = content.replace(/\n/gm, "\r\n");
|
content = content.replace(/\n/gm, "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We use '\u200b' (unicode zero-length space character) to break VS Code's URL detection regex for URLs that are examples. This process will
|
// We use '\u200b' (unicode zero-length space character) to break VS Code's URL detection regex for URLs that are examples. This process will
|
||||||
// convert that from the readable espace sequence, to just an invisible character. Convert it back to the visible espace sequence.
|
// convert that from the readable espace sequence, to just an invisible character. Convert it back to the visible espace sequence.
|
||||||
content = content.replace(/\u200b/gm, "\\u200b");
|
content = content.replace(/\u200b/gm, "\\u200b");
|
||||||
|
|
|
@ -87,7 +87,7 @@ export async function updatePackageDependencies(): Promise<void> {
|
||||||
verifyVersionSubstringCount(dependency.installTestPath);
|
verifyVersionSubstringCount(dependency.installTestPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next take another pass to try and update to the URL
|
// Next take another pass to try and update to the URL
|
||||||
const eventStream = new EventStream();
|
const eventStream = new EventStream();
|
||||||
eventStream.subscribe((event: Event.BaseEvent) => {
|
eventStream.subscribe((event: Event.BaseEvent) => {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
@ -169,11 +169,11 @@ function verifyVersionSubstringCount(value: string, shouldContainVersion = false
|
||||||
regexp.lastIndex = 0;
|
regexp.lastIndex = 0;
|
||||||
return retVal;
|
return retVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dottedMatches: number = getMatchCount(dottedVersionRegExp, value);
|
const dottedMatches: number = getMatchCount(dottedVersionRegExp, value);
|
||||||
const dashedMatches: number = getMatchCount(dashedVersionRegExp, value);
|
const dashedMatches: number = getMatchCount(dashedVersionRegExp, value);
|
||||||
const matchCount: number = dottedMatches + dashedMatches;
|
const matchCount: number = dottedMatches + dashedMatches;
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
const removeBomBuffer = require("remove-bom-buffer");
|
const removeBomBuffer = require("remove-bom-buffer");
|
||||||
const removeBomString = require("strip-bom");
|
const removeBomString = require("strip-bom");
|
||||||
|
|
||||||
export function removeBOMFromBuffer(buffer: Buffer): Buffer{
|
export function removeBOMFromBuffer(buffer: Buffer): Buffer {
|
||||||
return <Buffer> removeBomBuffer(buffer);
|
return <Buffer>removeBomBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeBOMFromString(line: string): string{
|
export function removeBOMFromString(line: string): string {
|
||||||
return removeBomString(line.trim());
|
return removeBomString(line.trim());
|
||||||
}
|
}
|
|
@ -40,13 +40,13 @@ gulp.task('vsix:offline:package', async () => {
|
||||||
|
|
||||||
async function doPackageOffline() {
|
async function doPackageOffline() {
|
||||||
if (commandLineOptions.retainVsix) {
|
if (commandLineOptions.retainVsix) {
|
||||||
//if user doesnot want to clean up the existing vsix packages
|
//if user doesnot want to clean up the existing vsix packages
|
||||||
cleanSync(false);
|
cleanSync(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cleanSync(true);
|
cleanSync(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const packageJSON = getPackageJSON();
|
const packageJSON = getPackageJSON();
|
||||||
const name = packageJSON.name;
|
const name = packageJSON.name;
|
||||||
const version = packageJSON.version;
|
const version = packageJSON.version;
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
export function getPackageJSON() {
|
export function getPackageJSON() {
|
||||||
return JSON.parse(fs.readFileSync('package.json').toString());
|
return JSON.parse(fs.readFileSync('package.json').toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,13 @@ import { SpawnOptions, spawn } from "child_process";
|
||||||
import { nodePath, rootPath } from "./projectPaths";
|
import { nodePath, rootPath } from "./projectPaths";
|
||||||
const { join } = require("async-child-process");
|
const { join } = require("async-child-process");
|
||||||
|
|
||||||
export default async function spawnNode(args?: string[], options?: SpawnOptions): Promise<{code: string; signal: string;}> {
|
export default async function spawnNode(args?: string[], options?: SpawnOptions): Promise<{ code: string; signal: string; }> {
|
||||||
if (!options) {
|
if (!options) {
|
||||||
options = {
|
options = {
|
||||||
env: {}
|
env: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let optionsWithFullEnvironment = {
|
let optionsWithFullEnvironment = {
|
||||||
cwd: rootPath,
|
cwd: rootPath,
|
||||||
...options,
|
...options,
|
||||||
|
@ -24,11 +24,11 @@ export default async function spawnNode(args?: string[], options?: SpawnOptions)
|
||||||
...options.env
|
...options.env
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(`starting ${nodePath} ${args.join(' ')}`);
|
console.log(`starting ${nodePath} ${args.join(' ')}`);
|
||||||
|
|
||||||
let spawned = spawn(nodePath, args, optionsWithFullEnvironment);
|
let spawned = spawn(nodePath, args, optionsWithFullEnvironment);
|
||||||
|
|
||||||
spawned.stderr.pipe(process.stdout);
|
spawned.stderr.pipe(process.stdout);
|
||||||
spawned.stdout.pipe(process.stdout);
|
spawned.stdout.pipe(process.stdout);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
*--------------------------------------------------------*/
|
*--------------------------------------------------------*/
|
||||||
|
|
||||||
import shelljs = require("async-shelljs");
|
import shelljs = require("async-shelljs");
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
const fs = require('async-file');
|
const fs = require('async-file');
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export default class CoverageWritingTestRunner {
|
||||||
|
|
||||||
let remappedResult = JSON.parse(await fs.readTextFile(remappedCoverageJsonPath));
|
let remappedResult = JSON.parse(await fs.readTextFile(remappedCoverageJsonPath));
|
||||||
|
|
||||||
let finalResult = <{[details: string] : { path: string }}>{};
|
let finalResult = <{ [details: string]: { path: string } }>{};
|
||||||
|
|
||||||
for (let key in remappedResult) {
|
for (let key in remappedResult) {
|
||||||
if (remappedResult[key].path) {
|
if (remappedResult[key].path) {
|
||||||
|
@ -84,14 +84,14 @@ export default class CoverageWritingTestRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.log(`Coverage remapping failure: ${JSON.stringify(e)}`);
|
console.log(`Coverage remapping failure: ${JSON.stringify(e)}`);
|
||||||
console.log(`* rawCoverageJsonPath: ${rawCoverageJsonPath}`);
|
console.log(`* rawCoverageJsonPath: ${rawCoverageJsonPath}`);
|
||||||
console.log(`* remappedCoverageJsonPath: ${remappedCoverageJsonPath}`);
|
console.log(`* remappedCoverageJsonPath: ${remappedCoverageJsonPath}`);
|
||||||
console.log(`* outFolderPath: ${outFolderPath}`);
|
console.log(`* outFolderPath: ${outFolderPath}`);
|
||||||
console.log(`* remapIstanbulPath: ${remapIstanbulPath}`);
|
console.log(`* remapIstanbulPath: ${remapIstanbulPath}`);
|
||||||
console.log(`* nodePath: ${nodePath}`);
|
console.log(`* nodePath: ${nodePath}`);
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,13 +128,13 @@ suite("Remote Process Picker: Validate quoting arguments.", () => {
|
||||||
test("Multiple ${debuggerCommand} in string args", () => {
|
test("Multiple ${debuggerCommand} in string args", () => {
|
||||||
let pipeCmd = RemoteAttachPicker.createPipeCmdFromString("program.exe", "".concat(RemoteAttachPicker.debuggerCommand, " ", RemoteAttachPicker.debuggerCommand, " ", RemoteAttachPicker.debuggerCommand), true);
|
let pipeCmd = RemoteAttachPicker.createPipeCmdFromString("program.exe", "".concat(RemoteAttachPicker.debuggerCommand, " ", RemoteAttachPicker.debuggerCommand, " ", RemoteAttachPicker.debuggerCommand), true);
|
||||||
|
|
||||||
pipeCmd.should.deep.equal("program.exe " + RemoteAttachPicker.scriptShellCmd + " " + RemoteAttachPicker.scriptShellCmd + " " + RemoteAttachPicker.scriptShellCmd);
|
pipeCmd.should.deep.equal("program.exe " + RemoteAttachPicker.scriptShellCmd + " " + RemoteAttachPicker.scriptShellCmd + " " + RemoteAttachPicker.scriptShellCmd);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Multiple ${debuggerCommand} in array args", () => {
|
test("Multiple ${debuggerCommand} in array args", () => {
|
||||||
let pipeCmd = RemoteAttachPicker.createPipeCmdFromArray("program.exe", [RemoteAttachPicker.debuggerCommand, RemoteAttachPicker.debuggerCommand, RemoteAttachPicker.debuggerCommand], true);
|
let pipeCmd = RemoteAttachPicker.createPipeCmdFromArray("program.exe", [RemoteAttachPicker.debuggerCommand, RemoteAttachPicker.debuggerCommand, RemoteAttachPicker.debuggerCommand], true);
|
||||||
|
|
||||||
pipeCmd.should.deep.equal("program.exe \"" + RemoteAttachPicker.scriptShellCmd + "\" \"" + RemoteAttachPicker.scriptShellCmd + "\" \"" + RemoteAttachPicker.scriptShellCmd + "\"");
|
pipeCmd.should.deep.equal("program.exe \"" + RemoteAttachPicker.scriptShellCmd + "\" \"" + RemoteAttachPicker.scriptShellCmd + "\" \"" + RemoteAttachPicker.scriptShellCmd + "\"");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("OS Specific Configurations", () => {
|
test("OS Specific Configurations", () => {
|
||||||
|
|
|
@ -60,7 +60,7 @@ suite(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function() {
|
suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function () {
|
||||||
let fileUri: vscode.Uri;
|
let fileUri: vscode.Uri;
|
||||||
|
|
||||||
suiteSetup(async function () {
|
suiteSetup(async function () {
|
||||||
|
@ -70,8 +70,7 @@ suite(`CodeLensProvider options: ${testAssetWorkspace.description}`, function()
|
||||||
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() !== 'slnWithCsproj') {
|
if (vscode.workspace.workspaceFolders[0].uri.fsPath.split(path.sep).pop() !== 'slnWithCsproj') {
|
||||||
this.skip();
|
this.skip();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
await activateCSharpExtension();
|
await activateCSharpExtension();
|
||||||
await testAssetWorkspace.restore();
|
await testAssetWorkspace.restore();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { activateCSharpExtension, isRazorWorkspace } from "./integrationHelpers"
|
||||||
suite(`${OmniSharpCompletionItemProvider.name}: Returns the completion items`, () => {
|
suite(`${OmniSharpCompletionItemProvider.name}: Returns the completion items`, () => {
|
||||||
let fileUri: vscode.Uri;
|
let fileUri: vscode.Uri;
|
||||||
|
|
||||||
suiteSetup(async function() {
|
suiteSetup(async function () {
|
||||||
// These tests don't run on the BasicRazorApp2_1 solution
|
// These tests don't run on the BasicRazorApp2_1 solution
|
||||||
if (isRazorWorkspace(vscode.workspace)) {
|
if (isRazorWorkspace(vscode.workspace)) {
|
||||||
this.skip();
|
this.skip();
|
||||||
|
|
|
@ -32,7 +32,7 @@ suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, ()
|
||||||
await testAssetWorkspace.cleanupWorkspace();
|
await testAssetWorkspace.cleanupWorkspace();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the definition", async() => {
|
test("Returns the definition", async () => {
|
||||||
let definitionList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeDefinitionProvider", fileUri, new vscode.Position(10, 31)));
|
let definitionList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeDefinitionProvider", fileUri, new vscode.Position(10, 31)));
|
||||||
expect(definitionList.length).to.be.equal(1);
|
expect(definitionList.length).to.be.equal(1);
|
||||||
expect(definitionList[0]).to.exist;
|
expect(definitionList[0]).to.exist;
|
||||||
|
@ -40,7 +40,7 @@ suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, ()
|
||||||
});
|
});
|
||||||
|
|
||||||
// Skipping due to https://github.com/OmniSharp/omnisharp-vscode/issues/3458
|
// Skipping due to https://github.com/OmniSharp/omnisharp-vscode/issues/3458
|
||||||
test.skip("Returns the definition from Metadata", async() => {
|
test.skip("Returns the definition from Metadata", async () => {
|
||||||
let definitionList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeDefinitionProvider", fileUri, new vscode.Position(10, 25)));
|
let definitionList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeDefinitionProvider", fileUri, new vscode.Position(10, 25)));
|
||||||
expect(definitionList.length).to.be.equal(1);
|
expect(definitionList.length).to.be.equal(1);
|
||||||
expect(definitionList[0]).to.exist;
|
expect(definitionList[0]).to.exist;
|
||||||
|
|
|
@ -57,18 +57,18 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Razor shouldn't give diagnostics for virtual files", async () => {
|
test("Razor shouldn't give diagnostics for virtual files", async () => {
|
||||||
await pollDoesNotHappen(() => vscode.languages.getDiagnostics(), 5 * 1000, 500, function(res) {
|
await pollDoesNotHappen(() => vscode.languages.getDiagnostics(), 5 * 1000, 500, function (res) {
|
||||||
const virtual = res.find(r => r[0].fsPath === virtualRazorFileUri.fsPath);
|
const virtual = res.find(r => r[0].fsPath === virtualRazorFileUri.fsPath);
|
||||||
|
|
||||||
if(!virtual) {
|
if (!virtual) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const diagnosticsList = virtual[1];
|
const diagnosticsList = virtual[1];
|
||||||
if(diagnosticsList.some(diag => diag.code == 'CS0103')) {
|
if (diagnosticsList.some(diag => diag.code == 'CS0103')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -141,7 +141,7 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
|
||||||
await vscode.commands.executeCommand("vscode.open", secondaryFileUri);
|
await vscode.commands.executeCommand("vscode.open", secondaryFileUri);
|
||||||
await vscode.commands.executeCommand("vscode.open", fileUri);
|
await vscode.commands.executeCommand("vscode.open", fileUri);
|
||||||
|
|
||||||
await assertWithPoll(() => vscode.languages.getDiagnostics(fileUri), 10 * 1000, 500, openFileDiag => expect(openFileDiag.length).to.be.greaterThan(0));
|
await assertWithPoll(() => vscode.languages.getDiagnostics(fileUri), 10 * 1000, 500, openFileDiag => expect(openFileDiag.length).to.be.greaterThan(0));
|
||||||
await assertWithPoll(() => vscode.languages.getDiagnostics(secondaryFileUri), 10 * 1000, 500, secondaryDiag => expect(secondaryDiag.length).to.be.eq(0));
|
await assertWithPoll(() => vscode.languages.getDiagnostics(secondaryFileUri), 10 * 1000, 500, secondaryDiag => expect(secondaryDiag.length).to.be.eq(0));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers'
|
||||||
suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`, () => {
|
suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`, () => {
|
||||||
let fileUri: vscode.Uri;
|
let fileUri: vscode.Uri;
|
||||||
|
|
||||||
suiteSetup(async function() {
|
suiteSetup(async function () {
|
||||||
// These tests don't run on the BasicRazorApp2_1 solution
|
// These tests don't run on the BasicRazorApp2_1 solution
|
||||||
if (isRazorWorkspace(vscode.workspace)) {
|
if (isRazorWorkspace(vscode.workspace)) {
|
||||||
this.skip();
|
this.skip();
|
||||||
|
@ -32,7 +32,7 @@ suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`,
|
||||||
await testAssetWorkspace.cleanupWorkspace();
|
await testAssetWorkspace.cleanupWorkspace();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the implementation", async() => {
|
test("Returns the implementation", async () => {
|
||||||
let implementationList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeImplementationProvider", fileUri, new vscode.Position(4, 22)));
|
let implementationList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeImplementationProvider", fileUri, new vscode.Position(4, 22)));
|
||||||
expect(implementationList.length).to.be.equal(2);
|
expect(implementationList.length).to.be.equal(2);
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,12 +35,12 @@ testRunner.configure({
|
||||||
|
|
||||||
if (process.env.CODE_EXTENSIONS_PATH && process.env.OSVC_SUITE) {
|
if (process.env.CODE_EXTENSIONS_PATH && process.env.OSVC_SUITE) {
|
||||||
let logDirPath = path.join(process.env.CODE_EXTENSIONS_PATH, "./.logs");
|
let logDirPath = path.join(process.env.CODE_EXTENSIONS_PATH, "./.logs");
|
||||||
|
|
||||||
if (!fs.existsSync(logDirPath)) {
|
if (!fs.existsSync(logDirPath)) {
|
||||||
fs.mkdirSync(logDirPath);
|
fs.mkdirSync(logDirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
let logFilePath = path.join(logDirPath, `${process.env.OSVC_SUITE}.log`);
|
let logFilePath = path.join(logDirPath, `${process.env.OSVC_SUITE}.log`);
|
||||||
|
|
||||||
SubscribeToAllLoggers(message => fs.appendFileSync(logFilePath, message));
|
SubscribeToAllLoggers(message => fs.appendFileSync(logFilePath, message));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
|
||||||
await testAssetWorkspace.cleanupWorkspace();
|
await testAssetWorkspace.cleanupWorkspace();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the remapped workspaceEdit", async() => {
|
test("Returns the remapped workspaceEdit", async () => {
|
||||||
|
|
||||||
// Avoid flakiness with renames.
|
// Avoid flakiness with renames.
|
||||||
await new Promise(r => setTimeout(r, 2000));
|
await new Promise(r => setTimeout(r, 2000));
|
||||||
|
@ -52,7 +52,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
|
||||||
expect(entries[0][0].path).to.be.equal(remappedFileUri.path);
|
expect(entries[0][0].path).to.be.equal(remappedFileUri.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the remapped references", async() => {
|
test("Returns the remapped references", async () => {
|
||||||
let references = <vscode.Location[]>(await vscode.commands.executeCommand(
|
let references = <vscode.Location[]>(await vscode.commands.executeCommand(
|
||||||
"vscode.executeReferenceProvider",
|
"vscode.executeReferenceProvider",
|
||||||
fileUri,
|
fileUri,
|
||||||
|
@ -61,7 +61,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
|
||||||
expect(references[0].uri.path).to.be.equal(remappedFileUri.path);
|
expect(references[0].uri.path).to.be.equal(remappedFileUri.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the remapped definition", async() => {
|
test("Returns the remapped definition", async () => {
|
||||||
let definitions = <vscode.Location[]>(await vscode.commands.executeCommand(
|
let definitions = <vscode.Location[]>(await vscode.commands.executeCommand(
|
||||||
"vscode.executeDefinitionProvider",
|
"vscode.executeDefinitionProvider",
|
||||||
fileUri,
|
fileUri,
|
||||||
|
@ -70,7 +70,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
|
||||||
expect(definitions[0].uri.path).to.be.equal(remappedFileUri.path);
|
expect(definitions[0].uri.path).to.be.equal(remappedFileUri.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the remapped implementations", async() => {
|
test("Returns the remapped implementations", async () => {
|
||||||
let implementations = <vscode.Location[]>(await vscode.commands.executeCommand(
|
let implementations = <vscode.Location[]>(await vscode.commands.executeCommand(
|
||||||
"vscode.executeImplementationProvider",
|
"vscode.executeImplementationProvider",
|
||||||
fileUri,
|
fileUri,
|
||||||
|
@ -85,8 +85,7 @@ async function registerLanguageMiddleware() {
|
||||||
await vscode.commands.executeCommand<void>('omnisharp.registerLanguageMiddleware', middleware);
|
await vscode.commands.executeCommand<void>('omnisharp.registerLanguageMiddleware', middleware);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestLanguageMiddleware implements LanguageMiddleware
|
class TestLanguageMiddleware implements LanguageMiddleware {
|
||||||
{
|
|
||||||
public readonly language = 'MyLang';
|
public readonly language = 'MyLang';
|
||||||
private readonly remappedFileUri: vscode.Uri;
|
private readonly remappedFileUri: vscode.Uri;
|
||||||
private readonly fileToRemapUri: vscode.Uri;
|
private readonly fileToRemapUri: vscode.Uri;
|
||||||
|
|
|
@ -47,7 +47,7 @@ suite(`Tasks generation: ${testAssetWorkspace.description}`, function () {
|
||||||
expect(result, "Debugger could not be started.");
|
expect(result, "Debugger could not be started.");
|
||||||
|
|
||||||
let debugSessionTerminated = new Promise(resolve => {
|
let debugSessionTerminated = new Promise(resolve => {
|
||||||
vscode.debug.onDidTerminateDebugSession((e) => resolve());
|
vscode.debug.onDidTerminateDebugSession((e) => resolve());
|
||||||
});
|
});
|
||||||
|
|
||||||
await debugSessionTerminated;
|
await debugSessionTerminated;
|
||||||
|
|
|
@ -19,13 +19,11 @@ const chai = require('chai');
|
||||||
chai.use(require('chai-arrays'));
|
chai.use(require('chai-arrays'));
|
||||||
chai.use(require('chai-fs'));
|
chai.use(require('chai-fs'));
|
||||||
|
|
||||||
function listenEvents<T extends BaseEvent>(stream: EventStream, type: EventType): T[]
|
function listenEvents<T extends BaseEvent>(stream: EventStream, type: EventType): T[] {
|
||||||
{
|
|
||||||
let results: T[] = [];
|
let results: T[] = [];
|
||||||
|
|
||||||
stream.subscribe((event: BaseEvent) => {
|
stream.subscribe((event: BaseEvent) => {
|
||||||
if(event.type === type)
|
if (event.type === type) {
|
||||||
{
|
|
||||||
results.push(<T>event);
|
results.push(<T>event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -72,11 +70,11 @@ suite(`ReAnalyze: ${testAssetWorkspace.description}`, function () {
|
||||||
|
|
||||||
await vscode.commands.executeCommand('o.reanalyze.currentProject', interfaceImplUri);
|
await vscode.commands.executeCommand('o.reanalyze.currentProject', interfaceImplUri);
|
||||||
|
|
||||||
await poll(() => diagnosticStatusEvents, 15*1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Ready) !== undefined);
|
await poll(() => diagnosticStatusEvents, 15 * 1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Ready) !== undefined);
|
||||||
|
|
||||||
await assertWithPoll(
|
await assertWithPoll(
|
||||||
() => vscode.languages.getDiagnostics(interfaceImplUri),
|
() => vscode.languages.getDiagnostics(interfaceImplUri),
|
||||||
15*1000,
|
15 * 1000,
|
||||||
500,
|
500,
|
||||||
res => expect(res.find(x => x.message.includes("CS0246"))));
|
res => expect(res.find(x => x.message.includes("CS0246"))));
|
||||||
});
|
});
|
||||||
|
@ -86,8 +84,8 @@ suite(`ReAnalyze: ${testAssetWorkspace.description}`, function () {
|
||||||
|
|
||||||
await vscode.commands.executeCommand('o.reanalyze.currentProject', interfaceImplUri);
|
await vscode.commands.executeCommand('o.reanalyze.currentProject', interfaceImplUri);
|
||||||
|
|
||||||
await poll(() => diagnosticStatusEvents, 15*1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Processing) != undefined);
|
await poll(() => diagnosticStatusEvents, 15 * 1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Processing) != undefined);
|
||||||
await poll(() => diagnosticStatusEvents, 15*1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Ready) != undefined);
|
await poll(() => diagnosticStatusEvents, 15 * 1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Ready) != undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("When re-analyze of all projects is executed then eventually get notified about them.", async function () {
|
test("When re-analyze of all projects is executed then eventually get notified about them.", async function () {
|
||||||
|
@ -95,7 +93,7 @@ suite(`ReAnalyze: ${testAssetWorkspace.description}`, function () {
|
||||||
|
|
||||||
await vscode.commands.executeCommand('o.reanalyze.allProjects', interfaceImplUri);
|
await vscode.commands.executeCommand('o.reanalyze.allProjects', interfaceImplUri);
|
||||||
|
|
||||||
await poll(() => diagnosticStatusEvents, 15*1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Processing) != undefined);
|
await poll(() => diagnosticStatusEvents, 15 * 1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Processing) != undefined);
|
||||||
await poll(() => diagnosticStatusEvents, 15*1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Ready) != undefined);
|
await poll(() => diagnosticStatusEvents, 15 * 1000, 500, r => r.find(x => x.message.Status === DiagnosticStatus.Ready) != undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,7 @@ suite(`${OmnisharpReferenceProvider.name}: ${testAssetWorkspace.description}`, (
|
||||||
await testAssetWorkspace.cleanupWorkspace();
|
await testAssetWorkspace.cleanupWorkspace();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns the reference without declaration", async() => {
|
test("Returns the reference without declaration", async () => {
|
||||||
let referenceList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeReferenceProvider", fileUri, new vscode.Position(6, 22)));
|
let referenceList = <vscode.Location[]>(await vscode.commands.executeCommand("vscode.executeReferenceProvider", fileUri, new vscode.Position(6, 22)));
|
||||||
expect(referenceList.length).to.be.equal(1);
|
expect(referenceList.length).to.be.equal(1);
|
||||||
expect(referenceList[0].range.start.line).to.be.equal(13);
|
expect(referenceList[0].range.start.line).to.be.equal(13);
|
||||||
|
|
|
@ -12,13 +12,13 @@ suite(AbsolutePath.name, () => {
|
||||||
let tmpPath: TmpAsset;
|
let tmpPath: TmpAsset;
|
||||||
|
|
||||||
setup(async () => {
|
setup(async () => {
|
||||||
tmpPath = await CreateTmpFile();
|
tmpPath = await CreateTmpFile();
|
||||||
});
|
});
|
||||||
|
|
||||||
teardown(() => {
|
teardown(() => {
|
||||||
tmpPath.dispose();
|
tmpPath.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Throws error when the passed value is not an absolute path', () => {
|
test('Throws error when the passed value is not an absolute path', () => {
|
||||||
expect(() => new AbsolutePath("somePath")).to.throw(Error);
|
expect(() => new AbsolutePath("somePath")).to.throw(Error);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
import { IGetDotnetInfo } from "../../../src/constants/IGetDotnetInfo";
|
import { IGetDotnetInfo } from "../../../src/constants/IGetDotnetInfo";
|
||||||
|
|
||||||
export const fakeDotnetInfo = "myDotnetInfo";
|
export const fakeDotnetInfo = "myDotnetInfo";
|
||||||
export const FakeGetDotnetInfo: IGetDotnetInfo = async() => Promise.resolve(fakeDotnetInfo);
|
export const FakeGetDotnetInfo: IGetDotnetInfo = async () => Promise.resolve(fakeDotnetInfo);
|
|
@ -24,7 +24,7 @@ export class FakeMonoResolver implements IMonoResolver {
|
||||||
if (this.willReturnMonoInfo) {
|
if (this.willReturnMonoInfo) {
|
||||||
return Promise.resolve(fakeMonoInfo);
|
return Promise.resolve(fakeMonoInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,24 +27,24 @@ suite(`${installRuntimeDependencies.name}`, () => {
|
||||||
let platformInfo = new PlatformInformation("platform1", "architecture1");
|
let platformInfo = new PlatformInformation("platform1", "architecture1");
|
||||||
|
|
||||||
setup(() => {
|
setup(() => {
|
||||||
eventStream = new EventStream();
|
eventStream = new EventStream();
|
||||||
eventBus = new TestEventBus(eventStream);
|
eventBus = new TestEventBus(eventStream);
|
||||||
installDependencies = async() => Promise.resolve(true);
|
installDependencies = async () => Promise.resolve(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
suite("When all the dependencies already exist", () => {
|
suite("When all the dependencies already exist", () => {
|
||||||
suiteSetup(() => {
|
suiteSetup(() => {
|
||||||
packageJSON = {
|
packageJSON = {
|
||||||
runtimeDependencies: {}
|
runtimeDependencies: {}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
test("True is returned", async () => {
|
test("True is returned", async () => {
|
||||||
let installed = await installRuntimeDependencies(packageJSON, extensionPath, installDependencies, eventStream, platformInfo);
|
let installed = await installRuntimeDependencies(packageJSON, extensionPath, installDependencies, eventStream, platformInfo);
|
||||||
expect(installed).to.be.true;
|
expect(installed).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Doesn't log anything to the eventStream", async() => {
|
test("Doesn't log anything to the eventStream", async () => {
|
||||||
let packageJSON = {
|
let packageJSON = {
|
||||||
runtimeDependencies: {}
|
runtimeDependencies: {}
|
||||||
};
|
};
|
||||||
|
@ -55,8 +55,8 @@ suite(`${installRuntimeDependencies.name}`, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
suite("When there is a dependency to install", () => {
|
suite("When there is a dependency to install", () => {
|
||||||
let packageToInstall : Package= {
|
let packageToInstall: Package = {
|
||||||
id:"myPackage",
|
id: "myPackage",
|
||||||
description: "somePackage",
|
description: "somePackage",
|
||||||
installPath: "installPath",
|
installPath: "installPath",
|
||||||
binaries: [],
|
binaries: [],
|
||||||
|
@ -73,7 +73,7 @@ suite(`${installRuntimeDependencies.name}`, () => {
|
||||||
|
|
||||||
test("Calls installDependencies with the absolute path package and returns true after successful installation", async () => {
|
test("Calls installDependencies with the absolute path package and returns true after successful installation", async () => {
|
||||||
let inputPackage: AbsolutePathPackage[];
|
let inputPackage: AbsolutePathPackage[];
|
||||||
installDependencies = async(packages) => {
|
installDependencies = async (packages) => {
|
||||||
inputPackage = packages;
|
inputPackage = packages;
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
};
|
};
|
||||||
|
@ -85,7 +85,7 @@ suite(`${installRuntimeDependencies.name}`, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Returns false when installDependencies returns false", async () => {
|
test("Returns false when installDependencies returns false", async () => {
|
||||||
installDependencies = async() => Promise.resolve(false);
|
installDependencies = async () => Promise.resolve(false);
|
||||||
let installed = await installRuntimeDependencies(packageJSON, extensionPath, installDependencies, eventStream, platformInfo);
|
let installed = await installRuntimeDependencies(packageJSON, extensionPath, installDependencies, eventStream, platformInfo);
|
||||||
expect(installed).to.be.false;
|
expect(installed).to.be.false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { CreateTmpDir, TmpAsset } from "../../src/CreateTmpAsset";
|
||||||
import * as util from '../../src/common';
|
import * as util from '../../src/common';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import MockHttpsServer from "./testAssets/MockHttpsServer";
|
import MockHttpsServer from "./testAssets/MockHttpsServer";
|
||||||
import {expect} from 'chai';
|
import { expect } from 'chai';
|
||||||
import TestZip from "./testAssets/TestZip";
|
import TestZip from "./testAssets/TestZip";
|
||||||
import { createTestFile } from "./testAssets/TestFile";
|
import { createTestFile } from "./testAssets/TestFile";
|
||||||
import { PackageInstallation, LogPlatformInfo, DownloadStart, DownloadSizeObtained, DownloadProgress, DownloadSuccess, InstallationStart, InstallationSuccess, PackageInstallStart } from "../../src/omnisharp/loggingEvents";
|
import { PackageInstallation, LogPlatformInfo, DownloadStart, DownloadSizeObtained, DownloadProgress, DownloadSuccess, InstallationStart, InstallationSuccess, PackageInstallStart } from "../../src/omnisharp/loggingEvents";
|
||||||
|
@ -20,7 +20,7 @@ import { testPackageJSON } from "./testAssets/testAssets";
|
||||||
|
|
||||||
suite('OmnisharpDownloader', () => {
|
suite('OmnisharpDownloader', () => {
|
||||||
const networkSettingsProvider = () => new NetworkSettings(undefined, false);
|
const networkSettingsProvider = () => new NetworkSettings(undefined, false);
|
||||||
let eventStream : EventStream;
|
let eventStream: EventStream;
|
||||||
const installPath = "somePath";
|
const installPath = "somePath";
|
||||||
let platformInfo = new PlatformInformation("win32", "x86");
|
let platformInfo = new PlatformInformation("win32", "x86");
|
||||||
let downloader: OmnisharpDownloader;
|
let downloader: OmnisharpDownloader;
|
||||||
|
@ -46,7 +46,7 @@ suite('OmnisharpDownloader', () => {
|
||||||
}, testZip.buffer);
|
}, testZip.buffer);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Returns false if request is made for a version that doesnot exist on the server', async() => {
|
test('Returns false if request is made for a version that doesnot exist on the server', async () => {
|
||||||
expect(await downloader.DownloadAndInstallOmnisharp("1.00000001.0000", server.baseUrl, installPath)).to.be.false;
|
expect(await downloader.DownloadAndInstallOmnisharp("1.00000001.0000", server.baseUrl, installPath)).to.be.false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ suite('OmnisharpDownloader', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Events are created', async () => {
|
test('Events are created', async () => {
|
||||||
let expectedSequence = [
|
let expectedSequence = [
|
||||||
new PackageInstallation('OmniSharp Version = 1.2.3'),
|
new PackageInstallation('OmniSharp Version = 1.2.3'),
|
||||||
new LogPlatformInfo(new PlatformInformation("win32", "x86")),
|
new LogPlatformInfo(new PlatformInformation("win32", "x86")),
|
||||||
|
@ -67,14 +67,14 @@ suite('OmnisharpDownloader', () => {
|
||||||
new DownloadSizeObtained(testZip.size),
|
new DownloadSizeObtained(testZip.size),
|
||||||
new DownloadProgress(100, 'OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
|
new DownloadProgress(100, 'OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
|
||||||
new DownloadSuccess(' Done!'),
|
new DownloadSuccess(' Done!'),
|
||||||
new InstallationStart('OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
|
new InstallationStart('OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
|
||||||
new InstallationSuccess()
|
new InstallationSuccess()
|
||||||
];
|
];
|
||||||
|
|
||||||
expect(eventBus.getEvents()).to.be.empty;
|
expect(eventBus.getEvents()).to.be.empty;
|
||||||
await downloader.DownloadAndInstallOmnisharp(version, server.baseUrl, installPath);
|
await downloader.DownloadAndInstallOmnisharp(version, server.baseUrl, installPath);
|
||||||
expect(eventBus.getEvents()).to.be.deep.equal(expectedSequence);
|
expect(eventBus.getEvents()).to.be.deep.equal(expectedSequence);
|
||||||
});
|
});
|
||||||
|
|
||||||
teardown(async () => {
|
teardown(async () => {
|
||||||
tmpDir.dispose();
|
tmpDir.dispose();
|
||||||
|
|
|
@ -20,7 +20,7 @@ import * as util from '../../src/common';
|
||||||
suite(OmnisharpManager.name, () => {
|
suite(OmnisharpManager.name, () => {
|
||||||
let server: MockHttpsServer;
|
let server: MockHttpsServer;
|
||||||
const eventStream = new EventStream();
|
const eventStream = new EventStream();
|
||||||
let manager : OmnisharpManager;
|
let manager: OmnisharpManager;
|
||||||
const defaultVersion = "0.1.2";
|
const defaultVersion = "0.1.2";
|
||||||
const testVersion = "1.2.3";
|
const testVersion = "1.2.3";
|
||||||
const latestVersion = "2.3.4";
|
const latestVersion = "2.3.4";
|
||||||
|
|
|
@ -20,7 +20,7 @@ suite("GetOmnisharpPackage : Output package depends on the input package and oth
|
||||||
version = "0.0.0";
|
version = "0.0.0";
|
||||||
installPath = "testPath";
|
installPath = "testPath";
|
||||||
let packageJSON = testPackageJSON;
|
let packageJSON = testPackageJSON;
|
||||||
inputPackages = <Package[]> (packageJSON.runtimeDependencies);
|
inputPackages = <Package[]>(packageJSON.runtimeDependencies);
|
||||||
should();
|
should();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ suite("GetOmnisharpPackage : Output package depends on the input package and oth
|
||||||
|
|
||||||
test('Throws exception if version is null', () => {
|
test('Throws exception if version is null', () => {
|
||||||
let testPackage = inputPackages.find(element => (element.platformId && element.platformId == "os-architecture"));
|
let testPackage = inputPackages.find(element => (element.platformId && element.platformId == "os-architecture"));
|
||||||
let fn = function () { SetBinaryAndGetPackage(testPackage, serverUrl, null, installPath);};
|
let fn = function () { SetBinaryAndGetPackage(testPackage, serverUrl, null, installPath); };
|
||||||
expect(fn).to.throw('Invalid version');
|
expect(fn).to.throw('Invalid version');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ suite('GetPackagesFromVersion : Gets the experimental omnisharp packages from a
|
||||||
|
|
||||||
const serverUrl = "http://serverUrl";
|
const serverUrl = "http://serverUrl";
|
||||||
const installPath = "testPath";
|
const installPath = "testPath";
|
||||||
let inputPackages : any;
|
let inputPackages: any;
|
||||||
|
|
||||||
suiteSetup(() => {
|
suiteSetup(() => {
|
||||||
inputPackages = <Package[]>(testPackageJSON.runtimeDependencies);
|
inputPackages = <Package[]>(testPackageJSON.runtimeDependencies);
|
||||||
|
|
|
@ -76,7 +76,7 @@ suite("FileDownloader", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Events are created in the correct order', async () => {
|
test('Events are created in the correct order', async () => {
|
||||||
await DownloadFile(fileDescription, eventStream, networkSettingsProvider, getURL(elem.urlPath), getURL(elem.fallBackUrlPath));
|
await DownloadFile(fileDescription, eventStream, networkSettingsProvider, getURL(elem.urlPath), getURL(elem.fallBackUrlPath));
|
||||||
expect(eventBus.getEvents()).to.be.deep.equal(elem.getEventSequence());
|
expect(eventBus.getEvents()).to.be.deep.equal(elem.getEventSequence());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,41 +16,41 @@ suite(`${getNotInstalledPackagesForPlatform.name}`, () => {
|
||||||
let absolutePathPackages: AbsolutePathPackage[];
|
let absolutePathPackages: AbsolutePathPackage[];
|
||||||
let extensionPath = "/ExtensionPath";
|
let extensionPath = "/ExtensionPath";
|
||||||
const packages = <Package[]>[
|
const packages = <Package[]>[
|
||||||
{
|
{
|
||||||
"description": "Platfrom1-Architecture1 uninstalled package",
|
"description": "Platfrom1-Architecture1 uninstalled package",
|
||||||
"platforms": [ "platform1" ],
|
"platforms": ["platform1"],
|
||||||
"architectures": [ "architecture1" ],
|
"architectures": ["architecture1"],
|
||||||
"installPath": "path1"
|
"installPath": "path1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//already installed package
|
//already installed package
|
||||||
"description": "Platfrom1-Architecture1 installed package",
|
"description": "Platfrom1-Architecture1 installed package",
|
||||||
"platforms": [ "platform1" ],
|
"platforms": ["platform1"],
|
||||||
"architectures": [ "architecture1" ],
|
"architectures": ["architecture1"],
|
||||||
"installPath": "path5"
|
"installPath": "path5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Platfrom2-Architecture2 uninstalled package",
|
"description": "Platfrom2-Architecture2 uninstalled package",
|
||||||
"platforms": [ "platform2" ],
|
"platforms": ["platform2"],
|
||||||
"architectures": [ "architecture2" ],
|
"architectures": ["architecture2"],
|
||||||
"installPath": "path2"
|
"installPath": "path2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Platfrom1-Architecture2 uninstalled package",
|
"description": "Platfrom1-Architecture2 uninstalled package",
|
||||||
"platforms": [ "platform1" ],
|
"platforms": ["platform1"],
|
||||||
"architectures": [ "architecture2" ],
|
"architectures": ["architecture2"],
|
||||||
"installPath": "path3"
|
"installPath": "path3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Platfrom2-Architecture1 uninstalled package",
|
"description": "Platfrom2-Architecture1 uninstalled package",
|
||||||
"platforms": [ "platform2" ],
|
"platforms": ["platform2"],
|
||||||
"architectures": [ "architecture1" ],
|
"architectures": ["architecture1"],
|
||||||
"installPath": "path4"
|
"installPath": "path4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Platfrom1-Architecture2 uninstalled package",
|
"description": "Platfrom1-Architecture2 uninstalled package",
|
||||||
"platforms": [ "platform1" ],
|
"platforms": ["platform1"],
|
||||||
"architectures": [ "architecture2" ],
|
"architectures": ["architecture2"],
|
||||||
"installPath": "path3"
|
"installPath": "path3"
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -39,7 +39,7 @@ suite('ZipInstaller', () => {
|
||||||
let eventBus: TestEventBus;
|
let eventBus: TestEventBus;
|
||||||
|
|
||||||
setup(async () => {
|
setup(async () => {
|
||||||
eventStream = new EventStream();
|
eventStream = new EventStream();
|
||||||
eventBus = new TestEventBus(eventStream);
|
eventBus = new TestEventBus(eventStream);
|
||||||
tmpInstallDir = await CreateTmpDir(true);
|
tmpInstallDir = await CreateTmpDir(true);
|
||||||
installationPath = new AbsolutePath(tmpInstallDir.name);
|
installationPath = new AbsolutePath(tmpInstallDir.name);
|
||||||
|
|
|
@ -13,7 +13,7 @@ const expect = chai.expect;
|
||||||
suite(`${isValidDownload.name}`, () => {
|
suite(`${isValidDownload.name}`, () => {
|
||||||
const sampleBuffer = Buffer.from("sampleBuffer");
|
const sampleBuffer = Buffer.from("sampleBuffer");
|
||||||
const validIntegrity = "eb7201b5d986919e0ac67c820886358869d8f7059193d33c902ad7fe1688e1e9";
|
const validIntegrity = "eb7201b5d986919e0ac67c820886358869d8f7059193d33c902ad7fe1688e1e9";
|
||||||
|
|
||||||
test('Returns false for non-matching integrity', async () => {
|
test('Returns false for non-matching integrity', async () => {
|
||||||
let result = await isValidDownload(sampleBuffer, "inValidIntegrity", new EventStream());
|
let result = await isValidDownload(sampleBuffer, "inValidIntegrity", new EventStream());
|
||||||
expect(result).to.be.false;
|
expect(result).to.be.false;
|
||||||
|
|
|
@ -11,7 +11,7 @@ suite("ParsedEnvironmentFile", () => {
|
||||||
|
|
||||||
test("Add single variable", () => {
|
test("Add single variable", () => {
|
||||||
const content = `MyName=VALUE`;
|
const content = `MyName=VALUE`;
|
||||||
const fakeConfig : { [key: string]: any } = {};
|
const fakeConfig: { [key: string]: any } = {};
|
||||||
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
||||||
|
|
||||||
expect(result.Warning).to.be.null;
|
expect(result.Warning).to.be.null;
|
||||||
|
@ -20,7 +20,7 @@ suite("ParsedEnvironmentFile", () => {
|
||||||
|
|
||||||
test("Handle quoted values", () => {
|
test("Handle quoted values", () => {
|
||||||
const content = `MyName="VALUE"`;
|
const content = `MyName="VALUE"`;
|
||||||
const fakeConfig : { [key: string]: any } = {};
|
const fakeConfig: { [key: string]: any } = {};
|
||||||
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
||||||
|
|
||||||
expect(result.Warning).to.be.null;
|
expect(result.Warning).to.be.null;
|
||||||
|
@ -29,7 +29,7 @@ suite("ParsedEnvironmentFile", () => {
|
||||||
|
|
||||||
test("Handle BOM", () => {
|
test("Handle BOM", () => {
|
||||||
const content = "\uFEFFMyName=VALUE";
|
const content = "\uFEFFMyName=VALUE";
|
||||||
const fakeConfig : { [key: string]: any } = {};
|
const fakeConfig: { [key: string]: any } = {};
|
||||||
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
||||||
|
|
||||||
expect(result.Warning).to.be.null;
|
expect(result.Warning).to.be.null;
|
||||||
|
@ -42,7 +42,7 @@ MyName1=Value1
|
||||||
MyName2=Value2
|
MyName2=Value2
|
||||||
|
|
||||||
`;
|
`;
|
||||||
const fakeConfig : { [key: string]: any } = {};
|
const fakeConfig: { [key: string]: any } = {};
|
||||||
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
||||||
|
|
||||||
expect(result.Warning).to.be.null;
|
expect(result.Warning).to.be.null;
|
||||||
|
@ -56,7 +56,7 @@ MyName1=Value1
|
||||||
MyName2=Value2
|
MyName2=Value2
|
||||||
|
|
||||||
`;
|
`;
|
||||||
const initialEnv : { [key: string]: any } = {
|
const initialEnv: { [key: string]: any } = {
|
||||||
"MyName1": "Value7",
|
"MyName1": "Value7",
|
||||||
"ThisShouldNotChange": "StillHere"
|
"ThisShouldNotChange": "StillHere"
|
||||||
};
|
};
|
||||||
|
@ -69,19 +69,19 @@ MyName2=Value2
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Handle comments", () => {
|
test("Handle comments", () => {
|
||||||
const content = `# This is an environment file
|
const content = `# This is an environment file
|
||||||
MyName1=Value1
|
MyName1=Value1
|
||||||
# This is a comment in the middle of the file
|
# This is a comment in the middle of the file
|
||||||
MyName2=Value2
|
MyName2=Value2
|
||||||
`;
|
`;
|
||||||
const fakeConfig : { [key: string]: any } = {};
|
const fakeConfig: { [key: string]: any } = {};
|
||||||
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
||||||
|
|
||||||
expect(result.Warning).to.be.null;
|
expect(result.Warning).to.be.null;
|
||||||
result.Env["MyName1"].should.equal("Value1");
|
result.Env["MyName1"].should.equal("Value1");
|
||||||
result.Env["MyName2"].should.equal("Value2");
|
result.Env["MyName2"].should.equal("Value2");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Handle invalid lines", () => {
|
test("Handle invalid lines", () => {
|
||||||
const content = `
|
const content = `
|
||||||
This_Line_Is_Wrong
|
This_Line_Is_Wrong
|
||||||
|
@ -89,7 +89,7 @@ MyName1=Value1
|
||||||
MyName2=Value2
|
MyName2=Value2
|
||||||
|
|
||||||
`;
|
`;
|
||||||
const fakeConfig : { [key: string]: any } = {};
|
const fakeConfig: { [key: string]: any } = {};
|
||||||
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
|
||||||
|
|
||||||
result.Warning.should.startWith("Ignoring non-parseable lines in envFile TestEnvFileName");
|
result.Warning.should.startWith("Ignoring non-parseable lines in envFile TestEnvFileName");
|
||||||
|
|
|
@ -71,28 +71,28 @@ suite("Common", () => {
|
||||||
suite("isSubfolderOf", () => {
|
suite("isSubfolderOf", () => {
|
||||||
test("same paths", () => {
|
test("same paths", () => {
|
||||||
let subfolder: string = ["C:", "temp", "VS", "dotnetProject"].join(path.sep);
|
let subfolder: string = ["C:", "temp", "VS", "dotnetProject"].join(path.sep);
|
||||||
let folder: string= ["C:", "temp", "VS", "dotnetProject"].join(path.sep);
|
let folder: string = ["C:", "temp", "VS", "dotnetProject"].join(path.sep);
|
||||||
|
|
||||||
expect(isSubfolderOf(subfolder, folder)).to.be.true;
|
expect(isSubfolderOf(subfolder, folder)).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
test("correct subfolder", () => {
|
test("correct subfolder", () => {
|
||||||
let subfolder: string = ["C:", "temp", "VS"].join(path.sep);
|
let subfolder: string = ["C:", "temp", "VS"].join(path.sep);
|
||||||
let folder: string= ["C:", "temp", "VS", "dotnetProject"].join(path.sep);
|
let folder: string = ["C:", "temp", "VS", "dotnetProject"].join(path.sep);
|
||||||
|
|
||||||
expect(isSubfolderOf(subfolder, folder)).to.be.true;
|
expect(isSubfolderOf(subfolder, folder)).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
test("longer subfolder", () => {
|
test("longer subfolder", () => {
|
||||||
let subfolder: string = ["C:", "temp", "VS", "a", "b", "c"].join(path.sep);
|
let subfolder: string = ["C:", "temp", "VS", "a", "b", "c"].join(path.sep);
|
||||||
let folder: string= ["C:", "temp", "VS"].join(path.sep);
|
let folder: string = ["C:", "temp", "VS"].join(path.sep);
|
||||||
|
|
||||||
expect(isSubfolderOf(subfolder, folder)).to.be.false;
|
expect(isSubfolderOf(subfolder, folder)).to.be.false;
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Different drive", () => {
|
test("Different drive", () => {
|
||||||
let subfolder: string = ["C:", "temp", "VS"].join(path.sep);
|
let subfolder: string = ["C:", "temp", "VS"].join(path.sep);
|
||||||
let folder: string= ["E:", "temp", "VS"].join(path.sep);
|
let folder: string = ["E:", "temp", "VS"].join(path.sep);
|
||||||
|
|
||||||
expect(isSubfolderOf(subfolder, folder)).to.be.false;
|
expect(isSubfolderOf(subfolder, folder)).to.be.false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,7 +57,7 @@ suite(`${reportIssue.name}`, () => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
vscode.env.clipboard.writeText = (body:string) => {
|
vscode.env.clipboard.writeText = (body: string) => {
|
||||||
issueBody = body;
|
issueBody = body;
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ suite('BackgroundWorkStatusBarObserver', () => {
|
||||||
show: () => { showCalled = true; },
|
show: () => { showCalled = true; },
|
||||||
hide: () => { hideCalled = true; }
|
hide: () => { hideCalled = true; }
|
||||||
};
|
};
|
||||||
let observer = new BackgroundWorkStatusBarObserver(statusBarItem);
|
let observer = new BackgroundWorkStatusBarObserver(statusBarItem);
|
||||||
|
|
||||||
setup(() => {
|
setup(() => {
|
||||||
showCalled = false;
|
showCalled = false;
|
||||||
|
|
|
@ -37,14 +37,14 @@ suite("CsharpLoggerObserver", () => {
|
||||||
expect(logOutput).to.contain(event.stage);
|
expect(logOutput).to.contain(event.stage);
|
||||||
expect(logOutput).to.contain(event.error.toString());
|
expect(logOutput).to.contain(event.error.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Stage and Error is logged if a PackageError without inner error', () => {
|
test('Stage and Error is logged if a PackageError without inner error', () => {
|
||||||
let event = new Event.InstallationFailure("someStage", new PackageError("someError", null, null));
|
let event = new Event.InstallationFailure("someStage", new PackageError("someError", null, null));
|
||||||
observer.post(event);
|
observer.post(event);
|
||||||
expect(logOutput).to.contain(event.stage);
|
expect(logOutput).to.contain(event.stage);
|
||||||
expect(logOutput).to.contain(event.error.message);
|
expect(logOutput).to.contain(event.error.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Stage and Inner error is logged if a PackageError without inner error', () => {
|
test('Stage and Inner error is logged if a PackageError without inner error', () => {
|
||||||
let event = new Event.InstallationFailure("someStage", new PackageError("someError", null, "innerError"));
|
let event = new Event.InstallationFailure("someStage", new PackageError("someError", null, "innerError"));
|
||||||
observer.post(event);
|
observer.post(event);
|
||||||
|
@ -95,13 +95,13 @@ suite("CsharpLoggerObserver", () => {
|
||||||
].forEach((element) => {
|
].forEach((element) => {
|
||||||
test(`Prints the download status to the logger as ${element.expected}`, () => {
|
test(`Prints the download status to the logger as ${element.expected}`, () => {
|
||||||
let logOutput = "";
|
let logOutput = "";
|
||||||
|
|
||||||
let observer = new CsharpLoggerObserver({
|
let observer = new CsharpLoggerObserver({
|
||||||
...getNullChannel(),
|
...getNullChannel(),
|
||||||
appendLine: (text?: string) => { logOutput += `${text}\n`; },
|
appendLine: (text?: string) => { logOutput += `${text}\n`; },
|
||||||
append: (text?: string) => { logOutput += text; }
|
append: (text?: string) => { logOutput += text; }
|
||||||
});
|
});
|
||||||
|
|
||||||
element.events.forEach((message: Event.BaseEvent) => observer.post(message));
|
element.events.forEach((message: Event.BaseEvent) => observer.post(message));
|
||||||
expect(logOutput).to.be.equal(element.expected);
|
expect(logOutput).to.be.equal(element.expected);
|
||||||
});
|
});
|
||||||
|
@ -175,7 +175,7 @@ suite("CsharpLoggerObserver", () => {
|
||||||
expect(logOutput).to.contain(description);
|
expect(logOutput).to.contain(description);
|
||||||
expect(logOutput).to.contain(url);
|
expect(logOutput).to.contain(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
test(`${Event.IntegrityCheckSuccess.name}: Some message is logged`, () => {
|
test(`${Event.IntegrityCheckSuccess.name}: Some message is logged`, () => {
|
||||||
let event = new Event.IntegrityCheckSuccess();
|
let event = new Event.IntegrityCheckSuccess();
|
||||||
observer.post(event);
|
observer.post(event);
|
||||||
|
|
|
@ -42,18 +42,18 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
|
||||||
observer.post(event);
|
observer.post(event);
|
||||||
expect(appendedMessage).to.contain("foo");
|
expect(appendedMessage).to.contain("foo");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
[
|
||||||
|
new DotNetTestsInClassDebugStart("foo"),
|
||||||
|
new DotNetTestsInClassRunStart("foo")
|
||||||
|
].forEach((event: BaseEvent) => {
|
||||||
|
test(`${event.constructor.name}: Class name is logged`, () => {
|
||||||
|
expect(appendedMessage).to.be.empty;
|
||||||
|
observer.post(event);
|
||||||
|
expect(appendedMessage).to.contain("foo");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
[
|
|
||||||
new DotNetTestsInClassDebugStart("foo"),
|
|
||||||
new DotNetTestsInClassRunStart("foo")
|
|
||||||
].forEach((event: BaseEvent) => {
|
|
||||||
test(`${event.constructor.name}: Class name is logged`, () => {
|
|
||||||
expect(appendedMessage).to.be.empty;
|
|
||||||
observer.post(event);
|
|
||||||
expect(appendedMessage).to.contain("foo");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test(`${DotNetTestDebugProcessStart.name}: Target process id is logged`, () => {
|
test(`${DotNetTestDebugProcessStart.name}: Target process id is logged`, () => {
|
||||||
let event = new DotNetTestDebugProcessStart(111);
|
let event = new DotNetTestDebugProcessStart(111);
|
||||||
|
@ -70,7 +70,7 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
|
||||||
suite(`${ReportDotNetTestResults.name}`, () => {
|
suite(`${ReportDotNetTestResults.name}`, () => {
|
||||||
let event = new ReportDotNetTestResults(
|
let event = new ReportDotNetTestResults(
|
||||||
[
|
[
|
||||||
getDotNetTestResults("foo", "failed", "assertion failed", "stacktrace1" , ["message1", "message2"], ["errorMessage1"]),
|
getDotNetTestResults("foo", "failed", "assertion failed", "stacktrace1", ["message1", "message2"], ["errorMessage1"]),
|
||||||
getDotNetTestResults("failinator", "failed", "error occurred", "stacktrace2", [], []),
|
getDotNetTestResults("failinator", "failed", "error occurred", "stacktrace2", [], []),
|
||||||
getDotNetTestResults("bar", "skipped", "", "", ["message3", "message4"], []),
|
getDotNetTestResults("bar", "skipped", "", "", ["message3", "message4"], []),
|
||||||
getDotNetTestResults("passinator", "passed", "", "", [], []),
|
getDotNetTestResults("passinator", "passed", "", "", [], []),
|
||||||
|
@ -107,7 +107,7 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
|
||||||
result.StandardError.forEach(message => expect(appendedMessage).to.contain(message));
|
result.StandardError.forEach(message => expect(appendedMessage).to.contain(message));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test(`Can handle malformed results`, () => {
|
test(`Can handle malformed results`, () => {
|
||||||
observer.post(new ReportDotNetTestResults([]));
|
observer.post(new ReportDotNetTestResults([]));
|
||||||
expect(appendedMessage).to.contain("----- Test Execution Summary -----\n\nTotal tests: 0. Passed: 0. Failed: 0. Skipped: 0");
|
expect(appendedMessage).to.contain("----- Test Execution Summary -----\n\nTotal tests: 0. Passed: 0. Failed: 0. Skipped: 0");
|
||||||
|
@ -121,7 +121,7 @@ function getDotNetTestResults(methodname: string, outcome: string, errorMessage:
|
||||||
Outcome: outcome,
|
Outcome: outcome,
|
||||||
ErrorMessage: errorMessage,
|
ErrorMessage: errorMessage,
|
||||||
ErrorStackTrace: errorStackTrace,
|
ErrorStackTrace: errorStackTrace,
|
||||||
StandardOutput : stdoutMessages,
|
StandardOutput: stdoutMessages,
|
||||||
StandardError: stdErrorMessages
|
StandardError: stdErrorMessages
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -50,7 +50,7 @@ suite("ErrorMessageObserver", () => {
|
||||||
expect(errorMessage).to.contain(description);
|
expect(errorMessage).to.contain(description);
|
||||||
expect(errorMessage).to.contain(url);
|
expect(errorMessage).to.contain(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Nothing is shown if we are retrying", () => {
|
test("Nothing is shown if we are retrying", () => {
|
||||||
let description = 'someDescription';
|
let description = 'someDescription';
|
||||||
let url = 'someUrl';
|
let url = 'someUrl';
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
import { InformationMessageObserver } from '../../../src/observers/InformationMessageObserver';
|
import { InformationMessageObserver } from '../../../src/observers/InformationMessageObserver';
|
||||||
import { use as chaiUse, expect, should } from 'chai';
|
import { use as chaiUse, expect, should } from 'chai';
|
||||||
import { getUnresolvedDependenices, updateConfig, getVSCodeWithConfig } from '../testAssets/Fakes';
|
import { getUnresolvedDependenices, updateConfig, getVSCodeWithConfig } from '../testAssets/Fakes';
|
||||||
import {from as observableFrom } from 'rxjs';
|
import { from as observableFrom } from 'rxjs';
|
||||||
import {timeout} from 'rxjs/operators';
|
import { timeout } from 'rxjs/operators';
|
||||||
|
|
||||||
chaiUse(require('chai-as-promised'));
|
chaiUse(require('chai-as-promised'));
|
||||||
chaiUse(require('chai-string'));
|
chaiUse(require('chai-string'));
|
||||||
|
@ -76,10 +76,10 @@ suite("InformationMessageObserver", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
teardown(() => {
|
teardown(() => {
|
||||||
commandDone = undefined;
|
commandDone = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
function getVsCode() {
|
function getVsCode() {
|
||||||
|
|
|
@ -161,7 +161,7 @@ suite("OmnisharpLoggerObserver", () => {
|
||||||
let fn = function () { observer.post(event); };
|
let fn = function () { observer.post(event); };
|
||||||
expect(fn).to.not.throw(Error);
|
expect(fn).to.not.throw(Error);
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
new OmnisharpServerOnError({ Text: "someText", FileName: "someFile", Line: 1, Column: 2 }),
|
new OmnisharpServerOnError({ Text: "someText", FileName: "someFile", Line: 1, Column: 2 }),
|
||||||
].forEach((event: OmnisharpServerOnError) => {
|
].forEach((event: OmnisharpServerOnError) => {
|
||||||
|
@ -169,7 +169,7 @@ suite("OmnisharpLoggerObserver", () => {
|
||||||
observer.post(event);
|
observer.post(event);
|
||||||
expect(logOutput).to.contain(event.errorMessage.Text);
|
expect(logOutput).to.contain(event.errorMessage.Text);
|
||||||
});
|
});
|
||||||
|
|
||||||
test(`Contains the error message FileName, Line and column if FileName is not null`, () => {
|
test(`Contains the error message FileName, Line and column if FileName is not null`, () => {
|
||||||
observer.post(event);
|
observer.post(event);
|
||||||
if (event.errorMessage.FileName) {
|
if (event.errorMessage.FileName) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ suite(`${OmniSharpMonoResolver.name}`, () => {
|
||||||
const requiredMonoVersion = "6.4.0";
|
const requiredMonoVersion = "6.4.0";
|
||||||
const higherMonoVersion = "6.6.0";
|
const higherMonoVersion = "6.6.0";
|
||||||
|
|
||||||
const getMono = (version: string) => async(env: NodeJS.ProcessEnv) => {
|
const getMono = (version: string) => async (env: NodeJS.ProcessEnv) => {
|
||||||
getMonoCalled = true;
|
getMonoCalled = true;
|
||||||
environment = env;
|
environment = env;
|
||||||
return Promise.resolve(version);
|
return Promise.resolve(version);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { ConfigurationChangeEvent } from "../../../src/vscodeAdapter";
|
import { ConfigurationChangeEvent } from "../../../src/vscodeAdapter";
|
||||||
|
|
||||||
export function GetConfigChangeEvent(changingConfig: string): ConfigurationChangeEvent {
|
export function GetConfigChangeEvent(changingConfig: string): ConfigurationChangeEvent {
|
||||||
return {
|
return {
|
||||||
affectsConfiguration: (section: string) => section == changingConfig
|
affectsConfiguration: (section: string) => section == changingConfig
|
||||||
|
|
|
@ -11,10 +11,10 @@ const ServerMock = require("mock-http-server");
|
||||||
|
|
||||||
export default class MockHttpsServer {
|
export default class MockHttpsServer {
|
||||||
|
|
||||||
constructor(private server: any, public readonly baseUrl: string){
|
constructor(private server: any, public readonly baseUrl: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public addRequestHandler(method: string, path: string, reply_status: number, reply_headers?: any, reply_body?: any){
|
public addRequestHandler(method: string, path: string, reply_status: number, reply_headers?: any, reply_body?: any) {
|
||||||
this.server.on({
|
this.server.on({
|
||||||
method,
|
method,
|
||||||
path,
|
path,
|
||||||
|
@ -26,11 +26,11 @@ export default class MockHttpsServer {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async start(){
|
public async start() {
|
||||||
return new Promise(resolve => this.server.start(resolve));
|
return new Promise(resolve => this.server.start(resolve));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stop(){
|
public async stop() {
|
||||||
return new Promise((resolve, reject) => this.server.stop(resolve));
|
return new Promise((resolve, reject) => this.server.stop(resolve));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ export default class MockHttpsServer {
|
||||||
key: await fs.readFile("test/unitTests/testAssets/private.pem"),
|
key: await fs.readFile("test/unitTests/testAssets/private.pem"),
|
||||||
cert: await fs.readFile("test/unitTests/testAssets/public.pem")
|
cert: await fs.readFile("test/unitTests/testAssets/public.pem")
|
||||||
});
|
});
|
||||||
|
|
||||||
return new MockHttpsServer(server, `https://localhost:${port}`);
|
return new MockHttpsServer(server, `https://localhost:${port}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,16 +11,16 @@ export default class TestEventBus {
|
||||||
private eventBus: Array<BaseEvent>;
|
private eventBus: Array<BaseEvent>;
|
||||||
private disposable: IDisposable;
|
private disposable: IDisposable;
|
||||||
|
|
||||||
constructor(eventStream: EventStream){
|
constructor(eventStream: EventStream) {
|
||||||
this.eventBus = [];
|
this.eventBus = [];
|
||||||
this.disposable = new Disposable(eventStream.subscribe(event => this.eventBus.push(event)));
|
this.disposable = new Disposable(eventStream.subscribe(event => this.eventBus.push(event)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEvents(): Array<BaseEvent>{
|
public getEvents(): Array<BaseEvent> {
|
||||||
return this.eventBus;
|
return this.eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(){
|
public dispose() {
|
||||||
this.disposable.dispose();
|
this.disposable.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ export interface TestFile {
|
||||||
path: string;
|
path: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTestFile(content: string, path: string): TestFile{
|
export function createTestFile(content: string, path: string): TestFile {
|
||||||
return {
|
return {
|
||||||
content,
|
content,
|
||||||
path
|
path
|
||||||
|
|
|
@ -7,18 +7,18 @@ import * as archiver from 'archiver';
|
||||||
import { TestFile } from './TestFile';
|
import { TestFile } from './TestFile';
|
||||||
|
|
||||||
export default class TestZip {
|
export default class TestZip {
|
||||||
constructor(private readonly _buffer: Buffer, private readonly _files : TestFile[]){
|
constructor(private readonly _buffer: Buffer, private readonly _files: TestFile[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
get buffer(): Buffer{
|
get buffer(): Buffer {
|
||||||
return this._buffer;
|
return this._buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
get size(): number{
|
get size(): number {
|
||||||
return this._buffer.length;
|
return this._buffer.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
get files(): TestFile[]{
|
get files(): TestFile[] {
|
||||||
return this._files;
|
return this._files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ export default class TestZip {
|
||||||
filesToAdd.forEach(elem => archive.append(elem.content, { name: elem.path }));
|
filesToAdd.forEach(elem => archive.append(elem.content, { name: elem.path }));
|
||||||
archive.finalize();
|
archive.finalize();
|
||||||
});
|
});
|
||||||
|
|
||||||
return new TestZip(finalBuffer, filesToAdd);
|
return new TestZip(finalBuffer, filesToAdd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
|
|
||||||
declare module 'http-proxy-agent' {
|
declare module 'http-proxy-agent' {
|
||||||
|
|
||||||
interface IHttpProxyAgentOptions {
|
interface IHttpProxyAgentOptions {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
auth?: string;
|
auth?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class HttpProxyAgent {
|
class HttpProxyAgent {
|
||||||
constructor(proxy: string);
|
constructor(proxy: string);
|
||||||
constructor(opts: IHttpProxyAgentOptions);
|
constructor(opts: IHttpProxyAgentOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
export = HttpProxyAgent;
|
export = HttpProxyAgent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,20 +5,20 @@
|
||||||
|
|
||||||
declare module 'https-proxy-agent' {
|
declare module 'https-proxy-agent' {
|
||||||
|
|
||||||
import * as tls from 'tls';
|
import * as tls from 'tls';
|
||||||
|
|
||||||
interface IHttpsProxyAgentOptions extends tls.ConnectionOptions {
|
interface IHttpsProxyAgentOptions extends tls.ConnectionOptions {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
auth?: string;
|
auth?: string;
|
||||||
secureProxy?: boolean;
|
secureProxy?: boolean;
|
||||||
secureEndpoint?: boolean;
|
secureEndpoint?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class HttpsProxyAgent {
|
class HttpsProxyAgent {
|
||||||
constructor(proxy: string);
|
constructor(proxy: string);
|
||||||
constructor(opts: IHttpsProxyAgentOptions);
|
constructor(opts: IHttpsProxyAgentOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
export = HttpsProxyAgent;
|
export = HttpsProxyAgent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
declare module 'vscode-extension-telemetry' {
|
declare module 'vscode-extension-telemetry' {
|
||||||
export default class TelemetryReporter {
|
export default class TelemetryReporter {
|
||||||
constructor(extensionId: string,extensionVersion: string, key: string);
|
constructor(extensionId: string, extensionVersion: string, key: string);
|
||||||
sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measures?: { [key: string]: number }): void;
|
sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measures?: { [key: string]: number }): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
Загрузка…
Ссылка в новой задаче