Skip to content

Commit a4617f9

Browse files
Merge pull request #496 from gjsjohnmurray/fix-495
fix #495 display TextSearchProvider results from non-primary root
2 parents 3acde23 + bfd6601 commit a4617f9

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/api/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ export class AtelierAPI {
208208
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
209209
params?: any,
210210
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
211-
headers?: any
211+
headers?: any,
212+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
213+
options?: any
212214
): Promise<any> {
213215
const { active, apiVersion, host, port, username, password, https } = this.config;
214216
if (!active || !port || !host) {
@@ -326,7 +328,7 @@ export class AtelierAPI {
326328
data.result.content.length !== 0 &&
327329
data.result.content[0] != undefined &&
328330
data.result.content[0].action != undefined;
329-
if (!isStudioAction) {
331+
if (!isStudioAction && !options?.noOutput) {
330332
outputConsole(data.console);
331333
}
332334
}
@@ -451,7 +453,7 @@ export class AtelierAPI {
451453
word: false,
452454
...params,
453455
};
454-
return this.request(2, "GET", `${this.ns}/action/search`, null, params);
456+
return this.request(2, "GET", `${this.ns}/action/search`, null, params, null, { noOutput: true });
455457
}
456458

457459
// v1+

src/providers/DocumentContentProvider.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,24 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
3333
}
3434
}
3535

36-
public static getUri(name: string, workspaceFolder?: string, namespace?: string, vfs?: boolean): vscode.Uri {
36+
public static getUri(
37+
name: string,
38+
workspaceFolder?: string,
39+
namespace?: string,
40+
vfs?: boolean,
41+
wFolderUri?: vscode.Uri
42+
): vscode.Uri {
3743
if (vfs === undefined) {
3844
vfs = config("serverSideEditing");
3945
}
4046
let scheme = vfs ? FILESYSTEM_SCHEMA : OBJECTSCRIPT_FILE_SCHEMA;
41-
workspaceFolder = workspaceFolder && workspaceFolder !== "" ? workspaceFolder : currentWorkspaceFolder();
4247
const isCsp = name.includes("/");
43-
const wFolderUri = workspaceFolderUri(workspaceFolder);
48+
49+
// if wFolderUri was passed it takes precedence
50+
if (!wFolderUri) {
51+
workspaceFolder = workspaceFolder && workspaceFolder !== "" ? workspaceFolder : currentWorkspaceFolder();
52+
wFolderUri = workspaceFolderUri(workspaceFolder);
53+
}
4454
let uri: vscode.Uri;
4555
if (wFolderUri.scheme === FILESYSTEM_SCHEMA || wFolderUri.scheme === FILESYSTEM_READONLY_SCHEMA) {
4656
const fileExt = name.split(".").pop();

src/providers/FileSystemPovider/TextSearchProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
3333
.then((files: SearchResult[]) =>
3434
files.map(async (file) => {
3535
const fileName = file.doc;
36-
const uri = DocumentContentProvider.getUri(fileName);
36+
const uri = DocumentContentProvider.getUri(fileName, "", "", true, options.folder);
3737
const document = await vscode.workspace.openTextDocument(uri);
3838
return {
3939
...file,

0 commit comments

Comments
 (0)