Skip to content

Commit

Permalink
chore(registerHoverProvider): 自动忽略output时的响应
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Nov 19, 2024
1 parent 1994e5d commit a35162d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/registerHoverProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ import { addEffect } from './util'
* @returns Disposable
*/
export function registerHoverProvider(selector: DocumentSelector, provideHover: HoverProvider['provideHover']) {
return addEffect(vscode.languages.registerHoverProvider(selector, { provideHover }))
const provideHoverWrapper: HoverProvider['provideHover'] = (document, position, token) => {
// 不处理 hover output 时的事件
if (document.uri.scheme === 'output')
return

return provideHover(document, position, token)
}
return addEffect(vscode.languages.registerHoverProvider(selector, { provideHover: provideHoverWrapper }))
}

0 comments on commit a35162d

Please sign in to comment.