diff options
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r-- | editors/code/src/extension.ts | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index c6efc2e7e..39fe6efd8 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts | |||
@@ -151,15 +151,27 @@ export function activate(context: vscode.ExtensionContext) { | |||
151 | 151 | ||
152 | if (Server.config.displayInlayHints) { | 152 | if (Server.config.displayInlayHints) { |
153 | const hintsUpdater = new HintsUpdater(); | 153 | const hintsUpdater = new HintsUpdater(); |
154 | hintsUpdater.loadHints(vscode.window.activeTextEditor).then(() => { | 154 | hintsUpdater.refreshHintsForVisibleEditors().then(() => { |
155 | // vscode may ignore top level hintsUpdater.refreshHintsForVisibleEditors() | ||
156 | // so update the hints once when the focus changes to guarantee their presence | ||
157 | let editorChangeDisposable: vscode.Disposable | null = null; | ||
158 | editorChangeDisposable = vscode.window.onDidChangeActiveTextEditor( | ||
159 | _ => { | ||
160 | if (editorChangeDisposable !== null) { | ||
161 | editorChangeDisposable.dispose(); | ||
162 | } | ||
163 | return hintsUpdater.refreshHintsForVisibleEditors(); | ||
164 | } | ||
165 | ); | ||
166 | |||
155 | disposeOnDeactivation( | 167 | disposeOnDeactivation( |
156 | vscode.window.onDidChangeActiveTextEditor(editor => | 168 | vscode.window.onDidChangeVisibleTextEditors(_ => |
157 | hintsUpdater.loadHints(editor) | 169 | hintsUpdater.refreshHintsForVisibleEditors() |
158 | ) | 170 | ) |
159 | ); | 171 | ); |
160 | disposeOnDeactivation( | 172 | disposeOnDeactivation( |
161 | vscode.workspace.onDidChangeTextDocument(e => | 173 | vscode.workspace.onDidChangeTextDocument(e => |
162 | hintsUpdater.updateHints(e) | 174 | hintsUpdater.refreshHintsForVisibleEditors(e) |
163 | ) | 175 | ) |
164 | ); | 176 | ); |
165 | disposeOnDeactivation( | 177 | disposeOnDeactivation( |