@@ -12,15 +12,9 @@ import {
1212 textualScopeSupportFacetInfos ,
1313} from "@cursorless/common" ;
1414import { getScopeTestPathsRecursively } from "@cursorless/node-common" ;
15- import { getCursorlessApi , openNewEditor } from "@cursorless/vscode-common" ;
1615import { assert } from "chai" ;
1716import { groupBy , uniq } from "lodash-es" ;
18- import { promises as fsp } from "node:fs" ;
1917import { endToEndTestSetup } from "../endToEndTestSetup" ;
20- import {
21- serializeIterationScopeFixture ,
22- serializeScopeFixture ,
23- } from "./serializeScopeFixture" ;
2418
2519suite ( "Scope test cases" , async function ( ) {
2620 endToEndTestSetup ( this ) ;
@@ -104,56 +98,58 @@ async function testLanguageSupport(languageId: string, testedFacets: string[]) {
10498 }
10599}
106100
101+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
107102async function runTest ( file : string , languageId : string , facetId : string ) {
108103 console . log ( file ) ;
109- try {
110- const { ide, scopeProvider } = ( await getCursorlessApi ( ) ) . testHelpers ! ;
111- const { scopeType, isIteration } = getFacetInfo ( languageId , facetId ) ;
112- const fixture = ( await fsp . readFile ( file , "utf8" ) )
113- . toString ( )
114- . replaceAll ( "\r\n" , "\n" ) ;
115- const delimiterIndex = fixture . match ( / ^ - - - $ / m) ?. index ;
116-
117- assert . isDefined (
118- delimiterIndex ,
119- "Can't find delimiter '---' in scope fixture" ,
120- ) ;
121-
122- const code = fixture . slice ( 0 , delimiterIndex ! - 1 ) ;
123-
124- await openNewEditor ( code , { languageId } ) ;
125-
126- const editor = ide . activeTextEditor ! ;
127-
128- const outputFixture = ( ( ) : string => {
129- const config = {
130- visibleOnly : false ,
131- scopeType,
132- } ;
133104
134- if ( isIteration ) {
135- const iterationScopes = scopeProvider . provideIterationScopeRanges (
136- editor ,
137- {
138- ...config ,
139- includeNestedTargets : false ,
140- } ,
141- ) ;
142- return serializeIterationScopeFixture ( code , iterationScopes ) ;
143- }
144-
145- const scopes = scopeProvider . provideScopeRanges ( editor , config ) ;
146-
147- return serializeScopeFixture ( facetId , code , scopes ) ;
148- } ) ( ) ;
149-
150- if ( ! outputFixture ) {
151- console . log ( `No scopes found for ${ facetId } in ${ languageId } ` ) ;
152- }
153- } catch ( error ) {
154- console . log ( `Error running test for ${ facetId } in ${ languageId } ` ) ;
155- console . log ( error ) ;
156- }
105+ // try {
106+ // const { ide, scopeProvider } = (await getCursorlessApi()).testHelpers!;
107+ // const { scopeType, isIteration } = getFacetInfo(languageId, facetId);
108+ // const fixture = (await fsp.readFile(file, "utf8"))
109+ // .toString()
110+ // .replaceAll("\r\n", "\n");
111+ // const delimiterIndex = fixture.match(/^---$/m)?.index;
112+
113+ // assert.isDefined(
114+ // delimiterIndex,
115+ // "Can't find delimiter '---' in scope fixture",
116+ // );
117+
118+ // const code = fixture.slice(0, delimiterIndex! - 1);
119+
120+ // await openNewEditor(code, { languageId });
121+
122+ // const editor = ide.activeTextEditor!;
123+
124+ // const outputFixture = ((): string => {
125+ // const config = {
126+ // visibleOnly: false,
127+ // scopeType,
128+ // };
129+
130+ // if (isIteration) {
131+ // const iterationScopes = scopeProvider.provideIterationScopeRanges(
132+ // editor,
133+ // {
134+ // ...config,
135+ // includeNestedTargets: false,
136+ // },
137+ // );
138+ // return serializeIterationScopeFixture(code, iterationScopes);
139+ // }
140+
141+ // const scopes = scopeProvider.provideScopeRanges(editor, config);
142+
143+ // return serializeScopeFixture(facetId, code, scopes);
144+ // })();
145+
146+ // if (!outputFixture) {
147+ // console.log(`No scopes found for ${facetId} in ${languageId}`);
148+ // }
149+ // } catch (error) {
150+ // console.log(`Error running test for ${facetId} in ${languageId}`);
151+ // console.log(error);
152+ // }
157153
158154 assert . ok ( true ) ;
159155
0 commit comments