Skip to content

Commit

Permalink
WIP: Find called element
Browse files Browse the repository at this point in the history
Depends on proposed Workspace#findTextInFiles API.

Related to #63
  • Loading branch information
nikku committed Mar 2, 2020
1 parent 947f6c5 commit 3026992
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,29 @@ function getViewType(provider: any) {
function getUri(...p: string[]): vscode.Uri {
return vscode.Uri.file(path.join(...p));
}

/**
* Find called file by process ID.
*
* @param processId
*/
async function findCalledFile(processId: String): Promise<Array<vscode.Uri>> {
const foundFiles: Array<vscode.Uri> = [];

// TODO(nikku): handle multiple matches;
// verify that match is actual bpmn:Process element
await vscode.workspace.findTextInFiles(
{
pattern: `id="${processId}"`,
isRegExp: false,
isMultiline: false
},
{
include: '**/*.bpmn',
maxResults: 1
},
result => foundFiles.push(result.uri)
);

return foundFiles;
}

0 comments on commit 3026992

Please sign in to comment.