From 8e193c6930bcb758c1c7c4d42409db7cfb6e3c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigtryggur=20=C3=93marsson?= Date: Sun, 29 Mar 2026 14:57:13 +0200 Subject: [PATCH] Fix: Reload config on change --- src/extension.ts | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index dc81ec0..59c5c11 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,17 +19,22 @@ export function activate(context: vscode.ExtensionContext) opacity: '0' }); + const loadConfig = () => + { + const vsConfigOptions = vscode.workspace.getConfiguration('vscode-easymotion'); + return new Configuration + ( + unfocusedTextDecoration, + textDecoration, + vsConfigOptions.get('allowJumpingToWordlessLines', true), + vsConfigOptions.get('styles', DEFAULT_STYLES) + ); + } + let activePromise : Promise | null = null; - const vsConfigOptions = vscode.workspace.getConfiguration('vscode-easymotion'); - const config = new Configuration - ( - unfocusedTextDecoration, - textDecoration, - vsConfigOptions.get('allowJumpingToWordlessLines', true), - vsConfigOptions.get('styles', DEFAULT_STYLES) - ); - + let config: Configuration = loadConfig(); + let commandContext : ActiveCommandContext | null = null; const startJump = async (editor: vscode.TextEditor, context: ActiveCommandContext)=> @@ -64,6 +69,14 @@ export function activate(context: vscode.ExtensionContext) commandContext = null; }; + vscode.workspace.onDidChangeConfiguration(event => + { + if (event.affectsConfiguration('vscode-easymotion')) + { + config = loadConfig(); + } + }); + // Jump to Word Command context.subscriptions.push(vscode.commands.registerCommand('vscode-easymotion.jumpToWord', async () => {