1
0
mirror of https://github.com/coder/code-server.git synced 2024-12-05 07:13:06 +08:00
code-server/test/e2e/extensions/test-extension/extension.ts
Joe Previte 690e0aff45
fix: add handle for resolveExternalUri (#5624)
* fix: add handle for resolveExternalUri

This adds a fix to properly handle `resolveExternalUri` which is used by
extensions like Tabnine.

* fixup!: update patch

* fixup!: force update proxy patch

* fixup!: use proxyEndpointTemplate else manually add

* fixup!: throw error if productConfiguration missing

* feat(testing): add asExternalUri

This modifies the test extension used in e2e test by registering a new
command for testing `asExternalUri`.

* feat: add e2e test for asExternalUri

* docs: update playwright setup comments

* feat: add support for VSCODE_PROXY_URI

* chore: refresh patches

* feat: add test for VSCODE_PROXY_URI

* chore: add metadata to lang extension

* fixup!: fix part of service-worker patch

* fixup!: remove e2e test, update patch notes

* fixup!: refresh disable-downloads

* fixup!: formatting
2022-10-14 16:08:58 +00:00

32 lines
1.1 KiB
TypeScript

import * as vscode from "vscode"
export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage("test extension loaded")
// Test extension
context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
if (process.env.VSCODE_PROXY_URI) {
vscode.window.showInformationMessage(`proxyUri: ${process.env.VSCODE_PROXY_URI}`)
} else {
vscode.window.showErrorMessage("No proxy URI was set")
}
}),
)
// asExternalUri extension
context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.asExternalUri", async () => {
const input = await vscode.window.showInputBox({
prompt: "URL to pass through to asExternalUri",
})
if (input) {
const output = await vscode.env.asExternalUri(vscode.Uri.parse(input))
vscode.window.showInformationMessage(`input: ${input} output: ${output}`)
} else {
vscode.window.showErrorMessage(`Failed to run test case. No input provided.`)
}
}),
)
}