Skip to content

Allow objectscript.multilineMethodArgs to be set per workspace folder #1534

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 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,7 @@
"objectscript.multilineMethodArgs": {
"markdownDescription": "List method arguments on multiple lines, if the server supports it. **NOTE:** Only supported on IRIS 2019.1.2, 2020.1.1+, 2021.1.0+ and subsequent versions! On all other versions, this setting will have no effect.",
"type": "boolean",
"scope": "resource",
"default": false
},
"objectscript.openClassContracted": {
Expand Down
29 changes: 17 additions & 12 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,20 +601,25 @@ export class AtelierAPI {
}

// api v1+
public getDoc(name: string, format?: string, mtime?: number): Promise<Atelier.Response<Atelier.Document>> {
let params = {};
if (!format && config("multilineMethodArgs", this.configName) && this.config.apiVersion >= 4) {
format = "udl-multiline";
}
if (format) {
params = {
format,
};
}
public getDoc(name: string, scope: vscode.Uri | string, mtime?: number): Promise<Atelier.Response<Atelier.Document>> {
let params, headers;
name = this.transformNameIfCsp(name);
const headers = {};
if (
this.config.apiVersion >= 4 &&
vscode.workspace
.getConfiguration(
"objectscript",
typeof scope == "string"
? // If scope is a string, then it's a workspace folder name
vscode.workspace.workspaceFolders?.find((f) => f.name.toLowerCase() == scope.toLowerCase())
: scope
)
.get("multilineMethodArgs")
) {
params = { format: "udl-multiline" };
}
if (mtime && mtime > 0) {
headers["IF-NONE-MATCH"] = new Date(mtime).toISOString().replace(/T|Z/g, " ").trim();
headers = { "IF-NONE-MATCH": new Date(mtime).toISOString().replace(/T|Z/g, " ").trim() };
}
return this.request(1, "GET", `${this.ns}/doc/${name}`, null, params, headers);
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function checkChangedOnServer(file: CurrentTextFile | CurrentBinary
const mtime =
workspaceState.get(`${file.uniqueId}:mtime`, null) ||
(await api
.getDoc(file.name)
.getDoc(file.name, file.uri)
.then((data) => data.result)
.then(async ({ ts, content }) => {
const serverTime = Number(new Date(ts + "Z"));
Expand Down Expand Up @@ -225,7 +225,7 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
const mtime = Number(new Date(doc.ts + "Z"));
workspaceState.update(`${file.uniqueId}:mtime`, mtime > 0 ? mtime : undefined);
if (notIsfs(file.uri)) {
const content = await api.getDoc(file.name).then((data) => data.result.content);
const content = await api.getDoc(file.name, file.uri).then((data) => data.result.content);
exportedUris.add(file.uri.toString()); // Set optimistically
await vscode.workspace.fs
.writeFile(file.uri, Buffer.isBuffer(content) ? content : new TextEncoder().encode(content.join("\n")))
Expand Down
2 changes: 1 addition & 1 deletion src/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async function exportFile(wsFolderUri: vscode.Uri, namespace: string, name: stri
outputChannel.appendLine(`Export '${name}' to '${fileUri.toString(true)}' - ${status}`);

try {
const data = await api.getDoc(name);
const data = await api.getDoc(name, wsFolderUri);
if (!data || !data.result) {
throw new Error("Received malformed JSON object from server fetching document");
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/DocumentContentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
const { csp, ns } = isfsConfig(uri);
const fileName = csp ? uri.path.slice(1) : uri.path.split("/").slice(1).join(".");
if (ns) api.setNamespace(ns);
const data = await api.getDoc(fileName);
const data = await api.getDoc(fileName, api.configName);
if (Buffer.isBuffer(data.result.content)) {
return "\nThis is a binary file.\n\nTo access its contents, export it to the local file system.";
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/FileSystemProvider/FileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
const fileName = isfsDocumentName(uri, csp);
const api = new AtelierAPI(uri);
return api
.getDoc(fileName, undefined, cachedFile?.mtime)
.getDoc(fileName, uri, cachedFile?.mtime)
.then((data) => data.result)
.then(
({ ts, content }) =>
Expand Down