Skip to content

Commit

Permalink
Start on any Smithy files (smithy-lang#96)
Browse files Browse the repository at this point in the history
Previous behavior was for the extension to be triggered when you opened
a `.smithy` file. This commit makes the extension trigger whenever
there's a smithy file (or build file) in the workspace.
  • Loading branch information
milesziemer authored Nov 26, 2024
1 parent 28481ca commit 0874f91
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
],
"main": "./out/src/extension",
"preview": true,
"activationEvents": [
"workspaceContains:**/smithy-build.json",
"workspaceContains:**/*.smithy",
"workspaceContains:**/.smithy-project.json"
],
"contributes": {
"jsonValidation": [
{
Expand Down
3 changes: 3 additions & 0 deletions test-fixtures/suite6/smithy-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "1.0"
}
7 changes: 7 additions & 0 deletions tests/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ async function go() {
launchArgs: [resolve(__dirname, "../../test-fixtures/suite5")],
});

// Suite 6 - Startup
await runTests({
extensionDevelopmentPath,
extensionTestsPath: resolve(__dirname, "./suite6"),
launchArgs: [resolve(__dirname, "../../test-fixtures/suite6")],
});

// Confirm that webpacked and vsce packaged extension can be installed.
const vscodeExecutablePath = await downloadAndUnzipVSCode();
const [cli, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
Expand Down
13 changes: 13 additions & 0 deletions tests/suite6/extension.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as assert from "assert";
import * as vscode from "vscode";

suite("Startup", function () {
this.timeout(0);

test("Should start without opening a smithy file", async () => {
const extension = vscode.extensions.getExtension("smithy.smithy-vscode-extension");
assert.ok(extension.isActive);

return Promise.resolve();
});
});
5 changes: 5 additions & 0 deletions tests/suite6/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { runTests } from "../helper";

export function run(testsRoot: string, cb: (error: any, failures?: number) => void): void {
runTests(testsRoot, cb);
}

0 comments on commit 0874f91

Please sign in to comment.