Skip to content

Commit 3b626fb

Browse files
committed
go to routine
1 parent 2e76f4c commit 3b626fb

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

src/providers/WorkspaceSymbolProvider.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
33
import { ClassDefinition } from "../utils/classDefinition";
4+
import { DocumentContentProvider } from "./DocumentContentProvider";
45

56
export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
67
public provideWorkspaceSymbols(
@@ -10,10 +11,9 @@ export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
1011
if (query.length < 3) {
1112
return null;
1213
}
13-
return Promise.all([this.byClasses(query), this.byMethods(query)]).then(([classes, methods]) => [
14-
...classes,
15-
...methods,
16-
]);
14+
return Promise.all([this.byClasses(query), this.byRoutines(query), this.byMethods(query)]).then(
15+
([classes, routines, methods]) => [...classes, ...routines, ...methods]
16+
);
1717
}
1818

1919
public async byClasses(query: string): Promise<vscode.SymbolInformation[]> {
@@ -34,6 +34,27 @@ export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
3434
}));
3535
}
3636

37+
public async byRoutines(query: string): Promise<vscode.SymbolInformation[]> {
38+
query = `*${query}*.mac,*${query}*.int`;
39+
const sql = `CALL %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?)`;
40+
const api = new AtelierAPI();
41+
const direction = "1";
42+
const orderBy = "1";
43+
const systemFiles = "0";
44+
const flat = "1";
45+
const notStudio = "0";
46+
const generated = "0";
47+
48+
const data = await api.actionQuery(sql, [query, direction, orderBy, systemFiles, flat, notStudio, generated]);
49+
return data.result.content.map(({ Name }) => ({
50+
kind: vscode.SymbolKind.File,
51+
location: {
52+
uri: DocumentContentProvider.getUri(Name),
53+
},
54+
name: Name,
55+
}));
56+
}
57+
3758
public async byMethods(query: string): Promise<vscode.SymbolInformation[]> {
3859
query = query.toUpperCase();
3960
query = `*${query}*`;

0 commit comments

Comments
 (0)