-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable debugging IW in vscode.web and add tests for IW on web (#10297)
**Changes/Fixes** * [x] Enables tests for IW on the web (required for this PR and for testing IW debugging) * [x] Enables the code lenses to debug cells in IW (this was disabled) * [x] Enables code lenses for running of cells in IW Currently we only enable this for file schemes, i.e. if you open desktop files in web, meaning it will not work for other file systems like github or the like. * [x] Adds a common set of tests for Web & desktop instead of having to create 3 files, ie one test file `*.vscode.common.test.ts` that will run in both places Fixes #10296 Fixes #10107
- Loading branch information
1 parent
53f3048
commit 8de113e
Showing
42 changed files
with
1,075 additions
and
1,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import { commands, NotebookDocument, Uri, workspace } from 'vscode'; | ||
import { IDisposable } from '../platform/common/types'; | ||
import { initializeCommonApi } from './common'; | ||
import { JUPYTER_SERVER_URI } from './constants'; | ||
import * as uuid from 'uuid/v4'; | ||
import { noop } from './core'; | ||
import { initialize } from './initialize'; | ||
|
||
export function initializeCommonWebApi() { | ||
initializeCommonApi({ | ||
async createTemporaryFile(options: { | ||
contents?: string; | ||
extension: string; | ||
}): Promise<{ file: Uri } & IDisposable> { | ||
const folder = workspace.workspaceFolders![0].uri; | ||
const tmpDir = Uri.joinPath(folder, 'temp', 'testFiles'); | ||
try { | ||
await workspace.fs.createDirectory(tmpDir); | ||
} catch { | ||
// ignore if it exists.. | ||
} | ||
const extension = options.extension || '.py'; | ||
const file = Uri.joinPath(tmpDir, `${uuid()}${extension}`); | ||
const contents = options.contents || ''; | ||
|
||
await workspace.fs.writeFile(file, Buffer.from(contents)); | ||
return { | ||
file, | ||
dispose: () => { | ||
workspace.fs.delete(file).then(noop, noop); | ||
} | ||
}; | ||
}, | ||
async startJupyterServer(notebook?: NotebookDocument): Promise<void> { | ||
// Server URI should have been embedded in the constants file | ||
const uri = Uri.parse(JUPYTER_SERVER_URI); | ||
console.log(`ServerURI for remote test: ${JUPYTER_SERVER_URI}`); | ||
// Use this URI to set our jupyter server URI | ||
await commands.executeCommand('jupyter.selectjupyteruri', false, uri, notebook); | ||
}, | ||
async initialize() { | ||
return initialize(); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.