Skip to content

Commit

Permalink
Rename files based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Sep 7, 2023
1 parent 18779e7 commit f584cc3
Show file tree
Hide file tree
Showing 25 changed files with 123 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as vscode from 'vscode';
import { expect, should } from 'chai';
import * as path from 'path';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

import { Advisor } from '../../src/features/diagnosticsProvider';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';

import { should, expect } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import * as path from 'path';
import { assertWithPoll } from './poll';
import { isNotNull } from '../testUtil';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension, isSlnWithCsproj, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { isNotNull } from '../testUtil';

suite(`CodeLensProvider: ${testAssetWorkspace.description}`, function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import OmniSharpCompletionProvider from '../../src/features/completionProvider';
import * as vscode from 'vscode';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import * as path from 'path';
import { use, expect, should } from 'chai';
import * as chaiArray from 'chai-arrays';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import OmniSharpDefinitionProvider from '../../src/features/definitionProvider';
import * as path from 'path';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { expect, should } from 'chai';
import {
activateCSharpExtension,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
isSlnWithGenerator,
restartOmniSharpServer,
} from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { poll, assertWithPoll, pollDoesNotHappen } from './poll';
import { isNotNull } from '../testUtil';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { should, expect } from 'chai';
import * as integrationHelpers from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

suite(`DocumentSymbolProvider: ${testAssetWorkspace.description}`, function () {
let fileUri: vscode.Uri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as chaiArray from 'chai-arrays';
import * as vscode from 'vscode';
import * as path from 'path';
import { isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

use(chaiArray);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension, isSlnWithCsproj } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { EventStream } from '../../src/eventStream';
import { EventType } from '../../src/omnisharp/eventType';
import { OmnisharpRequestMessage } from '../../src/omnisharp/loggingEvents';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

export type Test = 'a' | 'b' | ['c', any];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import OmniSharpImplementationProvider from '../../src/features/implementationProvider';
import * as path from 'path';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { expect, should } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
isSlnWithGenerator,
restartOmniSharpServer,
} from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import * as path from 'path';
import { InlayHint, LinePositionSpanTextChange } from '../../src/omnisharp/protocol';
import { isNotNull } from '../testUtil';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as vscode from 'vscode';
import * as path from 'path';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { expect, should } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import { LanguageMiddleware, LanguageMiddlewareFeature } from '../../src/omnisharp/languageMiddlewareFeature';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as vscode from 'vscode';

import { should, expect } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { poll } from './poll';
import { isNotNull } from '../testUtil';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { should, expect } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { poll, assertWithPoll } from './poll';
import { EventStream } from '../../src/eventStream';
import { EventType } from '../../src/omnisharp/eventType';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import OmniSharpReferenceProvider from '../../src/features/referenceProvider';
import * as path from 'path';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { expect, should } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { should, assert } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

interface ExpectedToken {
startLine: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as path from 'path';

import { expect, should } from 'chai';
import { activateCSharpExtension, isRazorWorkspace, isSlnWithGenerator } from './integrationHelpers';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

suite(`SignatureHelp: ${testAssetWorkspace.description}`, function () {
let fileUri: vscode.Uri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import OmniSharpDefinitionProvider from '../../src/features/definitionProvider';
import { activateCSharpExtension, isSlnWithGenerator, restartOmniSharpServer } from './integrationHelpers';
import { assertWithPoll, sleep } from './poll';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';

suite(`${OmniSharpDefinitionProvider.name}: ${testAssetWorkspace.description}`, () => {
let fileUri: vscode.Uri;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as vscode from 'vscode';

import { ITestAssetWorkspace } from '../../../test/integrationTests/testAssets/testAssets';

import singleCsproj from '../../../test/integrationTests/testAssets/singleCsproj';
import slnWithCsproj from '../../../test/integrationTests/testAssets/slnWithCsproj';
import slnFilterWithCsproj from '../../../test/integrationTests/testAssets/slnFilterWithCsproj';
import BasicRazorApp2_1 from '../../../test/integrationTests/testAssets/basicRazorApp21';
import slnWithGenerator from '../../../test/integrationTests/testAssets/slnWithGenerator';
import { OmnisharpTestAssetWorkspace } from './omnisharpTestAssetWorkspace';

const testAssetWorkspaces: { [x: string]: ITestAssetWorkspace } = {
singleCsproj,
slnWithCsproj,
slnFilterWithCsproj,
BasicRazorApp2_1,
slnWithGenerator,
};

const workspaceName = vscode.workspace.workspaceFolders![0].uri.fsPath.split(path.sep).pop();

const activeTestAssetWorkspace = new OmnisharpTestAssetWorkspace(testAssetWorkspaces[workspaceName!]);

export default activeTestAssetWorkspace;
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,81 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as path from 'path';
import * as vscode from 'vscode';
import { EventStream } from '../../../src/eventStream';
import { EventType } from '../../../src/omnisharp/eventType';
import { BaseEvent } from '../../../src/omnisharp/loggingEvents';
import { poll } from '../poll';
import { ITestAssetWorkspace, TestAssetWorkspace } from '../../../test/integrationTests/testAssets/testAssets';
import { ActivationResult } from '../integrationHelpers';

import { ITestAssetWorkspace } from '../../../test/integrationTests/testAssets/testAssets';
export class OmnisharpTestAssetWorkspace extends TestAssetWorkspace {
constructor(workspace: ITestAssetWorkspace) {
super(workspace);
}

import singleCsproj from '../../../test/integrationTests/testAssets/singleCsproj';
import slnWithCsproj from '../../../test/integrationTests/testAssets/slnWithCsproj';
import slnFilterWithCsproj from '../../../test/integrationTests/testAssets/slnFilterWithCsproj';
import BasicRazorApp2_1 from '../../../test/integrationTests/testAssets/basicRazorApp21';
import slnWithGenerator from '../../../test/integrationTests/testAssets/slnWithGenerator';
import { OmnisharpTestAssetWorkspace } from './omnisharpTestAssets';
async restore(): Promise<void> {
await vscode.commands.executeCommand('dotnet.restore.all');
}

const testAssetWorkspaces: { [x: string]: ITestAssetWorkspace } = {
singleCsproj,
slnWithCsproj,
slnFilterWithCsproj,
BasicRazorApp2_1,
slnWithGenerator,
};
async restoreAndWait(activation: ActivationResult): Promise<void> {
await this.restore();

const workspaceName = vscode.workspace.workspaceFolders![0].uri.fsPath.split(path.sep).pop();
// Wait for activity to settle before proceeding
await this.waitForIdle(activation.eventStream);
}

const activeTestAssetWorkspace = new OmnisharpTestAssetWorkspace(testAssetWorkspaces[workspaceName!]);
async waitForEvent<T extends BaseEvent>(
stream: EventStream,
captureType: EventType,
stopCondition: (e: T) => boolean = (_) => true,
timeout: number = 25 * 1000
): Promise<T | undefined> {
let event: T | undefined = undefined;

export default activeTestAssetWorkspace;
const subscription = stream.subscribe((e: BaseEvent) => {
if (e.type === captureType) {
const tEvent = <T>e;

if (stopCondition(tEvent)) {
event = tEvent;
subscription.unsubscribe();
}
}
});

await poll(
() => event,
timeout,
500,
(e) => !!e
);

return event;
}

async waitForIdle(stream: EventStream, timeout: number = 25 * 1000): Promise<void> {
let event: BaseEvent | undefined = { type: 0 };

const subscription = stream.subscribe(
(e: BaseEvent) => e.type !== EventType.BackgroundDiagnosticStatus && (event = e)
);
await poll(
() => event,
timeout,
500,
(e) => {
if (e) {
// We're still getting real events, set the event to undefined so we can check if it changed in the next poll.
event = undefined;
return false;
} else {
// The event is still undefined (set by the last poll) which means we haven't recieved any new events - we can exit here.
return true;
}
}
);

subscription.unsubscribe();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import OmniSharpDefinitionProvider from '../../src/features/definitionProvider';
import * as path from 'path';
import testAssetWorkspace from './testAssets/omnisharpTestAssetWorkspace';
import testAssetWorkspace from './testAssets/activeTestAssetWorkspace';
import { expect, should } from 'chai';
import {
activateCSharpExtension,
Expand Down
Loading

0 comments on commit f584cc3

Please sign in to comment.