Skip to content

Commit

Permalink
feat(commands): use Uri.fsPath
Browse files Browse the repository at this point in the history
  • Loading branch information
fannheyward committed Aug 6, 2024
1 parent 2896868 commit 488cdcf
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,14 +696,11 @@ export function openDocs(ctx: Ctx): Cmd {
textDocument: { uri: document.uri },
position,
};
// TODO: Should 'cargo doc' run at this point? Or 'cargo doc --no-deps'?
const doclink = await ctx.client.sendRequest(ra.openDocs, param);
if (doclink) {
if (doclink.local) {
// remove leading 'file://'
const absolutePath = doclink.local.substring(7);
const isReadable = existsSync(absolutePath);
if (isReadable) {
const exist = existsSync(Uri.parse(doclink.local).fsPath);
if (!exist) {
await nvim.call('coc#ui#open_url', doclink.local);
return;
}
Expand Down

0 comments on commit 488cdcf

Please sign in to comment.