import type * as lspTypes from "vscode-languageserver-protocol" ; import * as lsp from "vscode-languageserver-types" ; import { openFile } from "./novaUtils" ; import { lspRangeToRange } from "./lspNovaConversions" ; function showRangeInEditor ( editor , range ) { const novaRange = lspRangeToRange ( editor . document , range ) ; editor . addSelectionForRange ( novaRange ) ; editor . scrollToPosition ( novaRange . start ) ; } async function showRangeInUri ( uri , range ) { const newEditor = await openFile ( uri ) ; if ( ! newEditor ) { nova . workspace . showWarningMessage ( `Failed to open ${ uri }` ) ; return ; } showRangeInEditor ( newEditor , range ) ; } export async function showLocation ( location ) { if ( lsp . Location . is ( location ) ) { await showRangeInUri ( location . uri , location . range ) ; } else { await showRangeInUri ( location . targetUri , location . targetSelectionRange ) ; } }