Skip to content

Commit ad67269

Browse files
restore
1 parent dddfe16 commit ad67269

File tree

2 files changed

+37
-47
lines changed

2 files changed

+37
-47
lines changed

packages/cursorless-vscode-e2e/src/suite/scopes.vscode.test.ts

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import { assert } from "chai";
1717
import { groupBy, uniq } from "lodash-es";
1818
import { promises as fsp } from "node:fs";
1919
import { endToEndTestSetup } from "../endToEndTestSetup";
20-
// import {
21-
// serializeIterationScopeFixture,
22-
// serializeScopeFixture,
23-
// } from "./serializeScopeFixture";
20+
import {
21+
serializeIterationScopeFixture,
22+
serializeScopeFixture,
23+
} from "./serializeScopeFixture";
2424

2525
suite("Scope test cases", async function () {
2626
endToEndTestSetup(this);
@@ -123,43 +123,33 @@ async function runTest(file: string, languageId: string, facetId: string) {
123123

124124
const editor = ide.activeTextEditor!;
125125

126-
if (editor == null) {
127-
console.log("editor" == null);
128-
}
126+
const outputFixture = ((): string => {
127+
const config = {
128+
visibleOnly: false,
129+
scopeType,
130+
};
131+
132+
if (isIteration) {
133+
const iterationScopes = scopeProvider.provideIterationScopeRanges(
134+
editor,
135+
{
136+
...config,
137+
includeNestedTargets: false,
138+
},
139+
);
140+
return serializeIterationScopeFixture(code, iterationScopes);
141+
}
129142

130-
if (!scopeProvider && !scopeType && !isIteration && !code && !ide) {
131-
console.log("weird");
132-
}
143+
const scopes = scopeProvider.provideScopeRanges(editor, config);
133144

134-
// const outputFixture = ((): string => {
135-
// const config = {
136-
// visibleOnly: false,
137-
// scopeType,
138-
// };
139-
140-
// if (isIteration) {
141-
// const iterationScopes = scopeProvider.provideIterationScopeRanges(
142-
// editor,
143-
// {
144-
// ...config,
145-
// includeNestedTargets: false,
146-
// },
147-
// );
148-
// return serializeIterationScopeFixture(code, iterationScopes);
149-
// }
150-
151-
// const scopes = scopeProvider.provideScopeRanges(editor, config);
152-
153-
// return serializeScopeFixture(facetId, code, scopes);
154-
// })();
155-
156-
assert.ok(true);
157-
158-
// if (shouldUpdateFixtures()) {
159-
// await fsp.writeFile(file, outputFixture);
160-
// } else {
161-
// assert.equal(outputFixture, fixture);
162-
// }
145+
return serializeScopeFixture(facetId, code, scopes);
146+
})();
147+
148+
if (shouldUpdateFixtures()) {
149+
await fsp.writeFile(file, outputFixture);
150+
} else {
151+
assert.equal(outputFixture, fixture);
152+
}
163153
}
164154

165155
function getFacetInfo(

packages/vscode-common/src/testUtil/openNewEditor.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ export async function openNewEditor(
1919
content,
2020
});
2121

22-
// await (await getParseTreeApi()).loadLanguage(languageId);
22+
await (await getParseTreeApi()).loadLanguage(languageId);
2323

2424
const editor = await vscode.window.showTextDocument(
2525
document,
2626
openBeside ? vscode.ViewColumn.Beside : undefined,
2727
);
2828

29-
// const eol = content.includes("\r\n")
30-
// ? vscode.EndOfLine.CRLF
31-
// : vscode.EndOfLine.LF;
32-
// if (eol !== editor.document.eol) {
33-
// await editor.edit((editBuilder) => editBuilder.setEndOfLine(eol));
34-
// }
29+
const eol = content.includes("\r\n")
30+
? vscode.EndOfLine.CRLF
31+
: vscode.EndOfLine.LF;
32+
if (eol !== editor.document.eol) {
33+
await editor.edit((editBuilder) => editBuilder.setEndOfLine(eol));
34+
}
3535

3636
// Many times running these tests opens the sidebar, which slows performance. Close it.
37-
// vscode.commands.executeCommand("workbench.action.closeSidebar");
37+
vscode.commands.executeCommand("workbench.action.closeSidebar");
3838

3939
return editor;
4040
}

0 commit comments

Comments
 (0)