From bf0858bdfe6b2d5b7844b43aeef34a3af5ee2926 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 12 Dec 2023 08:55:12 +0000 Subject: [PATCH 1/3] feat: "deno.internalInspect" setting --- README.md | 2 ++ client/src/commands.ts | 7 ++++++- client/src/extension.ts | 2 ++ client/src/shared_types.d.ts | 1 + package.json | 10 ++++++++++ typescript-deno-plugin/src/index.ts | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aad3181b..e3bf66c4 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,8 @@ extension has the following configuration options: hints where the variable name matches the implicit type. - `deno.internalDebug`: If enabled the Deno Language Server will log additional internal diagnostic information. +- `deno.internalInspect`: Enables the inspector server for the JS runtime used + by the Deno Language Server to host its TS server. - `deno.lint`: Controls if linting information will be provided by the Deno Language Server. _boolean, default `true`_ - `deno.maxTsServerMemory`: Maximum amount of memory the TypeScript isolate can diff --git a/client/src/commands.ts b/client/src/commands.ts index 951759f5..4eb9f4e6 100644 --- a/client/src/commands.ts +++ b/client/src/commands.ts @@ -173,12 +173,17 @@ export function startLanguageServer( return; } - const env = { + const env: Record = { ...process.env, "DENO_V8_FLAGS": getV8Flags(), "NO_COLOR": true, }; + const config = vscode.workspace.getConfiguration(EXTENSION_NS); + if (config.get("internalInspect")) { + env["DENO_LSP_INSPECTOR"] = 1; + } + const serverOptions: ServerOptions = { run: { command, diff --git a/client/src/extension.ts b/client/src/extension.ts index ab487469..c46f151c 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -57,6 +57,7 @@ const workspaceSettingsKeys: Array = [ "importMap", "inlayHints", "internalDebug", + "internalInspect", "lint", "logFile", "path", @@ -178,6 +179,7 @@ function handleConfigurationChange(event: vscode.ConfigurationChangeEvent) { event.affectsConfiguration("deno.enable") || event.affectsConfiguration("deno.disablePaths") || event.affectsConfiguration("deno.enablePaths") || + event.affectsConfiguration("deno.internalInspect") || event.affectsConfiguration("deno.logFile") || event.affectsConfiguration("deno.path") || event.affectsConfiguration("deno.maxTsServerMemory") diff --git a/client/src/shared_types.d.ts b/client/src/shared_types.d.ts index 91e6d2e2..9bdfeb13 100644 --- a/client/src/shared_types.d.ts +++ b/client/src/shared_types.d.ts @@ -102,6 +102,7 @@ export interface Settings { /** A flag that enables additional internal debug information to be printed * to the _Deno Language Server_ output. */ internalDebug: boolean; + internalInspect: boolean; /** Determine if the extension should be providing linting diagnostics. */ lint: boolean; logFile: boolean; diff --git a/package.json b/package.json index 43d2f3e8..2b42b733 100644 --- a/package.json +++ b/package.json @@ -475,6 +475,16 @@ false ] }, + "deno.internalInspect": { + "type": "boolean", + "default": false, + "markdownDescription": "Enables the inspector server for the JS runtime used by the Deno Language Server to host its TS server.", + "scope": "window", + "examples": [ + true, + false + ] + }, "deno.logFile": { "type": "boolean", "default": false, diff --git a/typescript-deno-plugin/src/index.ts b/typescript-deno-plugin/src/index.ts index 8dd20a86..29d77f88 100644 --- a/typescript-deno-plugin/src/index.ts +++ b/typescript-deno-plugin/src/index.ts @@ -44,6 +44,7 @@ const defaultSettings: Settings = { importMap: null, inlayHints: null, internalDebug: false, + internalInspect: false, lint: false, logFile: false, path: null, From 3a340e1eed627f8d774284cf985239c580c0ea20 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 19 Dec 2023 06:32:09 +0000 Subject: [PATCH 2/3] allow address, don't use env var --- client/src/commands.ts | 7 +------ package.json | 7 ++++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/client/src/commands.ts b/client/src/commands.ts index 5cc2ade7..921ce497 100644 --- a/client/src/commands.ts +++ b/client/src/commands.ts @@ -184,17 +184,12 @@ export function startLanguageServer( return; } - const env: Record = { + const env = { ...process.env, "DENO_V8_FLAGS": getV8Flags(), "NO_COLOR": true, }; - const config = vscode.workspace.getConfiguration(EXTENSION_NS); - if (config.get("internalInspect")) { - env["DENO_LSP_INSPECTOR"] = 1; - } - const serverOptions: ServerOptions = { run: { command, diff --git a/package.json b/package.json index 416509b9..86853a2d 100644 --- a/package.json +++ b/package.json @@ -496,13 +496,14 @@ ] }, "deno.internalInspect": { - "type": "boolean", + "type": ["boolean", "string"], "default": false, - "markdownDescription": "Enables the inspector server for the JS runtime used by the Deno Language Server to host its TS server.", + "markdownDescription": "Enables the inspector server for the JS runtime used by the Deno Language Server to host its TS server. Optionally provide an address for the inspector listener e.g. \"127.0.0.1:9222\" (default).", "scope": "window", "examples": [ true, - false + false, + "127.0.0.1:9222" ] }, "deno.logFile": { From fcd65b89a5a3b4e62b3c4a0d26d9880b569c88d4 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 19 Dec 2023 14:47:08 +0000 Subject: [PATCH 3/3] fix type --- client/src/shared_types.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/shared_types.d.ts b/client/src/shared_types.d.ts index 9bdfeb13..f72d427a 100644 --- a/client/src/shared_types.d.ts +++ b/client/src/shared_types.d.ts @@ -102,7 +102,7 @@ export interface Settings { /** A flag that enables additional internal debug information to be printed * to the _Deno Language Server_ output. */ internalDebug: boolean; - internalInspect: boolean; + internalInspect: boolean | string; /** Determine if the extension should be providing linting diagnostics. */ lint: boolean; logFile: boolean;