From 8789fcc25cd055a0cc1e70fc83bfcca90720c384 Mon Sep 17 00:00:00 2001 From: Heyward Fann Date: Mon, 9 Oct 2023 19:01:15 +0800 Subject: [PATCH] feat: fire onDidChangeInlayHints on change --- src/features/inlayHints.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/features/inlayHints.ts b/src/features/inlayHints.ts index 52ca74fa..b06b1add 100644 --- a/src/features/inlayHints.ts +++ b/src/features/inlayHints.ts @@ -20,7 +20,19 @@ export class TypeInlayHintsProvider implements InlayHintsProvider { private readonly _onDidChangeInlayHints = new Emitter(); public readonly onDidChangeInlayHints: Event = this._onDidChangeInlayHints.event; - constructor(private client: LanguageClient) {} + constructor(private client: LanguageClient) { + workspace.onDidChangeConfiguration(e => { + if (e.affectsConfiguration('pyright.inlayHints')) { + this._onDidChangeInlayHints.fire(); + } + }); + workspace.onDidChangeTextDocument(e => { + const doc = workspace.getDocument(e.bufnr); + if (doc.languageId === 'python') { + this._onDidChangeInlayHints.fire(); + } + }); + } // eslint-disable-next-line @typescript-eslint/no-unused-vars async provideInlayHints(document: LinesTextDocument, _range: Range, _token: CancellationToken) {