Skip to content

Commit 3faea6f

Browse files
authored
Add objectscript.export.exactFilter setting (#917)
1 parent b1ca834 commit 3faea6f

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

docs/SettingsReference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The extensions in the InterSystems ObjectScript Extension Pack provide many sett
4646
| `"objectscript.export.atelier"` | Export source code as Atelier did it, with packages as subfolders. | `boolean` | `true` | |
4747
| `"objectscript.export.category"` | Category of source code to export: `CLS` = classes; `RTN` = routines; `CSP` = csp files; `OTH` = other. Default is `*` = all. | `string` or `object` | `"*"` | |
4848
| `"objectscript.export.dontExportIfNoChanges"` | Do not rewrite the local file if the content is identical to what came from the server. | `boolean` | `false` | |
49+
| `"objectscript.export.exactFilter"` | SQL filter to limit what to export. | `string` | `""` | The filter is applied to document names using the [LIKE predicate](https://irisdocs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_like) (i.e. `Name LIKE 'exactFilter'`). If provided, `objectscript.export.filter` is ignored. |
4950
| `"objectscript.export.filter"` | SQL filter to limit what to export. | `string` | `""` | The filter is applied to document names using the [LIKE predicate](https://irisdocs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_like) (i.e. `Name LIKE '%filter%'`). |
5051
| `"objectscript.export.folder"` | Folder for exported source code within workspace. | `string` | `"src"` | |
5152
| `"objectscript.export.generated"` | Export generated source code files, such as INTs generated from classes. | `boolean` | `false` | |

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@
889889
"atelier": true,
890890
"generated": false,
891891
"filter": "",
892+
"exactFilter": "",
892893
"category": "*",
893894
"noStorage": false,
894895
"dontExportIfNoChanges": false,
@@ -948,6 +949,10 @@
948949
"markdownDescription": "SQL filter to limit what to export. The filter is applied to document names using the [LIKE predicate](https://irisdocs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_like) (i.e. `Name LIKE '%filter%'`).",
949950
"type": "string"
950951
},
952+
"exactFilter": {
953+
"markdownDescription": "SQL filter to limit what to export. The filter is applied to document names using the [LIKE predicate](https://irisdocs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_like) (i.e. `Name LIKE 'exactFilter'`). If provided, `objectscript.export.filter` is ignored.",
954+
"type": "string"
955+
},
951956
"category": {
952957
"markdownDescription": "Category of source code to export: `CLS` = classes; `RTN` = routines; `CSP` = csp files; `OTH` = other. Default is `*` = all.",
953958
"type": [

src/commands/export.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export async function exportAll(): Promise<any> {
246246
}
247247
const api = new AtelierAPI(workspaceFolder);
248248
outputChannel.show(true);
249-
const { category, generated, filter } = config("export", workspaceFolder);
249+
const { category, generated, filter, exactFilter } = config("export", workspaceFolder);
250250
// Replicate the behavior of getDocNames() but use StudioOpenDialog for better performance
251251
let filterStr = "";
252252
switch (category) {
@@ -263,11 +263,18 @@ export async function exportAll(): Promise<any> {
263263
filterStr = "Type %INLIST $LISTFROMSTRING('0,1,2,3,11,12')";
264264
break;
265265
}
266-
if (filter !== "") {
267-
if (filterStr !== "") {
268-
filterStr += " AND ";
266+
if (filter !== "" || exactFilter !== "") {
267+
if (exactFilter !== "") {
268+
if (filterStr !== "") {
269+
filterStr += " AND ";
270+
}
271+
filterStr += `Name LIKE '${exactFilter}'`;
272+
} else {
273+
if (filterStr !== "") {
274+
filterStr += " AND ";
275+
}
276+
filterStr += `Name LIKE '%${filter}%'`;
269277
}
270-
filterStr += `Name LIKE '%${filter}%'`;
271278
}
272279
return api
273280
.actionQuery("SELECT Name FROM %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?,?)", [

0 commit comments

Comments
 (0)