MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / waitForCodeLenses

Function waitForCodeLenses

src/test/datascience/helpers.ts:272–306  ·  view source on GitHub ↗
(document: vscode.Uri, command: string)

Source from the content-addressed store, hash-verified

270}
271
272export async function waitForCodeLenses(document: vscode.Uri, command: string) {
273 // First make sure the editor has focus
274 const selection = new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0));
275 let editor = vscode.window.visibleTextEditors.find((e) => arePathsSame(e.document.uri.fsPath, document.fsPath));
276 if (editor) {
277 await vscode.window
278 .showTextDocument(editor.document, { selection, viewColumn: editor.viewColumn })
279 .then((e) => {
280 e.revealRange(selection, vscode.TextEditorRevealType.InCenter);
281 });
282 }
283
284 let codeLenses: vscode.CodeLens[] = [];
285 // Wait for the code lens to appear
286 await waitForCondition(
287 async () => {
288 const textDocument = await vscode.workspace.openTextDocument(document);
289 await vscode.window.showTextDocument(textDocument, undefined, false);
290 codeLenses = (await vscode.commands.executeCommand(
291 'vscode.executeCodeLensProvider',
292 document
293 )) as vscode.CodeLens[];
294 return (
295 codeLenses &&
296 codeLenses.length > 0 &&
297 codeLenses.find((c) => c.command?.command === command) != undefined
298 );
299 },
300 defaultNotebookTestTimeout,
301 `Code lens with command ${command} not found`
302 );
303
304 logger.ci(`Found code lenses with command ${command}`);
305 return codeLenses;
306}
307
308export async function verifySelectedControllerIsRemoteForRemoteTests(notebook?: vscode.NotebookDocument) {
309 if (!IS_REMOTE_NATIVE_TEST() || !isWeb()) {

Calls 6

waitForConditionFunction · 0.90
showTextDocumentMethod · 0.80
revealRangeMethod · 0.80
openTextDocumentMethod · 0.80
executeCommandMethod · 0.65
ciMethod · 0.65

Tested by

no test coverage detected