Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
ensureModel as ensureLSPModel,
outputs as lspModelOutputs,
} from "./tools/scripts/lsp/fetchModel.mts";
import { outputs as contentMapperOutputs } from "./tools/scripts/tsc/generate-contentmapper.ts";
import { outputs as encoderOutputs } from "./tools/scripts/tsc/generate-encoder.ts";
import { outputs as enumOutputs } from "./tools/scripts/tsc/generate-enums.ts";
import { outputs as goASTOutputs } from "./tools/scripts/tsc/generate-go-ast.ts";
Expand Down Expand Up @@ -319,6 +320,8 @@ export const cleanBuilt = task({
const goGenerateActions = [];

async function runGenerateGo() {
// Some Go generators load packages that depend on the generated content mapper types.
await runGenerateContentMapper();
Comment thread
gabritto marked this conversation as resolved.
Resolved
for (const generate of goGenerateActions) {
await generate();
}
Expand Down Expand Up @@ -677,6 +680,18 @@ export const generateAST = task({
run: runGenerateAST,
});

async function runGenerateContentMapper() {
const { default: generate } = await import("./tools/scripts/tsc/generate-contentmapper.ts");
generate(!!options.force);
}

export const generateContentMapper = task({
name: "generate:contentmapper",
description: "Generates content mapper protocol and Go/TypeScript span map types from the JSON schema.",
outputs: contentMapperOutputs,
run: runGenerateContentMapper,
});

async function runGenerateSync() {
const { generateSync } = await import("./packages/typescript/scripts/generateSync.ts");
generateSync(!!options.force);
Expand Down Expand Up @@ -857,6 +872,7 @@ export const buildWatch = task({
"tools/gen-proto",
"tools/gen-preferences",
"tools/userPreferences.schema.json",
"packages/typescript/schemas/contentmapper.schema.json",
"packages/typescript/src/api/async",
"packages/typescript/test/async",
"packages/vscode-typescript/src",
Expand Down Expand Up @@ -1164,11 +1180,13 @@ export const testTools = task({
export const testCodegen = task({
name: "test:codegen",
description: "Runs codegen tests without regenerating sources.",
run: async () => {
await run("node", ["--test", "--test-concurrency=1", "./tools/scripts/gen/*.test.mts", "./tools/scripts/tsc/*.test.ts"]);
},
run: runTestCodegen,
});

async function runTestCodegen() {
await run("node", ["--test", "--test-concurrency=1", "./tools/scripts/gen/*.test.mts", "./tools/scripts/tsc/*.test.ts"]);
}

export const buildAPI = task({
name: "build:api",
description: "Builds @typescript/typescript JS API.",
Expand Down Expand Up @@ -1520,9 +1538,7 @@ export const validate = task({
if (options.all) {
await runValidation("check:herebyfile", runCheckHerebyfile);
await runValidation("test:tools", runTestTools);
await runValidation("test:options", async () => {
await run("node", ["--test", "./tools/scripts/tsc/options.test.ts"]);
});
await runValidation("test:codegen", runTestCodegen);
await runValidation("test:smoke", runSmokeTest); // in CI this is run with `--race`
}
await runValidation("lint", runLint);
Expand Down Expand Up @@ -2894,7 +2910,7 @@ async function testTypeScriptPackage(platforms) {
packed[0].files.some(file => file.path === "dist/wasm/index.js"),
"Main package is missing the WASM host entrypoint",
);
for (const name of ["tsconfig", "jsconfig"]) {
for (const name of ["tsconfig", "jsconfig", "contentmapper"]) {
const schemaPath = `schemas/${name}.schema.json`;
assert(packed[0].files.some(file => file.path === schemaPath), `Package is missing ${schemaPath}`);
assert.deepEqual(
Expand Down
44 changes: 22 additions & 22 deletions packages/typescript/enums/spanMapFeature.d.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// Code generated by tools/scripts/tsc/generate-enums.ts from tsc/internal/spanmap/spanmap.go. DO NOT EDIT.
// Code generated by tools/scripts/tsc/generate-enums.ts from packages/typescript/schemas/contentmapper.schema.json. DO NOT EDIT.

export declare enum SpanMapFeature {
Hover = 1 << 0,
SignatureHelp = 1 << 1,
Completion = 1 << 2,
Definition = 1 << 3,
TypeDefinition = 1 << 4,
Implementation = 1 << 5,
References = 1 << 6,
DocumentHighlights = 1 << 7,
Rename = 1 << 8,
CallHierarchy = 1 << 9,
CodeActions = 1 << 10,
Formatting = 1 << 11,
InlayHints = 1 << 12,
SemanticTokens = 1 << 13,
FoldingRanges = 1 << 14,
SelectionRanges = 1 << 15,
LinkedEditing = 1 << 16,
AutoInsert = 1 << 17,
DocumentSymbols = 1 << 18,
CodeLens = 1 << 19,
Hover = 1,
SignatureHelp = 2,
Completion = 4,
Definition = 8,
TypeDefinition = 16,
Implementation = 32,
References = 64,
DocumentHighlights = 128,
Rename = 256,
CallHierarchy = 512,
CodeActions = 1024,
Formatting = 2048,
InlayHints = 4096,
SemanticTokens = 8192,
FoldingRanges = 16384,
SelectionRanges = 32768,
LinkedEditing = 65536,
AutoInsert = 131072,
DocumentSymbols = 262144,
CodeLens = 524288,
None = 0,
All = (CodeLens << 1) - 1,
All = 1048575,
}
2 changes: 1 addition & 1 deletion packages/typescript/enums/spanMapFeature.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by tools/scripts/tsc/generate-enums.ts from tsc/internal/spanmap/spanmap.go. DO NOT EDIT.
// Code generated by tools/scripts/tsc/generate-enums.ts from packages/typescript/schemas/contentmapper.schema.json. DO NOT EDIT.
export var SpanMapFeature;
(function (SpanMapFeature) {
SpanMapFeature[SpanMapFeature["Hover"] = 1] = "Hover";
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/enums/spanMapFidelity.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by tools/scripts/tsc/generate-enums.ts from tsc/internal/spanmap/spanmap.go. DO NOT EDIT.
// Code generated by tools/scripts/tsc/generate-enums.ts from packages/typescript/schemas/contentmapper.schema.json. DO NOT EDIT.

export declare enum SpanMapFidelity {
Exact = 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/enums/spanMapFidelity.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by tools/scripts/tsc/generate-enums.ts from tsc/internal/spanmap/spanmap.go. DO NOT EDIT.
// Code generated by tools/scripts/tsc/generate-enums.ts from packages/typescript/schemas/contentmapper.schema.json. DO NOT EDIT.
export var SpanMapFidelity;
(function (SpanMapFidelity) {
SpanMapFidelity[SpanMapFidelity["Exact"] = 0] = "Exact";
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/enums/spanMapKind.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by tools/scripts/tsc/generate-enums.ts from tsc/internal/spanmap/spanmap.go. DO NOT EDIT.
// Code generated by tools/scripts/tsc/generate-enums.ts from packages/typescript/schemas/contentmapper.schema.json. DO NOT EDIT.

export declare enum SpanMapKind {
Verbatim = 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/enums/spanMapKind.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by tools/scripts/tsc/generate-enums.ts from tsc/internal/spanmap/spanmap.go. DO NOT EDIT.
// Code generated by tools/scripts/tsc/generate-enums.ts from packages/typescript/schemas/contentmapper.schema.json. DO NOT EDIT.
export var SpanMapKind;
(function (SpanMapKind) {
SpanMapKind[SpanMapKind["Verbatim"] = 0] = "Verbatim";
Expand Down
1 change: 1 addition & 0 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"./package.json": "./package.json",
"./schemas/tsconfig.schema.json": "./schemas/tsconfig.schema.json",
"./schemas/jsconfig.schema.json": "./schemas/jsconfig.schema.json",
"./schemas/contentmapper.schema.json": "./schemas/contentmapper.schema.json",
".": "./lib/version.cjs",
"./vscode": {
"@typescript/source": "./src/vscode/extensionApi.ts",
Expand Down
Loading
Loading