Skip to content

Commit c37d1c6

Browse files
authored
Fix development issues after compiler directory move (microsoft#2077)
1. Remove unnecessary exclude in tsconfig.json now that we use src/ include in compiler. Somehow this seemed to fix a rebuild failure for me and it's consistent with other projects. 2. Fix tmlanguage.js path in watch-tmlanguage 3. Fix compiler path for F5 on VS Code extension 4. Use consistent compiler path for F5 on VS Classic extension. Note that we should entrypoints/ for F5 since we don't want to run resolution. 5. Delete unused and broken regen-samples in json-schema. It had wrong path to compiler but even before that fails with non-existent samples dir already. Also remove compile-samples npm script that just ran a broken tsp compile command.
1 parent 27be70f commit c37d1c6

File tree

10 files changed

+46
-31
lines changed

10 files changed

+46
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@typespec/compiler",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@typespec/compiler"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@typespec/json-schema",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@typespec/json-schema"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "typespec-vs",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "typespec-vs"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "typespec-vscode",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "typespec-vscode"
10+
}

packages/compiler/scripts/watch-tmlanguage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { resolve } from "path";
44
import { pathToFileURL } from "url";
55

66
let count = 0;
7-
const scriptPath = resolve("dist/server/tmlanguage.js");
7+
const scriptPath = resolve("dist/src/server/tmlanguage.js");
88

99
async function regenerate() {
1010
const script = await import(`${pathToFileURL(scriptPath)}?q=${count++}`);
@@ -13,4 +13,4 @@ async function regenerate() {
1313
await copyFile("dist/typespec.tmLanguage", "../typespec-vscode/dist/typespec.tmLanguage");
1414
}
1515

16-
runWatch("dist/server/tmlanguage.js", regenerate, {});
16+
runWatch("dist/src/server/tmlanguage.js", regenerate, {});

packages/compiler/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"tsBuildInfoFile": "temp/tsconfig.tsbuildinfo",
77
"types": ["node", "mocha"]
88
},
9-
"include": ["src/**/*.ts", "test/**/*.ts"],
10-
"exclude": ["dist", "node_modules", "temp", "tsp-output"]
9+
"include": ["src/**/*.ts", "test/**/*.ts"]
1110
}

packages/json-schema/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"test": "mocha",
3535
"test-official": "c8 mocha --forbid-only --reporter mocha-multi-reporters",
3636
"lint": "eslint . --ext .ts --max-warnings=0",
37-
"lint:fix": "eslint . --fix --ext .ts",
38-
"compile-samples": "tsp compile "
37+
"lint:fix": "eslint . --fix --ext .ts"
3938
},
4039
"files": [
4140
"lib/*.tsp",

packages/json-schema/scripts/regen-samples.js

-23
This file was deleted.

packages/typespec-vs/src/VSExtension.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private static string GetDevelopmentTypeSpecServerPath()
168168
// the source tree.
169169
var thisDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
170170
var srcDir = File.ReadAllText(Path.Combine(thisDir, "DebugSourceDirectory.txt")).Trim();
171-
return Path.GetFullPath(Path.Combine(srcDir, "..", "..", "compiler", "cmd", "tsp-server.js"));
171+
return Path.GetFullPath(Path.Combine(srcDir, "..", "..", "compiler", "entrypoints", "server.js"));
172172
}
173173
#endif
174174

packages/typespec-vscode/src/extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function resolveTypeSpecServer(context: ExtensionContext): Promise<Executa
8484

8585
// In development mode (F5 launch from source), resolve to locally built server.js.
8686
if (process.env.TYPESPEC_DEVELOPMENT_MODE) {
87-
const script = context.asAbsolutePath("../compiler/dist/server/server.js");
87+
const script = context.asAbsolutePath("../compiler/entrypoints/server.js");
8888
// we use CLI instead of NODE_OPTIONS environment variable in this case
8989
// because --nolazy is not supported by NODE_OPTIONS.
9090
const options = nodeOptions?.split(" ").filter((o) => o) ?? [];

0 commit comments

Comments
 (0)