Fix lsp log streaming samples

This commit is contained in:
Matt Bierner
2024-11-26 19:36:11 -08:00
parent 8fdc842c97
commit cabd09c2fc
6 changed files with 944 additions and 956 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,14 +14,13 @@
},
"scripts": {},
"dependencies": {
"vscode-languageclient": "8.1.0-next.6",
"ws": "8.12.0"
"vscode-languageclient": "^8.1.0-next.6",
"ws": "^8.12.0"
},
"devDependencies": {
"@types/ws": "8.5.4",
"@types/ws": "^8.5.4",
"@types/vscode": "1.74.0",
"@types/glob": "8.0.0",
"@vscode/test-electron": "2.2.2",
"glob": "8.1.0"
"@vscode/test-electron": "^2.2.2",
"glob": "^11.0.0"
}
}

View File

@ -7,10 +7,10 @@ import * as vscode from 'vscode';
import * as assert from 'assert';
import { getDocUri, activate } from './helper';
describe('Should do completion', () => {
suite('Should do completion', () => {
const docUri = getDocUri('completion.txt');
it('Completes JS/TS in txt file', async () => {
test('Completes JS/TS in txt file', async () => {
await testCompletion(docUri, new vscode.Position(0, 0), {
items: [
{ label: 'JavaScript', kind: vscode.CompletionItemKind.Text },

View File

@ -7,10 +7,10 @@ import * as vscode from 'vscode';
import * as assert from 'assert';
import { getDocUri, activate } from './helper';
describe('Should get diagnostics', () => {
suite('Should get diagnostics', () => {
const docUri = getDocUri('diagnostics.txt');
it('Diagnoses uppercase texts', async () => {
test('Diagnoses uppercase texts', async () => {
await testDiagnostics(docUri, [
{ message: 'ANY is all uppercase.', range: toRange(0, 0, 0, 3), severity: vscode.DiagnosticSeverity.Warning, source: 'ex' },
{ message: 'ANY is all uppercase.', range: toRange(0, 14, 0, 17), severity: vscode.DiagnosticSeverity.Warning, source: 'ex' },

View File

@ -2,43 +2,40 @@
* 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 Mocha from 'mocha';
import * as glob from 'glob';
import { glob } from 'glob';
export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'bdd',
color: true,
timeout: 5000
ui: 'tdd',
color: true
});
mocha.timeout(100000);
const testsRoot = path.resolve(__dirname, '..');
const testsRoot = __dirname;
return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}
return glob.glob('**.test.js', { cwd: testsRoot }).then(async files => {
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
try {
// Run the mocha test
try {
// Run the mocha test
await new Promise<void>((resolve, reject) => {
mocha.run(failures => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
reject(`${failures} tests failed.`);
} else {
c();
resolve();
}
});
} catch (err) {
console.error(err);
e(err);
}
});
})
} catch (err) {
console.error(err);
throw err;
}
});
}

View File

@ -268,10 +268,11 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.16.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz",
"integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==",
"version": "20.17.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.8.tgz",
"integrity": "sha512-ahz2g6/oqbKalW9sPv6L2iRbhLnojxjYWspAqhjvqSWBgGebEJT5GvRmk0QXPj3sbC6rU0GTQjPLQkmR8CObvA==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
}
@ -2160,7 +2161,8 @@
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"dev": true
"dev": true,
"license": "MIT"
},
"node_modules/uri-js": {
"version": "4.4.1",
@ -2459,9 +2461,9 @@
"dev": true
},
"@types/node": {
"version": "20.16.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz",
"integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==",
"version": "20.17.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.8.tgz",
"integrity": "sha512-ahz2g6/oqbKalW9sPv6L2iRbhLnojxjYWspAqhjvqSWBgGebEJT5GvRmk0QXPj3sbC6rU0GTQjPLQkmR8CObvA==",
"dev": true,
"requires": {
"undici-types": "~6.19.2"