Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust excludes path to be compatible with anymatch #40

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ChokidarFileWatcherProvider implements FileWatcherProvider {
watcherOptions.usePolling = false;
}

const excludes: string[] = ['**/node_modules', '**/__pycache__', '**/.*'];
const excludes: string[] = ['**/node_modules/**', '**/__pycache__/**', '**/.*'];
if (_isMacintosh || _isLinux) {
if (paths.some((path) => path === '' || path === '/')) {
excludes.push('/dev/**');
Expand Down
4 changes: 2 additions & 2 deletions packages/pyright-internal/src/tests/languageServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ describe(`Basic language server tests`, () => {
await openFile(info, 'marker');

// Wait for the diagnostics to publish
const diagnostics = await waitForDiagnostics(info);
const diagnostics = await waitForDiagnostics(info, 6);
assert.equal(diagnostics[0]!.diagnostics.length, 6);

// Make sure the error has a special rule
assert.equal(diagnostics[0].diagnostics[1].code, 'pyright[reportUnusedImport]');
assert.equal(diagnostics[0].diagnostics[3].code, 'ruff[F401]');
assert.equal(diagnostics[0].diagnostics[5].code, 'ruff[F401]');
});
}, 10000);
});
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,26 @@ function createServerConnection(testServerData: CustomLSP.TestServerStartOptions
return connection;
}

export async function waitForDiagnostics(info: PyrightServerInfo, timeout = 10000) {
export async function waitForDiagnostics(info: PyrightServerInfo, expectedCount: number, timeout = 10000) {
const deferred = createDeferred<void>();
// Replit(dstewart): We've got a bit of an issue with the Windows CI job.
// A bit of a Schrodinger's bug situation, since adding console.log seems
// to add just enough latency to cause the tests to pass. I presume that
// what we're seeing is we're getting two responses, first with 3 responses,
// then immediately after one with six responses.
const responseLengths: number[] = [];
const disposable = info.diagnosticsEvent((params) => {
if (params.diagnostics.length > 0) {
responseLengths.push(params.diagnostics.length);
}
if (params.diagnostics.length === expectedCount) {
deferred.resolve();
}
});
const timer = setTimeout(() => deferred.reject('Timed out waiting for diagnostics'), timeout);
try {
await deferred.promise;
assert.equal(responseLengths.length, 1, 'We had more than one result! ' + JSON.stringify(responseLengths));
} finally {
clearTimeout(timer);
disposable.dispose();
Expand Down
Loading