All files / commands open-in-browser.ts

80% Statements 4/5
50% Branches 1/2
100% Functions 1/1
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16        1x     2x   2x     2x      
import * as vscode from 'vscode';
import { DefinitionTreeNode, getIriFromArgument } from '@src/views/trees/definition-tree/definition-tree-node';
import { InferenceUri } from '@src/providers/inference-uri';
 
export const openInBrowser = {
	id: 'mentor.command.openInBrowser',
	handler: async (arg: DefinitionTreeNode | string) => {
		let uri = vscode.Uri.parse(getIriFromArgument(arg), true);
 
		Iif (InferenceUri.isInferenceUri(uri)) {
			await vscode.commands.executeCommand('mentor.command.openGraph', uri);
		} else {
			await vscode.commands.executeCommand('vscode.open', uri);
		}
	}
};