Format source to make it consistent

This commit is contained in:
Joey Robichaud 2020-04-20 14:58:52 -07:00
Родитель 506e534d1b
Коммит a8ba6b5394
90 изменённых файлов: 460 добавлений и 487 удалений

Просмотреть файл

@ -18,14 +18,14 @@ require('./tasks/coverageTasks');
// Disable warning about wanting an async function
// tslint:disable-next-line
gulp.task('generateOptionsSchema', () : Promise<void> => {
gulp.task('generateOptionsSchema', (): Promise<void> => {
optionsSchemaGenerator.GenerateOptionsSchema();
return Promise.resolve();
});
// Disable warning about wanting an async function
// tslint:disable-next-line
gulp.task('updatePackageDependencies', () : Promise<void> => {
gulp.task('updatePackageDependencies', (): Promise<void> => {
return packageDependencyUpdater.updatePackageDependencies();
});

Просмотреть файл

@ -6,8 +6,8 @@
import { Advisor } from "./features/diagnosticsProvider";
import { EventStream } from "./EventStream";
export default interface CSharpExtensionExports {
export default interface CSharpExtensionExports {
initializationFinished: () => Promise<void>;
getAdvisor: () => Promise<Advisor>;
eventStream: EventStream;
}
}

Просмотреть файл

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Subscription } from "rxjs";

Просмотреть файл

@ -1,8 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* 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 {
private onDispose: { (): void };
@ -11,7 +11,7 @@ export default class Disposable implements IDisposable {
if (!onDispose) {
throw new Error("onDispose cannot be null or empty.");
}
if (onDispose instanceof Subscription) {
this.onDispose = () => onDispose.unsubscribe();
}

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* 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";
export class EventStream {

Просмотреть файл

@ -60,8 +60,7 @@ export async function execChildProcess(command: string, workingDirectory: string
export async function getUnixChildProcessIds(pid: number): Promise<number[]> {
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) {
return reject(error);
}
@ -108,21 +107,21 @@ export async function fileExists(filePath: string): Promise<boolean> {
export async function deleteIfExists(filePath: string): Promise<void> {
return fileExists(filePath)
.then(async (exists: boolean) => {
return new Promise<void>((resolve, reject) => {
if (!exists) {
return resolve();
}
fs.unlink(filePath, err => {
if (err) {
return reject(err);
.then(async (exists: boolean) => {
return new Promise<void>((resolve, reject) => {
if (!exists) {
return resolve();
}
resolve();
fs.unlink(filePath, err => {
if (err) {
return reject(err);
}
resolve();
});
});
});
});
}
export enum InstallFileType {
@ -130,7 +129,7 @@ export enum InstallFileType {
Lock
}
export function getInstallFilePath(folderPath: AbsolutePath, type: InstallFileType): string {
export function getInstallFilePath(folderPath: AbsolutePath, type: InstallFileType): string {
let installFile = 'install.' + InstallFileType[type];
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.
*
*
* 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 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.
*
*
* 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.
*/
@ -35,8 +35,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
const solutionPathOrFolder: string = this.server.getSolutionPathOrFolder();
// Make sure folder, folder.uri, and solutionPathOrFolder are defined.
if (!solutionPathOrFolder)
{
if (!solutionPathOrFolder) {
return Promise.resolve(false);
}
@ -45,8 +44,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
return fs.lstat(solutionPathOrFolder).then(stat => {
return stat.isFile();
}).then(isFile => {
if (isFile)
{
if (isFile) {
serverFolder = path.dirname(solutionPathOrFolder);
}
@ -73,38 +71,36 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
return [];
}
try
{
let hasWorkspaceMatches : boolean = await this.checkWorkspaceInformationMatchesWorkspaceFolder(folder);
try {
let hasWorkspaceMatches: boolean = await this.checkWorkspaceInformationMatchesWorkspaceFolder(folder);
if (!hasWorkspaceMatches) {
vscode.window.showErrorMessage(`Cannot create .NET debug configurations. The active C# project is not within folder '${folder.uri.fsPath}'.`);
return [];
}
let info: WorkspaceInformationResponse = await serverUtils.requestWorkspaceInformation(this.server);
let info: WorkspaceInformationResponse = await serverUtils.requestWorkspaceInformation(this.server);
const generator = new AssetGenerator(info, folder);
if (generator.hasExecutableProjects()) {
if (!await generator.selectStartupProject())
{
if (!await generator.selectStartupProject()) {
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);
// Add a tasks.json
const buildOperations : AssetOperations = await getBuildOperations(generator);
const buildOperations: AssetOperations = await getBuildOperations(generator);
await addTasksJsonIfNecessary(generator, buildOperations);
const programLaunchType = generator.computeProgramLaunchType();
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);
} else {
} else {
// Error to be caught in the .catch() below to write default C# configurations
throw new Error("Does not contain .NET Core projects.");
}
@ -112,9 +108,9 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
catch
{
// 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 [
createFallbackLaunchConfiguration(),
createFallbackLaunchConfiguration(),
parse(createAttachConfiguration())
];
}
@ -127,7 +123,7 @@ export class CSharpConfigurationProvider implements vscode.DebugConfigurationPro
if (envFile) {
try {
const parsedFile: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromFile(envFile, config["env"]);
// show error message if single lines cannot get parsed
if (parsedFile.Warning) {
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> {
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
return null;
}
if (config.request === "launch")
{
if (config.request === "launch") {
if (!config.cwd && !config.pipeTransport) {
config.cwd = "${workspaceFolder}";
}

Просмотреть файл

@ -5,13 +5,11 @@
import * as fs from 'fs-extra';
export class ParsedEnvironmentFile
{
export class ParsedEnvironmentFile {
public Env: { [key: string]: any };
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.Warning = warning;
}
@ -24,7 +22,7 @@ export class ParsedEnvironmentFile
public static CreateFromContent(content: string, envFile: string, initialEnv: { [key: string]: any } | undefined): ParsedEnvironmentFile {
// Remove UTF-8 BOM if present
if(content.charAt(0) === '\uFEFF') {
if (content.charAt(0) === '\uFEFF') {
content = content.substr(1);
}
@ -60,7 +58,7 @@ export class ParsedEnvironmentFile
// show error message if single lines cannot get parsed
let warning: string = null;
if(parseErrors.length !== 0) {
if (parseErrors.length !== 0) {
warning = "Ignoring non-parseable lines in envFile " + envFile + ": ";
parseErrors.forEach(function (value, idx, array) {
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());
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.
let installLock = false;
let debuggerPackage = getRuntimeDependencyPackageWithId("Debugger", packageJSON, platformInfo, extensionPath);
if (debuggerPackage && debuggerPackage.installPath)
{
if (debuggerPackage && debuggerPackage.installPath) {
installLock = await common.installFileExists(debuggerPackage.installPath, common.InstallFileType.Lock);
}
if (!installLock) {
eventStream.post(new DebuggerNotInstalledFailure());
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'
// property on a launch or attach request.
//
//
// All messages are sent as UTF-8 JSON text with a tailing '\n'
export namespace DebuggerEventsProtocol {
export module EventType {
@ -29,13 +29,13 @@ export namespace DebuggerEventsProtocol {
}
// 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
if (packet[packet.length-1] != 10 /*\n*/) {
if (packet[packet.length - 1] != 10 /*\n*/) {
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);
}
}

Просмотреть файл

@ -11,8 +11,7 @@ import { execChildProcess } from './../common';
const MINIMUM_SUPPORTED_DOTNET_CLI: string = '1.0.0';
export class DotnetInfo
{
export class DotnetInfo {
public Version: string;
public OsVersion: string;
public RuntimeId: string;
@ -23,8 +22,7 @@ export class DotNetCliError extends Error {
public ErrorString: string; // the string to log for this error
}
export class CoreClrDebugUtil
{
export class CoreClrDebugUtil {
private _extensionDir: string = '';
private _debugAdapterDir: string = '';
private _installCompleteFilePath: string = '';
@ -36,8 +34,7 @@ export class CoreClrDebugUtil
}
public extensionDir(): string {
if (this._extensionDir === '')
{
if (this._extensionDir === '') {
throw new Error('Failed to set extension directory');
}
return this._extensionDir;
@ -51,14 +48,13 @@ export class CoreClrDebugUtil
}
public installCompleteFilePath(): string {
if (this._installCompleteFilePath === '')
{
if (this._installCompleteFilePath === '') {
throw new Error('Failed to set install complete file path');
}
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) => {
fs.writeFile(path, '', (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
// is new enough for us.
// is new enough for us.
// 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.
public async checkDotNetCli(): Promise<DotnetInfo>
{
// Throws: An DotNetCliError() from the return promise if either dotnet does not exist or is too old.
public async checkDotNetCli(): Promise<DotnetInfo> {
let dotnetInfo = new DotnetInfo();
return execChildProcess('dotnet --info', process.cwd())
.then((data: string) => {
let lines: string[] = data.replace(/\r/mg, '').split('\n');
lines.forEach(line => {
let match: RegExpMatchArray;
if (match = /^\ Version:\s*([^\s].*)$/.exec(line)) {
dotnetInfo.Version = match[1];
} else if (match = /^\ OS Version:\s*([^\s].*)$/.exec(line)) {
dotnetInfo.OsVersion = match[1];
} else if (match = /^\ RID:\s*([\w\-\.]+)$/.exec(line)) {
dotnetInfo.RuntimeId = match[1];
}
});
}).catch((error) => {
// 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))
{
.then((data: string) => {
let lines: string[] = data.replace(/\r/mg, '').split('\n');
lines.forEach(line => {
let match: RegExpMatchArray;
if (match = /^\ Version:\s*([^\s].*)$/.exec(line)) {
dotnetInfo.Version = match[1];
} else if (match = /^\ OS Version:\s*([^\s].*)$/.exec(line)) {
dotnetInfo.OsVersion = match[1];
} else if (match = /^\ RID:\s*([\w\-\.]+)$/.exec(line)) {
dotnetInfo.RuntimeId = match[1];
}
});
}).catch((error) => {
// something went wrong with spawning 'dotnet --info'
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";
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();
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+
// Darwin version chart: https://en.wikipedia.org/wiki/Darwin_(operating_system)
return semver.gte(os.release(), "16.0.0");
}
public static existsSync(path: string) : boolean {
public static existsSync(path: string): boolean {
try {
fs.accessSync(path, fs.constants.F_OK);
return true;
@ -134,7 +128,7 @@ export class CoreClrDebugUtil
}
}
public static getPlatformExeExtension() : string {
public static getPlatformExeExtension(): string {
if (process.platform === 'win32') {
return '.exe';
}

Просмотреть файл

@ -3,8 +3,8 @@
* 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 {
versions: string[];
}

Просмотреть файл

@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
// Sample Request: https://api.nuget.org/v3/index.json
export default interface NuGetIndexResponse {
resources: NuGetResource[];
}
export default interface NuGetIndexResponse {
resources: NuGetResource[];
}
interface NuGetResource {
'@type': string;
'@id': string;
}
interface NuGetResource {
'@type': string;
'@id': string;
}

Просмотреть файл

@ -5,6 +5,6 @@
// Sample Query: https://api-v2v3search-0.nuget.org/autocomplete
export default interface NuGetSearchAutocompleteServiceResponse {
export default interface NuGetSearchAutocompleteServiceResponse {
data: string[];
}

Просмотреть файл

@ -86,11 +86,11 @@ export class ProjectJSONContribution implements IJSONContribution {
}
public collectPropertySuggestions(
resource: string,
location: Location,
currentWord: string,
addValue: boolean,
isLast: boolean,
resource: string,
location: Location,
currentWord: string,
addValue: boolean,
isLast: boolean,
result: ISuggestionsCollector): Thenable<void> {
if ((location.matches(['dependencies']) || location.matches(['frameworks', '*', 'dependencies']) || location.matches(['frameworks', '*', 'frameworkAssemblies']))) {

Просмотреть файл

@ -99,7 +99,7 @@ function cleanJsonText(text: string) {
function peekPastWhitespace(): number | undefined {
let pos = index;
let code = undefined;
do {
code = text.charCodeAt(pos);
pos++;
@ -145,7 +145,7 @@ function cleanJsonText(text: string) {
parts.push(text.substring(partStart, index - 1));
partStart = index;
break;
// strings
case CharCode.doubleQuote:
scanString();
@ -201,7 +201,7 @@ function cleanJsonText(text: string) {
}
break;
default:
default:
}
if (index >= length && index > partStart) {

Просмотреть файл

@ -5,7 +5,7 @@
let Subscriber: (message: string) => void;
export function SubscribeToAllLoggers(subscriber: (message:string) => void) {
export function SubscribeToAllLoggers(subscriber: (message: string) => void) {
Subscriber = subscriber;
}
@ -36,7 +36,7 @@ export class Logger {
this._atLineStart = false;
}
this.write(message);
this.write(message);
}
public increaseIndent(): void {

Просмотреть файл

@ -92,11 +92,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
let errorMessageObserver = new ErrorMessageObserver(vscode);
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);
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);
eventStream.subscribe(projectStatusBarObserver.post);
@ -151,7 +151,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
eventStream.subscribe(telemetryObserver.post);
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);
// activate language services
@ -208,8 +208,8 @@ function isSupportedPlatform(platform: PlatformInformation): boolean {
if (platform.isLinux()) {
return platform.architecture === "x86_64" ||
platform.architecture === "x86" ||
platform.architecture === "i686";
platform.architecture === "x86" ||
platform.architecture === "i686";
}
return false;

Просмотреть файл

@ -10,17 +10,14 @@ import { DiagnosticStatus } from '../omnisharp/protocol';
export class BackgroundWorkStatusBarObserver extends BaseStatusBarItemObserver {
public post = (event: BaseEvent) => {
if(event.type === EventType.ProjectDiagnosticStatus)
{
if (event.type === EventType.ProjectDiagnosticStatus) {
let asProjectEvent = <OmnisharpProjectDiagnosticStatus>event;
if(asProjectEvent.message.Status === DiagnosticStatus.Processing)
{
if (asProjectEvent.message.Status === DiagnosticStatus.Processing) {
let projectFile = asProjectEvent.message.ProjectFilePath.replace(/^.*[\\\/]/, '');
this.SetAndShowStatusBar(`$(sync~spin) Analyzing ${projectFile}`, 'o.showOutput', null, `Analyzing ${projectFile}`);
}
else
{
else {
this.ResetAndHideStatusBar();
}
}

Просмотреть файл

@ -15,8 +15,8 @@ export abstract class BaseLoggerObserver {
}
else {
this.logger = new Logger((message) => channel.append(message));
}
}
}
abstract post: (event: BaseEvent) => void;
}

Просмотреть файл

@ -14,7 +14,7 @@ export class DotnetLoggerObserver extends BaseLoggerObserver {
break;
case EventType.CommandDotNetRestoreSucceeded:
this.logger.appendLine((<CommandDotNetRestoreSucceeded>event).message);
break;
break;
case EventType.CommandDotNetRestoreFailed:
this.logger.appendLine((<CommandDotNetRestoreFailed>event).message);
break;

Просмотреть файл

@ -11,10 +11,10 @@ export default class DotnetTestChannelObserver extends BaseChannelObserver {
public post = (event: BaseEvent) => {
switch (event.type) {
case EventType.DotNetTestRunStart:
case EventType.DotNetTestRunFailure:
case EventType.DotNetTestsInClassRunStart:
case EventType.DotNetTestDebugStart:
case EventType.DotNetTestsInClassDebugStart:
case EventType.DotNetTestRunFailure:
case EventType.DotNetTestsInClassRunStart:
case EventType.DotNetTestDebugStart:
case EventType.DotNetTestsInClassDebugStart:
this.showChannel(true);
break;
}

Просмотреть файл

@ -24,7 +24,7 @@ export class ErrorMessageObserver {
this.handleDotNetTestDebugStartFailure(<DotNetTestDebugStartFailure>event);
break;
case EventType.IntegrityCheckFailure:
this.handleIntegrityCheckFailure(<IntegrityCheckFailure> event);
this.handleIntegrityCheckFailure(<IntegrityCheckFailure>event);
}
}
@ -39,7 +39,7 @@ export class ErrorMessageObserver {
}
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) {

Просмотреть файл

@ -5,7 +5,7 @@
import * as ObservableEvent from "../omnisharp/loggingEvents";
import { vscode } from '../vscodeAdapter';
import showInformationMessage from "./utils/ShowInformationMessage";
import showInformationMessage from "./utils/ShowInformationMessage";
import { EventType } from "../omnisharp/EventType";
export class InformationMessageObserver {

Просмотреть файл

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { vscode } from "../vscodeAdapter";
@ -8,11 +8,11 @@ import { Options } from "../omnisharp/options";
import ShowInformationMessage from "./utils/ShowInformationMessage";
import { Observable } from "rxjs";
import Disposable from "../Disposable";
import { filter} from 'rxjs/operators';
import { filter } from 'rxjs/operators';
function ConfigChangeObservable(optionObservable: Observable<Options>): Observable<Options> {
let options: Options;
return optionObservable.pipe( filter(newOptions => {
return optionObservable.pipe(filter(newOptions => {
let changed = (options && hasChanged(options, newOptions));
options = newOptions;
return changed;

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Options } from "../omnisharp/options";
import { Subscription , Observable } from "rxjs";
import { Subscription, Observable } from "rxjs";
export default class OptionProvider {
private options: Options;
private subscription: Subscription;

Просмотреть файл

@ -3,10 +3,10 @@
* 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 { BaseEvent, OmnisharpServerMsBuildProjectDiagnostics } from "../omnisharp/loggingEvents";
import { Scheduler , Subject } from 'rxjs';
import { Scheduler, Subject } from 'rxjs';
import showWarningMessage from './utils/ShowWarningMessage';
import { EventType } from '../omnisharp/EventType';

Просмотреть файл

@ -22,17 +22,17 @@ type RemapParameterType<M extends keyof RemapApi> = GetRemapType<NonNullable<Rem
export class LanguageMiddlewareFeature implements IDisposable {
private readonly _middlewares: LanguageMiddleware[];
private _registration : IDisposable;
private _registration: IDisposable;
constructor() {
this._middlewares = [];
}
public dispose() : void {
public dispose(): void {
this._registration.dispose();
}
public register() : void {
public register(): void {
this._registration = vscode.commands.registerCommand(
'omnisharp.registerLanguageMiddleware', (middleware: LanguageMiddleware) => {
this._middlewares.push(middleware);
@ -51,7 +51,7 @@ export class LanguageMiddlewareFeature implements IDisposable {
for (const middleware of languageMiddlewares) {
// 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) {
continue;
}

Просмотреть файл

@ -41,7 +41,7 @@ export class OmnisharpManager {
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);
}

Просмотреть файл

@ -64,7 +64,7 @@ function resourcesToLaunchTargets(resources: vscode.Uri[]): LaunchTarget[] {
//
// TODO:
// * 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.
if (!Array.isArray(resources)) {
@ -262,7 +262,7 @@ async function launch(cwd: string, args: string[], launchInfo: LaunchInfo, platf
}
let monoInfo = await monoResolver.getGlobalMonoInfo(options);
if (monoInfo) {
const launchPath = launchInfo.MonoLaunchPath || launchInfo.LaunchPath;
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
argsCopy.unshift(launchPath);
argsCopy.unshift("--assembly-loader=strict");
if (useDebugger)
{
argsCopy.unshift("--debug");
argsCopy.unshift("--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555");
}
if (useDebugger) {
argsCopy.unshift("--debug");
argsCopy.unshift("--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555");
}
let process = spawn('mono', argsCopy, {
detached: false,

Просмотреть файл

@ -88,244 +88,244 @@ export class TestExecutionCountReport implements BaseEvent {
}
export class OmnisharpServerOnError implements BaseEvent {
type=EventType.OmnisharpServerOnError;
type = EventType.OmnisharpServerOnError;
constructor(public errorMessage: protocol.ErrorMessage) { }
}
export class OmnisharpProjectDiagnosticStatus implements BaseEvent {
type=EventType.ProjectDiagnosticStatus;
type = EventType.ProjectDiagnosticStatus;
constructor(public message: protocol.ProjectDiagnosticStatus) { }
}
export class OmnisharpServerMsBuildProjectDiagnostics implements BaseEvent {
type=EventType.OmnisharpServerMsBuildProjectDiagnostics;
type = EventType.OmnisharpServerMsBuildProjectDiagnostics;
constructor(public diagnostics: protocol.MSBuildProjectDiagnostics) { }
}
export class OmnisharpServerUnresolvedDependencies implements BaseEvent {
type=EventType.OmnisharpServerUnresolvedDependencies;
type = EventType.OmnisharpServerUnresolvedDependencies;
constructor(public unresolvedDependencies: protocol.UnresolvedDependenciesMessage) { }
}
export class OmnisharpServerEnqueueRequest implements BaseEvent {
type=EventType.OmnisharpServerEnqueueRequest;
type = EventType.OmnisharpServerEnqueueRequest;
constructor(public name: string, public command: string) { }
}
export class OmnisharpServerDequeueRequest implements BaseEvent {
type=EventType.OmnisharpServerDequeueRequest;
type = EventType.OmnisharpServerDequeueRequest;
constructor(public name: string, public command: string, public id: number) { }
}
export class OmnisharpServerProcessRequestStart implements BaseEvent {
type=EventType.OmnisharpServerProcessRequestStart;
type = EventType.OmnisharpServerProcessRequestStart;
constructor(public name: string) { }
}
export class OmnisharpEventPacketReceived implements BaseEvent {
type=EventType.OmnisharpEventPacketReceived;
type = EventType.OmnisharpEventPacketReceived;
constructor(public logLevel: string, public name: string, public message: string) { }
}
export class OmnisharpServerOnServerError implements BaseEvent {
type=EventType.OmnisharpServerOnServerError;
type = EventType.OmnisharpServerOnServerError;
constructor(public err: any) { }
}
export class OmnisharpOnMultipleLaunchTargets implements BaseEvent {
type=EventType.OmnisharpOnMultipleLaunchTargets;
type = EventType.OmnisharpOnMultipleLaunchTargets;
constructor(public targets: LaunchTarget[]) { }
}
export class ProjectConfiguration implements BaseEvent{
export class ProjectConfiguration implements BaseEvent {
type = EventType.ProjectConfigurationReceived;
constructor(public projectConfiguration: protocol.ProjectConfigurationMessage){}
constructor(public projectConfiguration: protocol.ProjectConfigurationMessage) { }
}
export class WorkspaceInformationUpdated implements BaseEvent {
type=EventType.WorkspaceInformationUpdated;
type = EventType.WorkspaceInformationUpdated;
constructor(public info: protocol.WorkspaceInformationResponse) { }
}
export class EventWithMessage implements BaseEvent {
type=EventType.EventWithMessage;
type = EventType.EventWithMessage;
constructor(public message: string) { }
}
export class DownloadStart implements BaseEvent {
type=EventType.DownloadStart;
type = EventType.DownloadStart;
constructor(public packageDescription: string) { }
}
export class DownloadFallBack implements BaseEvent {
type=EventType.DownloadFallBack;
type = EventType.DownloadFallBack;
constructor(public fallbackUrl: string) { }
}
export class DownloadSizeObtained implements BaseEvent {
type=EventType.DownloadSizeObtained;
type = EventType.DownloadSizeObtained;
constructor(public packageSize: number) { }
}
export class ZipError implements BaseEvent {
type=EventType.ZipError;
type = EventType.ZipError;
constructor(public message: string) { }
}
export class ReportDotNetTestResults implements BaseEvent {
type=EventType.ReportDotNetTestResults;
type = EventType.ReportDotNetTestResults;
constructor(public results: protocol.V2.DotNetTestResult[]) { }
}
export class DotNetTestRunStart implements BaseEvent {
type=EventType.DotNetTestRunStart;
type = EventType.DotNetTestRunStart;
constructor(public testMethod: string) { }
}
export class DotNetTestDebugStart implements BaseEvent {
type=EventType.DotNetTestDebugStart;
type = EventType.DotNetTestDebugStart;
constructor(public testMethod: string) { }
}
export class DotNetTestDebugProcessStart implements BaseEvent {
type=EventType.DotNetTestDebugProcessStart;
type = EventType.DotNetTestDebugProcessStart;
constructor(public targetProcessId: number) { }
}
export class DotNetTestsInClassRunStart implements BaseEvent {
type=EventType.DotNetTestsInClassRunStart;
type = EventType.DotNetTestsInClassRunStart;
constructor(public className: string) { }
}
export class DotNetTestsInClassDebugStart implements BaseEvent {
type=EventType.DotNetTestsInClassDebugStart;
type = EventType.DotNetTestsInClassDebugStart;
constructor(public className: string) { }
}
export class DocumentSynchronizationFailure implements BaseEvent {
type=EventType.DocumentSynchronizationFailure;
type = EventType.DocumentSynchronizationFailure;
constructor(public documentPath: string, public errorMessage: string) { }
}
export class OpenURL {
type=EventType.OpenURL;
type = EventType.OpenURL;
constructor(public url: string) { }
}
export class IntegrityCheckFailure {
type=EventType.IntegrityCheckFailure;
constructor(public packageDescription: string, public url: string, public retry: boolean){ }
type = EventType.IntegrityCheckFailure;
constructor(public packageDescription: string, public url: string, public retry: boolean) { }
}
export class IntegrityCheckSuccess {
type=EventType.IntegrityCheckSuccess;
type = EventType.IntegrityCheckSuccess;
constructor() { }
}
export class RazorPluginPathSpecified implements BaseEvent {
type=EventType.RazorPluginPathSpecified;
constructor(public path: string) {}
type = EventType.RazorPluginPathSpecified;
constructor(public path: string) { }
}
export class RazorPluginPathDoesNotExist implements BaseEvent {
type=EventType.RazorPluginPathDoesNotExist;
constructor(public path: string) {}
type = EventType.RazorPluginPathDoesNotExist;
constructor(public path: string) { }
}
export class DebuggerPrerequisiteFailure extends EventWithMessage {
type = EventType.DebuggerPrerequisiteFailure;
}
}
export class DebuggerPrerequisiteWarning extends EventWithMessage {
type = EventType.DebuggerPrerequisiteWarning;
}
}
export class CommandDotNetRestoreProgress extends EventWithMessage {
type = EventType.CommandDotNetRestoreProgress;
}
}
export class CommandDotNetRestoreSucceeded extends EventWithMessage {
type = EventType.CommandDotNetRestoreSucceeded;
}
}
export class CommandDotNetRestoreFailed extends EventWithMessage {
type = EventType.CommandDotNetRestoreFailed;
}
}
export class DownloadSuccess extends EventWithMessage {
type = EventType.DownloadSuccess;
}
}
export class DownloadFailure extends EventWithMessage {
type = EventType.DownloadFailure;
}
}
export class OmnisharpServerOnStdErr extends EventWithMessage {
type = EventType.OmnisharpServerOnStdErr;
}
}
export class OmnisharpServerMessage extends EventWithMessage {
type = EventType.OmnisharpServerMessage;
}
}
export class OmnisharpServerVerboseMessage extends EventWithMessage {
type = EventType.OmnisharpServerVerboseMessage;
}
}
export class DotNetTestMessage extends EventWithMessage {
type = EventType.DotNetTestMessage;
}
}
export class DotNetTestRunFailure extends EventWithMessage {
type = EventType.DotNetTestRunFailure;
}
}
export class DotNetTestDebugWarning extends EventWithMessage {
type = EventType.DotNetTestDebugWarning;
}
}
export class DotNetTestDebugStartFailure extends EventWithMessage {
type = EventType.DotNetTestDebugStartFailure;
}
}
export class RazorDevModeActive implements BaseEvent {
type = EventType.RazorDevModeActive;
}
}
export class ProjectModified implements BaseEvent {
type = EventType.ProjectModified;
}
}
export class ActivationFailure implements BaseEvent {
type = EventType.ActivationFailure;
}
}
export class ShowOmniSharpChannel implements BaseEvent {
type = EventType.ShowOmniSharpChannel;
}
}
export class DebuggerNotInstalledFailure implements BaseEvent {
type = EventType.DebuggerNotInstalledFailure;
}
}
export class CommandDotNetRestoreStart implements BaseEvent {
type = EventType.CommandDotNetRestoreStart;
}
}
export class InstallationSuccess implements BaseEvent {
type = EventType.InstallationSuccess;
}
}
export class OmnisharpServerProcessRequestComplete implements BaseEvent {
type = EventType.OmnisharpServerProcessRequestComplete;
}
}
export class ProjectJsonDeprecatedWarning implements BaseEvent {
type = EventType.ProjectJsonDeprecatedWarning;
}
}
export class OmnisharpOnBeforeServerStart implements BaseEvent {
type = EventType.OmnisharpOnBeforeServerStart;
}
}
export class OmnisharpOnBeforeServerInstall implements BaseEvent {
type = EventType.OmnisharpOnBeforeServerInstall;
}
}
export class ActiveTextEditorChanged implements BaseEvent {
type = EventType.ActiveTextEditorChanged;
}
}
export class OmnisharpServerOnStop implements BaseEvent {
type = EventType.OmnisharpServerOnStop;
}
}
export class OmnisharpServerOnStart implements BaseEvent {
type = EventType.OmnisharpServerOnStart;
}
}
export class LatestBuildDownloadStart implements BaseEvent {
type = EventType.LatestBuildDownloadStart;
}
}
export class OmnisharpRestart implements BaseEvent {
type = EventType.OmnisharpRestart;
}
}
export class DotNetTestDebugComplete implements BaseEvent {
type = EventType.DotNetTestDebugComplete;
}
}
export class DownloadValidation implements BaseEvent {
type = EventType.DownloadValidation;
}
}

Просмотреть файл

@ -26,7 +26,7 @@ import * as ObservableEvents from './loggingEvents';
import { EventStream } from '../EventStream';
import { NetworkSettingsProvider } from '../NetworkSettings';
import { Subject } from 'rxjs';
import {debounceTime} from 'rxjs/operators';
import { debounceTime } from 'rxjs/operators';
import CompositeDisposable from '../CompositeDisposable';
import Disposable from '../Disposable';
import OptionProvider from '../observers/OptionProvider';
@ -333,11 +333,10 @@ export class OmniSharpServer {
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]}`);
}
if (options.enableMsBuildLoadProjectsOnDemand === 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);
}

Просмотреть файл

@ -5,7 +5,7 @@
import { isAbsolute, resolve } from "path";
export class AbsolutePath{
export class AbsolutePath {
constructor(public value: string) {
if (!isAbsolute(value)) {
throw new Error("The path must be absolute");

Просмотреть файл

@ -7,7 +7,7 @@ import { Package } from "./Package";
import { IPackage } from "./IPackage";
import { AbsolutePath } from "./AbsolutePath";
export class AbsolutePathPackage implements IPackage{
export class AbsolutePathPackage implements IPackage {
constructor(public id: string,
public description: string,
public url: string,
@ -15,7 +15,7 @@ export class AbsolutePathPackage implements IPackage{
public architectures: string[],
public binaries: AbsolutePath[],
public installPath?: AbsolutePath,
public installTestPath?: AbsolutePath,
public installTestPath?: AbsolutePath,
public fallbackUrl?: string,
public platformId?: string,
public integrity?: string) {
@ -38,27 +38,27 @@ export class AbsolutePathPackage implements IPackage{
}
}
function getAbsoluteInstallTestPath(pkg: Package, extensionPath: string): AbsolutePath {
if (pkg.installTestPath) {
function getAbsoluteInstallTestPath(pkg: Package, extensionPath: string): AbsolutePath {
if (pkg.installTestPath) {
return AbsolutePath.getAbsolutePath(extensionPath, pkg.installTestPath);
}
return null;
}
function getAbsoluteBinaries(pkg: Package, extensionPath: string): AbsolutePath[] {
}
return null;
}
function getAbsoluteBinaries(pkg: Package, extensionPath: string): AbsolutePath[] {
let basePath = getAbsoluteInstallPath(pkg, extensionPath).value;
if (pkg.binaries) {
return pkg.binaries.map(value => AbsolutePath.getAbsolutePath(basePath, value));
}
return null;
}
function getAbsoluteInstallPath(pkg: Package, extensionPath: string): AbsolutePath {
if (pkg.installPath) {
if (pkg.binaries) {
return pkg.binaries.map(value => AbsolutePath.getAbsolutePath(basePath, value));
}
return null;
}
function getAbsoluteInstallPath(pkg: Package, extensionPath: string): AbsolutePath {
if (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;
}
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 CDN link
if (fallbackUrl) {

Просмотреть файл

@ -5,7 +5,7 @@
import { IPackage } from "./IPackage";
export interface Package extends IPackage{
export interface Package extends IPackage {
installPath?: string;
binaries: string[];
installTestPath?: string;

Просмотреть файл

@ -44,5 +44,5 @@ async function filterAlreadyInstalledPackages(packages: AbsolutePathPackage[]):
}
return !(await util.fileExists(testPath));
});
});
}

Просмотреть файл

@ -9,8 +9,7 @@ import { getNotInstalledPackagesForPlatform } from "./PackageFilterer";
import { Package } from "./Package";
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));
return getNotInstalledPackagesForPlatform(absolutePathPackages, platformInfo);
}

Просмотреть файл

@ -14,8 +14,8 @@ export interface DownloadValidator {
export function isValidDownload(buffer: Buffer, integrity: string, eventStream: EventStream): boolean {
if (integrity && integrity.length > 0) {
eventStream.post(new DownloadValidation());
let value = getBufferIntegrityHash(buffer);
if (value == integrity.toUpperCase()) {
let value = getBufferIntegrityHash(buffer);
if (value == integrity.toUpperCase()) {
eventStream.post(new IntegrityCheckSuccess());
return true;
}
@ -28,7 +28,7 @@ export function isValidDownload(buffer: Buffer, integrity: string, eventStream:
return true;
}
export function getBufferIntegrityHash(buffer: Buffer) : string {
export function getBufferIntegrityHash(buffer: Buffer): string {
let hash = crypto.createHash('sha256');
hash.update(buffer);
let value = hash.digest('hex').toUpperCase();

Просмотреть файл

@ -24,7 +24,7 @@ export function getProxyAgent(requestURL: Url, proxy: string, strictSSL: boolean
if (!proxyURL) {
return null;
}
const proxyEndpoint = parseUrl(proxyURL);
if (!/^https?:$/.test(proxyEndpoint.protocol)) {

Просмотреть файл

@ -78,7 +78,7 @@ export class LinuxDistribution {
public static FromReleaseInfo(releaseInfo: string, eol: string = os.EOL): LinuxDistribution {
let name = unknown;
let version = unknown;
let idLike : string[] = null;
let idLike: string[] = null;
const lines = releaseInfo.split(eol);
for (let line of lines) {
@ -118,8 +118,7 @@ export class PlatformInformation {
public constructor(
public platform: string,
public architecture: string,
public distribution: LinuxDistribution = null)
{
public distribution: LinuxDistribution = null) {
}
public isWindows(): boolean {
@ -182,7 +181,7 @@ export class PlatformInformation {
}
const platformData: [string, LinuxDistribution] = await Promise.all([architecturePromise, distributionPromise]);
return new PlatformInformation(platform, platformData[0], platformData[1]);
}

Просмотреть файл

@ -8,15 +8,15 @@ import * as vscode from 'vscode';
export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
get alignment(): vscodeAdapter.StatusBarAlignment{
get alignment(): vscodeAdapter.StatusBarAlignment {
return this.statusBarItem.alignment;
}
get priority(): number{
get priority(): number {
return this.statusBarItem.priority;
}
get text(): string{
get text(): string {
return this.statusBarItem.text;
}
@ -24,15 +24,15 @@ export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
this.statusBarItem.text = value;
}
get tooltip(): string{
get tooltip(): string {
return this.statusBarItem.tooltip;
}
set tooltip(value: string){
set tooltip(value: string) {
this.statusBarItem.tooltip = value;
}
get color(): string{
get color(): string {
return this.statusBarItem.color as string;
}
@ -40,7 +40,7 @@ export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
this.statusBarItem.color = value;
}
get command(): string{
get command(): string {
return this.statusBarItem.command;
}
@ -59,7 +59,7 @@ export class StatusBarItemAdapter implements vscodeAdapter.StatusBarItem {
dispose(): void {
this.statusBarItem.dispose();
}
constructor(private statusBarItem: vscode.StatusBarItem) {
}
}

Просмотреть файл

@ -7,7 +7,7 @@ import * as vscodeAdapter from './vscodeAdapter';
import * as vscode from 'vscode';
export class TextEditorAdapter implements vscodeAdapter.TextEditor {
get document(): any {
return this.textEditor.document;
}

Просмотреть файл

@ -11,7 +11,7 @@ function AppendFieldsToObject(reference: any, obj: any) {
// Make sure it is an object type
if (typeof obj == 'object') {
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)) {
obj[referenceKey] = AppendFieldsToObject(reference[referenceKey], obj[referenceKey]);
} else {
@ -24,7 +24,7 @@ function AppendFieldsToObject(reference: any, obj: any) {
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) {
let newDefault: any = {};
@ -75,7 +75,7 @@ function ReplaceReferences(definitions: any, objects: any) {
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) {
objects[key].properties = ReplaceReferences(definitions, objects[key].properties);
objects[key].properties = UpdateDefaults(objects[key].properties, objects[key].default);
@ -85,7 +85,7 @@ function ReplaceReferences(definitions: any, objects: any) {
return objects;
}
function mergeReferences(baseDefinitions: any, additionalDefinitions: any) : void {
function mergeReferences(baseDefinitions: any, additionalDefinitions: any): void {
for (let key in additionalDefinitions) {
if (baseDefinitions[key]) {
throw `Error: '${key}' defined in multiple schema files.`;
@ -138,7 +138,7 @@ export function GenerateOptionsSchema() {
if (os.platform() === 'win32') {
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
// 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");

Просмотреть файл

@ -87,7 +87,7 @@ export async function updatePackageDependencies(): Promise<void> {
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();
eventStream.subscribe((event: Event.BaseEvent) => {
switch (event.type) {
@ -169,11 +169,11 @@ function verifyVersionSubstringCount(value: string, shouldContainVersion = false
regexp.lastIndex = 0;
return retVal;
};
if (!value) {
return;
}
const dottedMatches: number = getMatchCount(dottedVersionRegExp, value);
const dashedMatches: number = getMatchCount(dashedVersionRegExp, value);
const matchCount: number = dottedMatches + dashedMatches;

Просмотреть файл

@ -6,10 +6,10 @@
const removeBomBuffer = require("remove-bom-buffer");
const removeBomString = require("strip-bom");
export function removeBOMFromBuffer(buffer: Buffer): Buffer{
return <Buffer> removeBomBuffer(buffer);
export function removeBOMFromBuffer(buffer: Buffer): Buffer {
return <Buffer>removeBomBuffer(buffer);
}
export function removeBOMFromString(line: string): string{
export function removeBOMFromString(line: string): string {
return removeBomString(line.trim());
}

Просмотреть файл

@ -40,13 +40,13 @@ gulp.task('vsix:offline:package', async () => {
async function doPackageOffline() {
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);
}
else {
cleanSync(true);
}
const packageJSON = getPackageJSON();
const name = packageJSON.name;
const version = packageJSON.version;

Просмотреть файл

@ -8,5 +8,5 @@
import * as fs from 'fs';
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";
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) {
options = {
env: {}
};
}
let optionsWithFullEnvironment = {
cwd: rootPath,
...options,
@ -24,11 +24,11 @@ export default async function spawnNode(args?: string[], options?: SpawnOptions)
...options.env
}
};
console.log(`starting ${nodePath} ${args.join(' ')}`);
let spawned = spawn(nodePath, args, optionsWithFullEnvironment);
spawned.stderr.pipe(process.stdout);
spawned.stdout.pipe(process.stdout);

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import shelljs = require("async-shelljs");
import shelljs = require("async-shelljs");
import path = require('path');
const fs = require('async-file');
@ -64,7 +64,7 @@ export default class CoverageWritingTestRunner {
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) {
if (remappedResult[key].path) {
@ -84,14 +84,14 @@ export default class CoverageWritingTestRunner {
}
}
catch (e) {
console.log(`Coverage remapping failure: ${JSON.stringify(e)}`);
console.log(`* rawCoverageJsonPath: ${rawCoverageJsonPath}`);
console.log(`* remappedCoverageJsonPath: ${remappedCoverageJsonPath}`);
console.log(`* outFolderPath: ${outFolderPath}`);
console.log(`* remapIstanbulPath: ${remapIstanbulPath}`);
console.log(`* nodePath: ${nodePath}`);
console.log(e);
}
console.log(`Coverage remapping failure: ${JSON.stringify(e)}`);
console.log(`* rawCoverageJsonPath: ${rawCoverageJsonPath}`);
console.log(`* remappedCoverageJsonPath: ${remappedCoverageJsonPath}`);
console.log(`* outFolderPath: ${outFolderPath}`);
console.log(`* remapIstanbulPath: ${remapIstanbulPath}`);
console.log(`* nodePath: ${nodePath}`);
console.log(e);
}
}
}
}
}

Просмотреть файл

@ -128,13 +128,13 @@ suite("Remote Process Picker: Validate quoting arguments.", () => {
test("Multiple ${debuggerCommand} in string args", () => {
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", () => {
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", () => {

Просмотреть файл

@ -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;
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') {
this.skip();
}
else
{
else {
await activateCSharpExtension();
await testAssetWorkspace.restore();

Просмотреть файл

@ -13,7 +13,7 @@ import { activateCSharpExtension, isRazorWorkspace } from "./integrationHelpers"
suite(`${OmniSharpCompletionItemProvider.name}: Returns the completion items`, () => {
let fileUri: vscode.Uri;
suiteSetup(async function() {
suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (isRazorWorkspace(vscode.workspace)) {
this.skip();

Просмотреть файл

@ -32,7 +32,7 @@ suite(`${CSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, ()
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)));
expect(definitionList.length).to.be.equal(1);
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
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)));
expect(definitionList.length).to.be.equal(1);
expect(definitionList[0]).to.exist;

Просмотреть файл

@ -57,18 +57,18 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
});
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);
if(!virtual) {
if (!virtual) {
return false;
}
const diagnosticsList = virtual[1];
if(diagnosticsList.some(diag => diag.code == 'CS0103')) {
if (diagnosticsList.some(diag => diag.code == 'CS0103')) {
return true;
}
else{
else {
return false;
}
});
@ -141,7 +141,7 @@ suite(`DiagnosticProvider: ${testAssetWorkspace.description}`, function () {
await vscode.commands.executeCommand("vscode.open", secondaryFileUri);
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));
});

Просмотреть файл

@ -13,7 +13,7 @@ import { activateCSharpExtension, isRazorWorkspace } from './integrationHelpers'
suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`, () => {
let fileUri: vscode.Uri;
suiteSetup(async function() {
suiteSetup(async function () {
// These tests don't run on the BasicRazorApp2_1 solution
if (isRazorWorkspace(vscode.workspace)) {
this.skip();
@ -32,7 +32,7 @@ suite(`${CSharpImplementationProvider.name}: ${testAssetWorkspace.description}`,
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)));
expect(implementationList.length).to.be.equal(2);
});

Просмотреть файл

@ -35,12 +35,12 @@ testRunner.configure({
if (process.env.CODE_EXTENSIONS_PATH && process.env.OSVC_SUITE) {
let logDirPath = path.join(process.env.CODE_EXTENSIONS_PATH, "./.logs");
if (!fs.existsSync(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));
}

Просмотреть файл

@ -36,7 +36,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
await testAssetWorkspace.cleanupWorkspace();
});
test("Returns the remapped workspaceEdit", async() => {
test("Returns the remapped workspaceEdit", async () => {
// Avoid flakiness with renames.
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);
});
test("Returns the remapped references", async() => {
test("Returns the remapped references", async () => {
let references = <vscode.Location[]>(await vscode.commands.executeCommand(
"vscode.executeReferenceProvider",
fileUri,
@ -61,7 +61,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
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(
"vscode.executeDefinitionProvider",
fileUri,
@ -70,7 +70,7 @@ suite(`${LanguageMiddlewareFeature.name}: ${testAssetWorkspace.description}`, ()
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(
"vscode.executeImplementationProvider",
fileUri,
@ -85,8 +85,7 @@ async function registerLanguageMiddleware() {
await vscode.commands.executeCommand<void>('omnisharp.registerLanguageMiddleware', middleware);
}
class TestLanguageMiddleware implements LanguageMiddleware
{
class TestLanguageMiddleware implements LanguageMiddleware {
public readonly language = 'MyLang';
private readonly remappedFileUri: vscode.Uri;
private readonly fileToRemapUri: vscode.Uri;

Просмотреть файл

@ -47,7 +47,7 @@ suite(`Tasks generation: ${testAssetWorkspace.description}`, function () {
expect(result, "Debugger could not be started.");
let debugSessionTerminated = new Promise(resolve => {
vscode.debug.onDidTerminateDebugSession((e) => resolve());
vscode.debug.onDidTerminateDebugSession((e) => resolve());
});
await debugSessionTerminated;

Просмотреть файл

@ -19,13 +19,11 @@ const chai = require('chai');
chai.use(require('chai-arrays'));
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[] = [];
stream.subscribe((event: BaseEvent) => {
if(event.type === type)
{
if (event.type === type) {
results.push(<T>event);
}
});
@ -72,11 +70,11 @@ suite(`ReAnalyze: ${testAssetWorkspace.description}`, function () {
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(
() => vscode.languages.getDiagnostics(interfaceImplUri),
15*1000,
15 * 1000,
500,
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 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.Processing) != 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 () {
@ -95,7 +93,7 @@ suite(`ReAnalyze: ${testAssetWorkspace.description}`, function () {
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.Ready) != 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);
});
});

Просмотреть файл

@ -32,7 +32,7 @@ suite(`${OmnisharpReferenceProvider.name}: ${testAssetWorkspace.description}`, (
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)));
expect(referenceList.length).to.be.equal(1);
expect(referenceList[0].range.start.line).to.be.equal(13);

Просмотреть файл

@ -12,13 +12,13 @@ suite(AbsolutePath.name, () => {
let tmpPath: TmpAsset;
setup(async () => {
tmpPath = await CreateTmpFile();
tmpPath = await CreateTmpFile();
});
teardown(() => {
tmpPath.dispose();
tmpPath.dispose();
});
test('Throws error when the passed value is not an absolute path', () => {
expect(() => new AbsolutePath("somePath")).to.throw(Error);
});

Просмотреть файл

@ -6,4 +6,4 @@
import { IGetDotnetInfo } from "../../../src/constants/IGetDotnetInfo";
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) {
return Promise.resolve(fakeMonoInfo);
}
return Promise.resolve(undefined);
}
}

Просмотреть файл

@ -27,24 +27,24 @@ suite(`${installRuntimeDependencies.name}`, () => {
let platformInfo = new PlatformInformation("platform1", "architecture1");
setup(() => {
eventStream = new EventStream();
eventStream = new EventStream();
eventBus = new TestEventBus(eventStream);
installDependencies = async() => Promise.resolve(true);
installDependencies = async () => Promise.resolve(true);
});
suite("When all the dependencies already exist", () => {
suiteSetup(() => {
packageJSON = {
runtimeDependencies: {}
};
});
test("True is returned", async () => {
let installed = await installRuntimeDependencies(packageJSON, extensionPath, installDependencies, eventStream, platformInfo);
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 = {
runtimeDependencies: {}
};
@ -55,8 +55,8 @@ suite(`${installRuntimeDependencies.name}`, () => {
});
suite("When there is a dependency to install", () => {
let packageToInstall : Package= {
id:"myPackage",
let packageToInstall: Package = {
id: "myPackage",
description: "somePackage",
installPath: "installPath",
binaries: [],
@ -73,7 +73,7 @@ suite(`${installRuntimeDependencies.name}`, () => {
test("Calls installDependencies with the absolute path package and returns true after successful installation", async () => {
let inputPackage: AbsolutePathPackage[];
installDependencies = async(packages) => {
installDependencies = async (packages) => {
inputPackage = packages;
return Promise.resolve(true);
};
@ -85,7 +85,7 @@ suite(`${installRuntimeDependencies.name}`, () => {
});
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);
expect(installed).to.be.false;
});

Просмотреть файл

@ -11,7 +11,7 @@ import { CreateTmpDir, TmpAsset } from "../../src/CreateTmpAsset";
import * as util from '../../src/common';
import * as path from 'path';
import MockHttpsServer from "./testAssets/MockHttpsServer";
import {expect} from 'chai';
import { expect } from 'chai';
import TestZip from "./testAssets/TestZip";
import { createTestFile } from "./testAssets/TestFile";
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', () => {
const networkSettingsProvider = () => new NetworkSettings(undefined, false);
let eventStream : EventStream;
let eventStream: EventStream;
const installPath = "somePath";
let platformInfo = new PlatformInformation("win32", "x86");
let downloader: OmnisharpDownloader;
@ -46,7 +46,7 @@ suite('OmnisharpDownloader', () => {
}, 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;
});
@ -58,7 +58,7 @@ suite('OmnisharpDownloader', () => {
}
});
test('Events are created', async () => {
test('Events are created', async () => {
let expectedSequence = [
new PackageInstallation('OmniSharp Version = 1.2.3'),
new LogPlatformInfo(new PlatformInformation("win32", "x86")),
@ -67,14 +67,14 @@ suite('OmnisharpDownloader', () => {
new DownloadSizeObtained(testZip.size),
new DownloadProgress(100, 'OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
new DownloadSuccess(' Done!'),
new InstallationStart('OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
new InstallationSuccess()
new InstallationStart('OmniSharp for Windows (.NET 4.6 / x86), Version = 1.2.3'),
new InstallationSuccess()
];
expect(eventBus.getEvents()).to.be.empty;
await downloader.DownloadAndInstallOmnisharp(version, server.baseUrl, installPath);
expect(eventBus.getEvents()).to.be.deep.equal(expectedSequence);
});
expect(eventBus.getEvents()).to.be.empty;
await downloader.DownloadAndInstallOmnisharp(version, server.baseUrl, installPath);
expect(eventBus.getEvents()).to.be.deep.equal(expectedSequence);
});
teardown(async () => {
tmpDir.dispose();

Просмотреть файл

@ -20,7 +20,7 @@ import * as util from '../../src/common';
suite(OmnisharpManager.name, () => {
let server: MockHttpsServer;
const eventStream = new EventStream();
let manager : OmnisharpManager;
let manager: OmnisharpManager;
const defaultVersion = "0.1.2";
const testVersion = "1.2.3";
const latestVersion = "2.3.4";

Просмотреть файл

@ -20,7 +20,7 @@ suite("GetOmnisharpPackage : Output package depends on the input package and oth
version = "0.0.0";
installPath = "testPath";
let packageJSON = testPackageJSON;
inputPackages = <Package[]> (packageJSON.runtimeDependencies);
inputPackages = <Package[]>(packageJSON.runtimeDependencies);
should();
});
@ -32,7 +32,7 @@ suite("GetOmnisharpPackage : Output package depends on the input package and oth
test('Throws exception if version is null', () => {
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');
});
@ -100,7 +100,7 @@ suite('GetPackagesFromVersion : Gets the experimental omnisharp packages from a
const serverUrl = "http://serverUrl";
const installPath = "testPath";
let inputPackages : any;
let inputPackages: any;
suiteSetup(() => {
inputPackages = <Package[]>(testPackageJSON.runtimeDependencies);

Просмотреть файл

@ -76,7 +76,7 @@ suite("FileDownloader", () => {
});
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());
});
});

Просмотреть файл

@ -16,41 +16,41 @@ suite(`${getNotInstalledPackagesForPlatform.name}`, () => {
let absolutePathPackages: AbsolutePathPackage[];
let extensionPath = "/ExtensionPath";
const packages = <Package[]>[
{
{
"description": "Platfrom1-Architecture1 uninstalled package",
"platforms": [ "platform1" ],
"architectures": [ "architecture1" ],
"platforms": ["platform1"],
"architectures": ["architecture1"],
"installPath": "path1"
},
{
{
//already installed package
"description": "Platfrom1-Architecture1 installed package",
"platforms": [ "platform1" ],
"architectures": [ "architecture1" ],
"platforms": ["platform1"],
"architectures": ["architecture1"],
"installPath": "path5"
},
{
"description": "Platfrom2-Architecture2 uninstalled package",
"platforms": [ "platform2" ],
"architectures": [ "architecture2" ],
"platforms": ["platform2"],
"architectures": ["architecture2"],
"installPath": "path2"
},
{
"description": "Platfrom1-Architecture2 uninstalled package",
"platforms": [ "platform1" ],
"architectures": [ "architecture2" ],
"platforms": ["platform1"],
"architectures": ["architecture2"],
"installPath": "path3"
},
{
"description": "Platfrom2-Architecture1 uninstalled package",
"platforms": [ "platform2" ],
"architectures": [ "architecture1" ],
"platforms": ["platform2"],
"architectures": ["architecture1"],
"installPath": "path4"
},
{
"description": "Platfrom1-Architecture2 uninstalled package",
"platforms": [ "platform1" ],
"architectures": [ "architecture2" ],
"platforms": ["platform1"],
"architectures": ["architecture2"],
"installPath": "path3"
},
];

Просмотреть файл

@ -39,7 +39,7 @@ suite('ZipInstaller', () => {
let eventBus: TestEventBus;
setup(async () => {
eventStream = new EventStream();
eventStream = new EventStream();
eventBus = new TestEventBus(eventStream);
tmpInstallDir = await CreateTmpDir(true);
installationPath = new AbsolutePath(tmpInstallDir.name);

Просмотреть файл

@ -13,7 +13,7 @@ const expect = chai.expect;
suite(`${isValidDownload.name}`, () => {
const sampleBuffer = Buffer.from("sampleBuffer");
const validIntegrity = "eb7201b5d986919e0ac67c820886358869d8f7059193d33c902ad7fe1688e1e9";
test('Returns false for non-matching integrity', async () => {
let result = await isValidDownload(sampleBuffer, "inValidIntegrity", new EventStream());
expect(result).to.be.false;

Просмотреть файл

@ -11,7 +11,7 @@ suite("ParsedEnvironmentFile", () => {
test("Add single variable", () => {
const content = `MyName=VALUE`;
const fakeConfig : { [key: string]: any } = {};
const fakeConfig: { [key: string]: any } = {};
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
expect(result.Warning).to.be.null;
@ -20,7 +20,7 @@ suite("ParsedEnvironmentFile", () => {
test("Handle quoted values", () => {
const content = `MyName="VALUE"`;
const fakeConfig : { [key: string]: any } = {};
const fakeConfig: { [key: string]: any } = {};
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
expect(result.Warning).to.be.null;
@ -29,7 +29,7 @@ suite("ParsedEnvironmentFile", () => {
test("Handle BOM", () => {
const content = "\uFEFFMyName=VALUE";
const fakeConfig : { [key: string]: any } = {};
const fakeConfig: { [key: string]: any } = {};
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
expect(result.Warning).to.be.null;
@ -42,7 +42,7 @@ MyName1=Value1
MyName2=Value2
`;
const fakeConfig : { [key: string]: any } = {};
const fakeConfig: { [key: string]: any } = {};
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
expect(result.Warning).to.be.null;
@ -56,7 +56,7 @@ MyName1=Value1
MyName2=Value2
`;
const initialEnv : { [key: string]: any } = {
const initialEnv: { [key: string]: any } = {
"MyName1": "Value7",
"ThisShouldNotChange": "StillHere"
};
@ -69,19 +69,19 @@ MyName2=Value2
});
test("Handle comments", () => {
const content = `# This is an environment file
const content = `# This is an environment file
MyName1=Value1
# This is a comment in the middle of the file
MyName2=Value2
`;
const fakeConfig : { [key: string]: any } = {};
const fakeConfig: { [key: string]: any } = {};
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
expect(result.Warning).to.be.null;
result.Env["MyName1"].should.equal("Value1");
result.Env["MyName2"].should.equal("Value2");
});
test("Handle invalid lines", () => {
const content = `
This_Line_Is_Wrong
@ -89,7 +89,7 @@ MyName1=Value1
MyName2=Value2
`;
const fakeConfig : { [key: string]: any } = {};
const fakeConfig: { [key: string]: any } = {};
const result = ParsedEnvironmentFile.CreateFromContent(content, "TestEnvFileName", fakeConfig["env"]);
result.Warning.should.startWith("Ignoring non-parseable lines in envFile TestEnvFileName");

Просмотреть файл

@ -71,28 +71,28 @@ suite("Common", () => {
suite("isSubfolderOf", () => {
test("same paths", () => {
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;
});
test("correct subfolder", () => {
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;
});
test("longer subfolder", () => {
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;
});
test("Different drive", () => {
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;
});

Просмотреть файл

@ -57,7 +57,7 @@ suite(`${reportIssue.name}`, () => {
};
};
vscode.env.clipboard.writeText = (body:string) => {
vscode.env.clipboard.writeText = (body: string) => {
issueBody = body;
return undefined;
};

Просмотреть файл

@ -18,7 +18,7 @@ suite('BackgroundWorkStatusBarObserver', () => {
show: () => { showCalled = true; },
hide: () => { hideCalled = true; }
};
let observer = new BackgroundWorkStatusBarObserver(statusBarItem);
let observer = new BackgroundWorkStatusBarObserver(statusBarItem);
setup(() => {
showCalled = false;

Просмотреть файл

@ -37,14 +37,14 @@ suite("CsharpLoggerObserver", () => {
expect(logOutput).to.contain(event.stage);
expect(logOutput).to.contain(event.error.toString());
});
test('Stage and Error is logged if a PackageError without inner error', () => {
let event = new Event.InstallationFailure("someStage", new PackageError("someError", null, null));
observer.post(event);
expect(logOutput).to.contain(event.stage);
expect(logOutput).to.contain(event.error.message);
});
test('Stage and Inner error is logged if a PackageError without inner error', () => {
let event = new Event.InstallationFailure("someStage", new PackageError("someError", null, "innerError"));
observer.post(event);
@ -95,13 +95,13 @@ suite("CsharpLoggerObserver", () => {
].forEach((element) => {
test(`Prints the download status to the logger as ${element.expected}`, () => {
let logOutput = "";
let observer = new CsharpLoggerObserver({
...getNullChannel(),
appendLine: (text?: string) => { logOutput += `${text}\n`; },
append: (text?: string) => { logOutput += text; }
});
element.events.forEach((message: Event.BaseEvent) => observer.post(message));
expect(logOutput).to.be.equal(element.expected);
});
@ -175,7 +175,7 @@ suite("CsharpLoggerObserver", () => {
expect(logOutput).to.contain(description);
expect(logOutput).to.contain(url);
});
test(`${Event.IntegrityCheckSuccess.name}: Some message is logged`, () => {
let event = new Event.IntegrityCheckSuccess();
observer.post(event);

Просмотреть файл

@ -42,18 +42,18 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
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");
});
[
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`, () => {
let event = new DotNetTestDebugProcessStart(111);
@ -70,7 +70,7 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
suite(`${ReportDotNetTestResults.name}`, () => {
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("bar", "skipped", "", "", ["message3", "message4"], []),
getDotNetTestResults("passinator", "passed", "", "", [], []),
@ -107,7 +107,7 @@ suite(`${DotNetTestLoggerObserver.name}`, () => {
result.StandardError.forEach(message => expect(appendedMessage).to.contain(message));
});
});
test(`Can handle malformed results`, () => {
observer.post(new ReportDotNetTestResults([]));
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,
ErrorMessage: errorMessage,
ErrorStackTrace: errorStackTrace,
StandardOutput : stdoutMessages,
StandardOutput: stdoutMessages,
StandardError: stdErrorMessages
};
}

Просмотреть файл

@ -50,7 +50,7 @@ suite("ErrorMessageObserver", () => {
expect(errorMessage).to.contain(description);
expect(errorMessage).to.contain(url);
});
test("Nothing is shown if we are retrying", () => {
let description = 'someDescription';
let url = 'someUrl';

Просмотреть файл

@ -6,8 +6,8 @@
import { InformationMessageObserver } from '../../../src/observers/InformationMessageObserver';
import { use as chaiUse, expect, should } from 'chai';
import { getUnresolvedDependenices, updateConfig, getVSCodeWithConfig } from '../testAssets/Fakes';
import {from as observableFrom } from 'rxjs';
import {timeout} from 'rxjs/operators';
import { from as observableFrom } from 'rxjs';
import { timeout } from 'rxjs/operators';
chaiUse(require('chai-as-promised'));
chaiUse(require('chai-string'));
@ -76,10 +76,10 @@ suite("InformationMessageObserver", () => {
});
});
});
});
});
teardown(() => {
commandDone = undefined;
commandDone = undefined;
});
function getVsCode() {

Просмотреть файл

@ -161,7 +161,7 @@ suite("OmnisharpLoggerObserver", () => {
let fn = function () { observer.post(event); };
expect(fn).to.not.throw(Error);
});
[
new OmnisharpServerOnError({ Text: "someText", FileName: "someFile", Line: 1, Column: 2 }),
].forEach((event: OmnisharpServerOnError) => {
@ -169,7 +169,7 @@ suite("OmnisharpLoggerObserver", () => {
observer.post(event);
expect(logOutput).to.contain(event.errorMessage.Text);
});
test(`Contains the error message FileName, Line and column if FileName is not null`, () => {
observer.post(event);
if (event.errorMessage.FileName) {

Просмотреть файл

@ -23,7 +23,7 @@ suite(`${OmniSharpMonoResolver.name}`, () => {
const requiredMonoVersion = "6.4.0";
const higherMonoVersion = "6.6.0";
const getMono = (version: string) => async(env: NodeJS.ProcessEnv) => {
const getMono = (version: string) => async (env: NodeJS.ProcessEnv) => {
getMonoCalled = true;
environment = env;
return Promise.resolve(version);

Просмотреть файл

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { ConfigurationChangeEvent } from "../../../src/vscodeAdapter";
export function GetConfigChangeEvent(changingConfig: string): ConfigurationChangeEvent {
return {
affectsConfiguration: (section: string) => section == changingConfig

Просмотреть файл

@ -11,10 +11,10 @@ const ServerMock = require("mock-http-server");
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({
method,
path,
@ -26,11 +26,11 @@ export default class MockHttpsServer {
});
}
public async start(){
public async start() {
return new Promise(resolve => this.server.start(resolve));
}
public async stop(){
public async stop() {
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"),
cert: await fs.readFile("test/unitTests/testAssets/public.pem")
});
return new MockHttpsServer(server, `https://localhost:${port}`);
}
}

Просмотреть файл

@ -11,16 +11,16 @@ export default class TestEventBus {
private eventBus: Array<BaseEvent>;
private disposable: IDisposable;
constructor(eventStream: EventStream){
constructor(eventStream: EventStream) {
this.eventBus = [];
this.disposable = new Disposable(eventStream.subscribe(event => this.eventBus.push(event)));
}
public getEvents(): Array<BaseEvent>{
public getEvents(): Array<BaseEvent> {
return this.eventBus;
}
public dispose(){
public dispose() {
this.disposable.dispose();
}
}

Просмотреть файл

@ -8,7 +8,7 @@ export interface TestFile {
path: string;
}
export function createTestFile(content: string, path: string): TestFile{
export function createTestFile(content: string, path: string): TestFile {
return {
content,
path

Просмотреть файл

@ -7,18 +7,18 @@ import * as archiver from 'archiver';
import { TestFile } from './TestFile';
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;
}
get size(): number{
get size(): number {
return this._buffer.length;
}
get files(): TestFile[]{
get files(): TestFile[] {
return this._files;
}
@ -40,8 +40,8 @@ export default class TestZip {
filesToAdd.forEach(elem => archive.append(elem.content, { name: elem.path }));
archive.finalize();
});
return new TestZip(finalBuffer, filesToAdd);
}
}
}

Просмотреть файл

@ -5,16 +5,16 @@
declare module 'http-proxy-agent' {
interface IHttpProxyAgentOptions {
host: string;
port: number;
auth?: string;
}
interface IHttpProxyAgentOptions {
host: string;
port: number;
auth?: string;
}
class HttpProxyAgent {
constructor(proxy: string);
constructor(opts: IHttpProxyAgentOptions);
}
export = HttpProxyAgent;
class HttpProxyAgent {
constructor(proxy: string);
constructor(opts: IHttpProxyAgentOptions);
}
export = HttpProxyAgent;
}

Просмотреть файл

@ -5,20 +5,20 @@
declare module 'https-proxy-agent' {
import * as tls from 'tls';
import * as tls from 'tls';
interface IHttpsProxyAgentOptions extends tls.ConnectionOptions {
host: string;
port: number;
auth?: string;
secureProxy?: boolean;
secureEndpoint?: boolean;
}
interface IHttpsProxyAgentOptions extends tls.ConnectionOptions {
host: string;
port: number;
auth?: string;
secureProxy?: boolean;
secureEndpoint?: boolean;
}
class HttpsProxyAgent {
constructor(proxy: string);
constructor(opts: IHttpsProxyAgentOptions);
}
export = HttpsProxyAgent;
class HttpsProxyAgent {
constructor(proxy: string);
constructor(opts: IHttpsProxyAgentOptions);
}
export = HttpsProxyAgent;
}

8
typings/vscode-extension-telemetry.d.ts поставляемый
Просмотреть файл

@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
declare module 'vscode-extension-telemetry' {
export default class TelemetryReporter {
constructor(extensionId: string,extensionVersion: string, key: string);
sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measures?: { [key: string]: number }): void;
}
export default class TelemetryReporter {
constructor(extensionId: string, extensionVersion: string, key: string);
sendTelemetryEvent(eventName: string, properties?: { [key: string]: string }, measures?: { [key: string]: number }): void;
}
}