From 555f742add569b6595c96da629c49d5335ea6af3 Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Wed, 17 Aug 2022 16:24:05 -0400 Subject: [PATCH 1/3] Add setting to control the references code lens --- package.json | 5 +++++ src/settings.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/package.json b/package.json index 5a6576297e..c690caa61f 100644 --- a/package.json +++ b/package.json @@ -609,6 +609,11 @@ "default": true, "description": "Loads user and system-wide PowerShell profiles (profile.ps1 and Microsoft.VSCode_profile.ps1) into the PowerShell session. This affects IntelliSense and interactive script execution, but it does not affect the debugger." }, + "powershell.enableReferencesCodeLens": { + "type": "boolean", + "default": false, + "description": "Displays a code lens above function definitions showing the number of times the function is referenced in the workspace. Enabling this setting can have a high impact on performance in large workspaces." + }, "powershell.bugReporting.project": { "type": "string", "default": "https://github.com/PowerShell/vscode-powershell", diff --git a/src/settings.ts b/src/settings.ts index 4c51672170..cf06a3cd07 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -101,6 +101,7 @@ export interface ISettings { buttons?: IButtonSettings; cwd?: string; notebooks?: INotebooksSettings; + enableReferencesCodeLens?: boolean; } export interface IStartAsLoginShellSettings { @@ -268,6 +269,8 @@ export function load(): ISettings { configuration.get("startAsLoginShell", defaultStartAsLoginShellSettings), cwd: // NOTE: This must be validated at startup via `validateCwdSetting()`. There's probably a better way to do this. configuration.get("cwd", undefined), + enableReferencesCodeLens: + configuration.get("enableReferencesCodeLens", false), }; } From dd1b14480dff20a68c2e3e878365e2aa928a7900 Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Tue, 30 Aug 2022 14:43:39 -0400 Subject: [PATCH 2/3] Default to `true` --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c690caa61f..03d5ab639e 100644 --- a/package.json +++ b/package.json @@ -611,8 +611,8 @@ }, "powershell.enableReferencesCodeLens": { "type": "boolean", - "default": false, - "description": "Displays a code lens above function definitions showing the number of times the function is referenced in the workspace. Enabling this setting can have a high impact on performance in large workspaces." + "default": true, + "description": "Displays a code lens above function definitions showing the number of times the function is referenced in the workspace. Large workspaces should disable this setting due to high performance impact." }, "powershell.bugReporting.project": { "type": "string", From 4fa8d788d2141bf1539984756a89a7d000c27a2b Mon Sep 17 00:00:00 2001 From: Andy Jordan <2226434+andschwa@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:28:54 -0700 Subject: [PATCH 3/3] Update src/settings.ts --- src/settings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.ts b/src/settings.ts index cf06a3cd07..f73d8544c1 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -270,7 +270,7 @@ export function load(): ISettings { cwd: // NOTE: This must be validated at startup via `validateCwdSetting()`. There's probably a better way to do this. configuration.get("cwd", undefined), enableReferencesCodeLens: - configuration.get("enableReferencesCodeLens", false), + configuration.get("enableReferencesCodeLens", true), }; }