Skip to content
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

Restart Typespec Language Server when it's not started before or settings changed #4912

Merged
merged 9 commits into from
Oct 31, 2024
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
7 changes: 7 additions & 0 deletions .chronus/changes/vscode-restart-lsp-2024-9-30-20-29-32.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- typespec-vscode
---

Fix the issue when Typespec Language Server can't be restarted when the server wasn't running before
7 changes: 7 additions & 0 deletions .chronus/changes/vscode-restart-lsp-2024-9-31-11-4-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- typespec-vscode
---

TypeSpec Language Server would be restarted with new settings when setting "typespec.tsp-server.path" is changed
2 changes: 1 addition & 1 deletion packages/typespec-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"deploy": "vsce publish",
"open-in-browser": "vscode-test-web --extensionDevelopmentPath=. .",
"test:e2e": "pnpm test:web",
"test:web": "vscode-test-web --extensionDevelopmentPath=. --headless --extensionTestsPath=dist/test/suite.js ./test/data"
"test:web": "vscode-test-web --extensionDevelopmentPath=. --headless --extensionTestsPath=dist/test/web/suite.js ./test/web/data"
},
"devDependencies": {
"@rollup/plugin-commonjs": "~28.0.0",
Expand Down
18 changes: 14 additions & 4 deletions packages/typespec-vscode/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import { dirname } from "path";

import { defineConfig } from "rollup";
import { fileURLToPath } from "url";
const projDir = dirname(fileURLToPath(import.meta.url));

const plugins = [(resolve as any)({ preferBuiltins: true }), (commonjs as any)()];
const baseConfig = defineConfig({
Expand Down Expand Up @@ -53,17 +56,24 @@ export default defineConfig([
},
{
...baseConfig,
input: "test/suite.ts",
input: "test/web/suite.ts",
output: {
file: "dist/test/suite.js", // VSCode web will add extra .js if you use .cjs
file: "dist/test/web/suite.js", // VSCode web will add extra .js if you use .cjs
format: "commonjs",
sourcemap: true,
inlineDynamicImports: true,
},
plugins: [...plugins, ts("dist/test")],
plugins: [...plugins, ts("dist/test/web")],
},
]);

function ts(outDir: string) {
return (typescript as any)({ tsconfig: "./tsconfig.build.json", outDir });
return (typescript as any)({
compilerOptions: {
// set sourceRoot to absolute path, otherwise the path in the map file generated is incorrect when outDir is given
sourceRoot: projDir,
},
tsconfig: "./tsconfig.build.json",
outDir,
});
}
3 changes: 3 additions & 0 deletions packages/typespec-vscode/src/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const enum SettingName {
TspServerPath = "typespec.tsp-server.path",
}
88 changes: 0 additions & 88 deletions packages/typespec-vscode/src/extension-logger.ts

This file was deleted.

Loading
Loading