-
Notifications
You must be signed in to change notification settings - Fork 24
Add package scripts and cli library, enable integration testing #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7e1bce9
c693a46
240b649
0e58a31
872b7e8
01c2d80
8ddbf26
9b74df4
adec211
d9b543a
a7afdd6
3097d8f
a2d2bc8
32dfda4
12b0124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vitest.config.ts |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "18" | ||
node-version: "22" | ||
|
||
- run: yarn | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from "@vscode/test-cli"; | ||
|
||
export default defineConfig({ | ||
files: "out/test/**/*.test.js", | ||
extensionDevelopmentPath: ".", | ||
extensionTestsPath: "./out/test", | ||
launchArgs: ["--enable-proposed-api", "coder.coder-remote"], | ||
mocha: { | ||
ui: "tdd", | ||
timeout: 20000, | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ node_modules/** | |
**/.editorconfig | ||
**/*.map | ||
**/*.ts | ||
*.gif | ||
*.gif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,25 +21,31 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> { | |
// | ||
// Cursor and VSCode are covered by ms remote, and the only other is windsurf for now | ||
// Means that vscodium is not supported by this for now | ||
|
||
const remoteSSHExtension = | ||
vscode.extensions.getExtension("jeanp413.open-remote-ssh") || | ||
vscode.extensions.getExtension("codeium.windsurf-remote-openssh") || | ||
vscode.extensions.getExtension("anysphere.remote-ssh") || | ||
vscode.extensions.getExtension("ms-vscode-remote.remote-ssh"); | ||
|
||
let vscodeProposed: typeof vscode = vscode; | ||
|
||
if (!remoteSSHExtension) { | ||
vscode.window.showErrorMessage( | ||
"Remote SSH extension not found, cannot activate Coder extension", | ||
"Remote SSH extension not found, this may not work as expected.\n" + | ||
// NB should we link to documentation or marketplace? | ||
"Please install your choice of Remote SSH extension from the VS Code Marketplace.", | ||
); | ||
} else { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
vscodeProposed = (module as any)._load( | ||
"vscode", | ||
{ | ||
filename: remoteSSHExtension.extensionPath, | ||
}, | ||
false, | ||
); | ||
Comment on lines
+40
to
47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using 'module as any' bypasses type safety; consider a more type-safe approach or adding documentation to justify this workaround. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I get it buddy I don't like it either but we're polymorphic on the SSH extensions. |
||
throw new Error("Remote SSH extension not found"); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const vscodeProposed: typeof vscode = (module as any)._load( | ||
"vscode", | ||
{ | ||
filename: remoteSSHExtension?.extensionPath, | ||
}, | ||
false, | ||
); | ||
|
||
const output = vscode.window.createOutputChannel("Coder"); | ||
const storage = new Storage( | ||
|
@@ -278,7 +284,13 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> { | |
// Since the "onResolveRemoteAuthority:ssh-remote" activation event exists | ||
// in package.json we're able to perform actions before the authority is | ||
// resolved by the remote SSH extension. | ||
if (vscodeProposed.env.remoteAuthority) { | ||
// | ||
// In addition, if we don't have a remote SSH extension, we skip this | ||
// activation event. This may allow the user to install the extension | ||
// after the Coder extension is installed, instead of throwing a fatal error | ||
// (this would require the user to uninstall the Coder extension and | ||
// reinstall after installing the remote SSH extension, which is annoying) | ||
code-asher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (remoteSSHExtension && vscodeProposed.env.remoteAuthority) { | ||
const remote = new Remote( | ||
vscodeProposed, | ||
storage, | ||
|
Uh oh!
There was an error while loading. Please reload this page.