Skip to content

Commit

Permalink
feat: fire onDidChangeInlayHints on change
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward committed Oct 9, 2023
1 parent 7fa4649 commit 8789fcc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/features/inlayHints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@ export class TypeInlayHintsProvider implements InlayHintsProvider {
private readonly _onDidChangeInlayHints = new Emitter<void>();
public readonly onDidChangeInlayHints: Event<void> = 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) {
Expand Down

0 comments on commit 8789fcc

Please sign in to comment.