Skip to content

Commit

Permalink
support fileDirname variable in roots configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
itaysk committed May 25, 2020
1 parent 68f3e03 commit f1eb429
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/opa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as vscode from 'vscode';
import { promptForInstall } from './install-opa';
import { getImports, getPackage } from './util';
import { existsSync } from 'fs';
import { dirname } from 'path';

var regoVarPattern = new RegExp('^[a-zA-Z_][a-zA-Z0-9_]*$');

Expand Down Expand Up @@ -43,6 +44,7 @@ export function getRoots(): string[] {
let formattedRoots = new Array();
roots.forEach(root => {
root = root.replace('${workspaceFolder}', vscode.workspace.workspaceFolders![0].uri.toString());
root = root.replace('${fileDirname}', dirname(vscode.window.activeTextEditor!.document.fileName));
formattedRoots.push(getDataDir(vscode.Uri.parse(root)));
});

Expand Down

0 comments on commit f1eb429

Please sign in to comment.