Skip to content

Commit 972a804

Browse files
authored
Fix TextSearchProvider for csp folders (#896)
1 parent 6084767 commit 972a804

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/providers/DocumentContentProvider.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
6161
.join(/cls|mac|int|inc/i.test(fileExt) ? "/" : ".");
6262
name = fileName + "." + fileExt;
6363
uri = wFolderUri.with({
64-
path: `/${name}`,
64+
path: !name.startsWith("/") ? `/${name}` : name,
6565
});
6666
vfs = true;
6767
scheme = wFolderUri.scheme;
@@ -136,17 +136,25 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
136136
});
137137
}
138138
}
139+
const params = new URLSearchParams(uri.query);
139140
if (namespace && namespace !== "") {
140141
if (isCsp) {
141-
uri = uri.with({
142-
query: `ns=${namespace}&csp=1`,
143-
});
142+
if (params.has("csp")) {
143+
params.set("ns", namespace);
144+
uri = uri.with({
145+
query: params.toString(),
146+
});
147+
} else {
148+
uri = uri.with({
149+
query: `ns=${namespace}&csp=1`,
150+
});
151+
}
144152
} else {
145153
uri = uri.with({
146154
query: `ns=${namespace}`,
147155
});
148156
}
149-
} else if (isCsp) {
157+
} else if (isCsp && !params.has("csp")) {
150158
uri = uri.with({
151159
query: "csp=1",
152160
});

src/providers/FileSystemProvider/TextSearchProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
168168
}
169169
}
170170
}
171-
return typeof line === "number" ? line : null;
171+
return typeof line === "number" ? (file.doc.includes("/") ? line - 1 : line) : null;
172172
})
173173
.filter(notNull);
174174
// Filter out duplicates and compute all matches for each one

src/utils/FileProviderUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function fileSpecFromURI(uri: vscode.Uri, overrideType?: string): string
3434
}
3535
} // otherwise, reference the type to get the desired files.
3636
else if (csp) {
37-
specOpts = "*";
37+
specOpts = folder.length > 1 ? "*" : "*.cspall";
3838
} else if (type === "rtn") {
3939
specOpts = "*.inc,*.mac,*.int";
4040
} else if (type === "cls") {

0 commit comments

Comments
 (0)