-
Notifications
You must be signed in to change notification settings - Fork 47
fix #593 share logic between FileSystemProvider and FileSearchProvider #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c5ffc0
fix #593 share logic between FileSystemProvider and FileSearchProvider
2a2ff73
Merge branch 'master' into fix-593
LogMull f8e360d
Preserve change from fix #623 in new file
f5be84d
Merge branch 'fix-593' of https://github.com/LogMull/vscode-objectscr…
3d333bb
Merge branch 'master' of https://github.com/intersystems-community/vs…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as vscode from "vscode"; | ||
import * as url from "url"; | ||
import { AtelierAPI } from "../api"; | ||
|
||
export function studioOpenDialogFromURI( | ||
uri: vscode.Uri, | ||
overrides: { flat?: boolean; filter?: string; type?: string } = { flat: false, filter: "", type: "" } | ||
): Promise<any> { | ||
const api = new AtelierAPI(uri); | ||
if (!api.active) { | ||
return; | ||
} | ||
const sql = `CALL %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?,?)`; | ||
const { query } = url.parse(uri.toString(true), true); | ||
const csp = query.csp === "" || query.csp === "1"; | ||
const type = | ||
overrides.type && overrides.type != "" | ||
? overrides.type | ||
: query.type && query.type != "" | ||
? query.type.toString() | ||
: csp | ||
? "csp" | ||
: "all"; | ||
|
||
const folder = !csp | ||
? uri.path.replace(/\//g, ".") | ||
: uri.path === "/" | ||
? "" | ||
: uri.path.endsWith("/") | ||
? uri.path | ||
: uri.path + "/"; | ||
// The query filter represents the studio spec to be used, | ||
// overrides.filter represents the SQL query that will be passed to the server | ||
|
||
let specOpts = ""; | ||
// If filter is specified on the URI, use it | ||
if (query.filter && query.filter.length) { | ||
specOpts = query.filter.toString(); | ||
if (!csp) { | ||
// always exclude Studio projects, since we can't do anything with them | ||
specOpts += ",'*.prj"; | ||
} | ||
} // otherwise, reference the type to get the desired files. | ||
else if (csp) { | ||
specOpts = "*"; | ||
} else if (type === "rtn") { | ||
specOpts = "*.inc,*.mac,*.int"; | ||
} else if (type === "cls") { | ||
specOpts = "*.cls"; | ||
} else { | ||
specOpts = "*.cls,*.inc,*.mac,*.int"; | ||
} | ||
const spec = csp ? folder + specOpts : folder.length > 1 ? folder.slice(1) + "/" + specOpts : specOpts; | ||
const notStudio = "0"; | ||
const dir = "1"; | ||
const orderBy = "1"; | ||
const generated = query.generated && query.generated.length ? query.generated.toString() : "0"; | ||
const system = query.system && query.system.length ? query.system.toString() : api.ns === "%SYS" ? "1" : "0"; | ||
let flat = query.flat && query.flat.length ? query.flat.toString() : "0"; | ||
if (overrides && overrides.flat) flat = "1"; | ||
return api.actionQuery(sql, [spec, dir, orderBy, system, flat, notStudio, generated, overrides.filter]); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.