-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic vscode web extension and smoke test (#4498)
Basically just register the extension providing the extension configuration(tm grammar and other language config like quote style, matching tokens, etc.) progress for #4095 --------- Co-authored-by: Christopher Radek <[email protected]>
- Loading branch information
1 parent
690109c
commit a4b6a47
Showing
16 changed files
with
718 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: feature | ||
packages: | ||
- typespec-vscode | ||
--- | ||
|
||
Make extension web compatible with minimal functionality |
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,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: fix | ||
packages: | ||
- "@typespec/internal-build-utils" | ||
--- | ||
|
||
Ignore test from third party notice generation |
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
2 changes: 1 addition & 1 deletion
2
packages/internal-build-utils/src/generate-third-party-notice.ts
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,16 @@ | ||
import type { ExtensionContext } from "vscode"; | ||
import logger from "../extension-logger.js"; | ||
import { TypeSpecLogOutputChannel } from "../typespec-log-output-channel.js"; | ||
|
||
/** | ||
* Workaround: LogOutputChannel doesn't work well with LSP RemoteConsole, so having a customized LogOutputChannel to make them work together properly | ||
* More detail can be found at https://github.com/microsoft/vscode-discussions/discussions/1149 | ||
*/ | ||
const outputChannel = new TypeSpecLogOutputChannel("TypeSpec"); | ||
logger.outputChannel = outputChannel; | ||
|
||
export async function activate(context: ExtensionContext) { | ||
logger.info("Activated TypeSpec Web Extension."); | ||
} | ||
|
||
export async function deactivate(): Promise<void> {} |
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 @@ | ||
model Foo {} |
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,28 @@ | ||
// // imports mocha for the browser, defining the `mocha` global. | ||
import "mocha/mocha"; | ||
|
||
mocha.setup({ | ||
ui: "bdd", | ||
reporter: undefined, | ||
timeout: 20000, | ||
}); | ||
|
||
export async function run(): Promise<void> { | ||
await import("./web.test.js"); | ||
return new Promise((c, e) => { | ||
try { | ||
// Run the mocha test | ||
mocha.run((failures) => { | ||
if (failures > 0) { | ||
e(new Error(`${failures} tests failed.`)); | ||
} else { | ||
c(); | ||
} | ||
}); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
e(err); | ||
} | ||
}); | ||
} |
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,22 @@ | ||
import { assert } from "vitest"; | ||
import * as vscode from "vscode"; | ||
|
||
describe("Web Extension", () => { | ||
vscode.window.showInformationMessage("Start all tests."); | ||
|
||
let basicUri: vscode.Uri; | ||
before(async () => { | ||
const ext = vscode.extensions.getExtension("typespec.typespec-vscode"); | ||
assert.ok(ext, "Could not activate extension!"); | ||
await ext!.activate(); | ||
|
||
const scheme = ext?.extensionUri.scheme === "file" ? "file" : "vscode-test-web"; | ||
const pathPrefix = scheme === "file" ? ext?.extensionUri.fsPath + "/test" : ""; | ||
|
||
basicUri = vscode.Uri.from({ scheme, path: pathPrefix + "/basic.tsp" }); | ||
}); | ||
|
||
it("open tsp file", async () => { | ||
await vscode.workspace.openTextDocument(basicUri); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.