Skip to content

Commit 3fe9983

Browse files
authored
Remove barely used commands (#1710)
1 parent 5ed5d07 commit 3fe9983

File tree

6 files changed

+24
-289
lines changed

6 files changed

+24
-289
lines changed

package.json

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@
9595
],
9696
"menus": {
9797
"commandPalette": [
98-
{
99-
"command": "vscode-objectscript.touchBar.compile",
100-
"when": "false"
101-
},
102-
{
103-
"command": "vscode-objectscript.touchBar.viewOthers",
104-
"when": "false"
105-
},
10698
{
10799
"command": "vscode-objectscript.compile",
108100
"when": "!(resourceScheme =~ /^isfs(-readonly)?$/) && editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive && !activeEditorIsDirty"
@@ -111,30 +103,14 @@
111103
"command": "vscode-objectscript.refreshLocalFile",
112104
"when": "!(resourceScheme =~ /^isfs(-readonly)?$/) && editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive && !activeEditorIsDirty"
113105
},
114-
{
115-
"command": "vscode-objectscript.compileWithFlags",
116-
"when": "!(resourceScheme =~ /^isfs(-readonly)?$/) && editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive && !activeEditorIsDirty"
117-
},
118106
{
119107
"command": "vscode-objectscript.compileAll",
120108
"when": "vscode-objectscript.connectActive"
121109
},
122-
{
123-
"command": "vscode-objectscript.compileAllWithFlags",
124-
"when": "vscode-objectscript.connectActive"
125-
},
126110
{
127111
"command": "vscode-objectscript.viewOthers",
128112
"when": "vscode-objectscript.connectActive"
129113
},
130-
{
131-
"command": "vscode-objectscript.subclass",
132-
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
133-
},
134-
{
135-
"command": "vscode-objectscript.superclass",
136-
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
137-
},
138114
{
139115
"command": "vscode-objectscript.previewXml",
140116
"when": "vscode-objectscript.connectActive && resourceExtname =~ /^\\.xml$/i && !(resourceScheme =~ /^isfs(-readonly)?$/)"
@@ -215,10 +191,6 @@
215191
"command": "vscode-objectscript.compileOnly",
216192
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive && !activeEditorIsDirty"
217193
},
218-
{
219-
"command": "vscode-objectscript.compileOnlyWithFlags",
220-
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive && !activeEditorIsDirty"
221-
},
222194
{
223195
"command": "vscode-objectscript.editOthers",
224196
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
@@ -243,10 +215,6 @@
243215
"command": "vscode-objectscript.exportProjectContents",
244216
"when": "workspaceFolderCount != 0"
245217
},
246-
{
247-
"command": "vscode-objectscript.explorer.project.compileProjectContents",
248-
"when": "false"
249-
},
250218
{
251219
"command": "vscode-objectscript.explorer.project.openOtherServerNs",
252220
"when": "false"
@@ -450,11 +418,6 @@
450418
"when": "view == ObjectScriptProjectsExplorer && viewItem == dataNode:projectNode",
451419
"group": "5_objectscript_prj@4"
452420
},
453-
{
454-
"command": "vscode-objectscript.explorer.project.compileProjectContents",
455-
"when": "view == ObjectScriptProjectsExplorer && viewItem == dataNode:projectNode",
456-
"group": "5_objectscript_prj@6"
457-
},
458421
{
459422
"command": "vscode-objectscript.explorer.project.addWorkspaceFolderForProject",
460423
"when": "view == ObjectScriptProjectsExplorer && viewItem == dataNode:projectNode",
@@ -552,18 +515,6 @@
552515
"when": "resourceLangId =~ /^objectscript/ && vscode-objectscript.connectActive && activeCustomEditorId == ''"
553516
}
554517
],
555-
"touchBar": [
556-
{
557-
"command": "vscode-objectscript.touchBar.compile",
558-
"group": "objectscript.compile",
559-
"when": "!(resourceScheme =~ /^isfs(-readonly)?$/) && editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive && !activeEditorIsDirty"
560-
},
561-
{
562-
"command": "vscode-objectscript.touchBar.viewOthers",
563-
"group": "objectscript.viewOthers",
564-
"when": "vscode-objectscript.connectActive"
565-
}
566-
],
567518
"explorer/context": [
568519
{
569520
"command": "vscode-objectscript.addServerNamespaceToWorkspace",
@@ -848,21 +799,11 @@
848799
"command": "vscode-objectscript.previewXml",
849800
"title": "Preview XML as UDL"
850801
},
851-
{
852-
"category": "ObjectScript",
853-
"command": "vscode-objectscript.compileWithFlags",
854-
"title": "Import and Compile Current File with Specified Flags..."
855-
},
856802
{
857803
"category": "ObjectScript",
858804
"command": "vscode-objectscript.compileAll",
859805
"title": "Compile All Namespace Files"
860806
},
861-
{
862-
"category": "ObjectScript",
863-
"command": "vscode-objectscript.compileAllWithFlags",
864-
"title": "Compile All Namespace Files with Specified Flags..."
865-
},
866807
{
867808
"command": "vscode-objectscript.explorer.export",
868809
"title": "Export",
@@ -937,26 +878,6 @@
937878
"enablement": "vscode-objectscript.connectActive",
938879
"title": "View Other"
939880
},
940-
{
941-
"category": "ObjectScript",
942-
"command": "vscode-objectscript.subclass",
943-
"enablement": "vscode-objectscript.connectActive",
944-
"title": "Go to Subclass..."
945-
},
946-
{
947-
"category": "ObjectScript",
948-
"command": "vscode-objectscript.superclass",
949-
"enablement": "vscode-objectscript.connectActive",
950-
"title": "Go to Superclass..."
951-
},
952-
{
953-
"command": "vscode-objectscript.touchBar.compile",
954-
"title": "➾¹₀⁰₁¹₀"
955-
},
956-
{
957-
"command": "vscode-objectscript.touchBar.viewOthers",
958-
"title": ""
959-
},
960881
{
961882
"category": "ObjectScript",
962883
"command": "vscode-objectscript.serverActions",
@@ -1014,11 +935,6 @@
1014935
"command": "vscode-objectscript.compileOnly",
1015936
"title": "Compile Current File"
1016937
},
1017-
{
1018-
"category": "ObjectScript",
1019-
"command": "vscode-objectscript.compileOnlyWithFlags",
1020-
"title": "Compile Current File with Specified Flags..."
1021-
},
1022938
{
1023939
"category": "ObjectScript",
1024940
"command": "vscode-objectscript.editOthers",
@@ -1070,11 +986,6 @@
1070986
"command": "vscode-objectscript.exportProjectContents",
1071987
"title": "Export Project Contents from Server..."
1072988
},
1073-
{
1074-
"category": "ObjectScript",
1075-
"command": "vscode-objectscript.explorer.project.compileProjectContents",
1076-
"title": "Compile Project Contents"
1077-
},
1078989
{
1079990
"category": "ObjectScript",
1080991
"command": "vscode-objectscript.explorer.project.openOtherServerNs",

src/commands/compile.ts

Lines changed: 19 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ import { StudioActions } from "./studio";
3838
import { NodeBase, PackageNode, RootNode } from "../explorer/nodes";
3939
import { getUrisForDocument, updateIndex } from "../utils/documentIndex";
4040

41-
async function compileFlags(): Promise<string> {
42-
const defaultFlags = config().compileFlags;
43-
return vscode.window.showInputBox({
44-
prompt: "Compilation flags",
45-
value: defaultFlags,
46-
});
47-
}
48-
4941
/**
5042
* For files being locally edited, get and return its mtime timestamp from workspace-state cache if present there,
5143
* else get from server. May update cache.
@@ -95,7 +87,7 @@ export async function importFile(
9587
): Promise<any> {
9688
if (!file) return;
9789
const api = new AtelierAPI(file.uri);
98-
if (!api.active) return;
90+
if (!api.active) return Promise.reject();
9991
if (file.name.split(".").pop().toLowerCase() === "cls" && !skipDeplCheck) {
10092
if (await isClassDeployed(file.name, api)) {
10193
vscode.window.showErrorMessage(`Cannot import ${file.name} because it is deployed on the server.`, "Dismiss");
@@ -258,12 +250,11 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
258250
);
259251
}
260252

261-
export async function compile(docs: (CurrentTextFile | CurrentBinaryFile)[], flags?: string): Promise<any> {
253+
export async function compile(docs: (CurrentTextFile | CurrentBinaryFile)[]): Promise<any> {
262254
docs = docs.filter(notNull);
263255
if (!docs.length) return;
264256
const wsFolder = vscode.workspace.getWorkspaceFolder(docs[0].uri);
265-
const conf = vscode.workspace.getConfiguration("objectscript", wsFolder || docs[0].uri);
266-
flags = flags || conf.get("compileFlags");
257+
const flags = vscode.workspace.getConfiguration("objectscript", wsFolder || docs[0].uri).get<string>("compileFlags");
267258
const api = new AtelierAPI(docs[0].uri);
268259
const docNames = docs.map((d) => d.name);
269260
// Determine the line ending to use for other documents affected
@@ -314,67 +305,44 @@ export async function compile(docs: (CurrentTextFile | CurrentBinaryFile)[], fla
314305
.then(loadChanges);
315306
}
316307

317-
export async function importAndCompile(
318-
askFlags = false,
319-
document?: vscode.TextDocument,
320-
compileFile = true
321-
): Promise<any> {
308+
export async function importAndCompile(document?: vscode.TextDocument): Promise<any> {
322309
const file = currentFile(document);
323310
if (!file || filesystemSchemas.includes(file.uri.scheme) || !new AtelierAPI(file.uri).active) {
324311
// Not for server-side URIs or folders with inactive server connections
325312
return;
326313
}
327314

328-
const defaultFlags = config().compileFlags;
329-
const flags = askFlags ? await compileFlags() : defaultFlags;
330-
return importFile(file)
331-
.catch((error) => {
332-
throw error;
333-
})
334-
.then(() => {
335-
if (compileFile && isCompilable(file.name)) compile([file], flags);
336-
});
315+
return (
316+
importFile(file)
317+
.then(() => {
318+
if (isCompilable(file.name)) compile([file]);
319+
})
320+
// importFile handles any server errors
321+
.catch(() => {})
322+
);
337323
}
338324

339-
export async function compileOnly(askFlags = false, document?: vscode.TextDocument): Promise<any> {
325+
export async function compileOnly(document?: vscode.TextDocument): Promise<any> {
340326
document =
341327
document ||
342328
(vscode.window.activeTextEditor && vscode.window.activeTextEditor.document
343329
? vscode.window.activeTextEditor.document
344330
: null);
345-
346-
if (!document) {
347-
return;
348-
}
349-
331+
if (!document) return;
350332
const file = currentFile(document);
351-
if (!file) {
352-
return;
353-
}
354-
355-
// Do nothing if it is a local file and objectscript.conn.active is false
356-
if (notIsfs(file.uri) && !config("conn").active) {
357-
return;
358-
}
333+
if (!file || !new AtelierAPI(file.uri).active) return;
359334

360335
if (document.isDirty) {
361336
// Don't compile if document is dirty
362-
vscode.window.showWarningMessage(
363-
"Cannot compile '" + file.name + "' because it has unpersisted changes.",
364-
"Dismiss"
365-
);
337+
vscode.window.showWarningMessage(`Cannot compile '${file.name}' because it has unpersisted changes.`, "Dismiss");
366338
return;
367339
}
368340

369-
const defaultFlags = config().compileFlags;
370-
const flags = askFlags ? await compileFlags() : defaultFlags;
371-
if (isCompilable(file.name)) {
372-
compile([file], flags);
373-
}
341+
if (isCompilable(file.name)) compile([file]);
374342
}
375343

376344
// Compiles all files types in the namespace
377-
export async function namespaceCompile(askFlags = false): Promise<any> {
345+
export async function namespaceCompile(): Promise<any> {
378346
const api = new AtelierAPI();
379347
const fileTypes = ["*.CLS", "*.MAC", "*.INC", "*.BAS"];
380348
if (!api.active) return;
@@ -387,12 +355,6 @@ export async function namespaceCompile(askFlags = false): Promise<any> {
387355
// Don't compile without confirmation
388356
return;
389357
}
390-
const defaultFlags = config().compileFlags;
391-
const flags = askFlags ? await compileFlags() : defaultFlags;
392-
if (flags === undefined) {
393-
// User cancelled
394-
return;
395-
}
396358
vscode.window.withProgress(
397359
{
398360
cancellable: true,
@@ -401,7 +363,7 @@ export async function namespaceCompile(askFlags = false): Promise<any> {
401363
},
402364
(progress, token: vscode.CancellationToken) =>
403365
api
404-
.asyncCompile(fileTypes, token, flags)
366+
.asyncCompile(fileTypes, token, vscode.workspace.getConfiguration("objectscript").get<string>("compileFlags"))
405367
.then((data) => {
406368
if (data.status && data.status.errors && data.status.errors.length) {
407369
throw new Error(`Compiling Namespace: ${api.ns} Error`);

src/commands/project.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
3-
import { config, filesystemSchemas, projectsExplorerProvider } from "../extension";
3+
import { filesystemSchemas, projectsExplorerProvider } from "../extension";
44
import { isfsDocumentName } from "../providers/FileSystemProvider/FileSystemProvider";
5-
import { compileErrorMsg, getWsFolder, getWsServerConnection, handleError, notNull } from "../utils";
5+
import { getWsFolder, getWsServerConnection, handleError, notNull } from "../utils";
66
import { exportList } from "./export";
77
import { OtherStudioAction, StudioActions } from "./studio";
88
import { NodeBase, ProjectNode, ProjectRootNode, RoutineNode, CSPFileNode, ClassNode } from "../explorer/nodes";
@@ -918,38 +918,6 @@ export async function exportProjectContents(): Promise<any> {
918918
}
919919
}
920920

921-
export async function compileProjectContents(node: ProjectNode): Promise<any> {
922-
const { workspaceFolderUri, namespace, label } = node;
923-
const api = new AtelierAPI(workspaceFolderUri);
924-
api.setNamespace(namespace);
925-
const compileList: string[] = await api
926-
.actionQuery(
927-
"SELECT CASE WHEN Type = 'PKG' THEN Name||'.*.cls' WHEN Type = 'CLS' THEN Name||'.cls' ELSE Name END Name " +
928-
"FROM %Studio.Project_ProjectItemsList(?,1) WHERE Type != 'GBL' AND Type != 'DIR' " +
929-
"AND (Type != 'CSP' OR (Type = 'CSP' AND $PIECE(Name,'.',2) %INLIST $LISTFROMSTRING('csp,csr,CSP,CSR'))) " +
930-
"UNION SELECT SUBSTR(sod.Name,2) AS Name FROM %Library.RoutineMgr_StudioOpenDialog('*.csp,*.csr',1,1,1,1,0,1) AS sod " +
931-
"JOIN %Studio.Project_ProjectItemsList(?,1) AS pil ON pil.Type = 'DIR' AND sod.Name %STARTSWITH '/'||pil.Name||'/'",
932-
[label, label]
933-
)
934-
.then((data) => data.result.content.map((e) => e.Name));
935-
return vscode.window.withProgress(
936-
{
937-
cancellable: true,
938-
location: vscode.ProgressLocation.Notification,
939-
title: `Compiling project '${label}'`,
940-
},
941-
(progress, token: vscode.CancellationToken) =>
942-
api
943-
.asyncCompile(compileList, token, config().compileFlags)
944-
.then((data) => {
945-
if (data.status && data.status.errors && data.status.errors.length) {
946-
throw new Error("Compile error");
947-
}
948-
})
949-
.catch(() => compileErrorMsg())
950-
);
951-
}
952-
953921
/**
954922
* Returns the index of the first isfs folder in this workspace that is linked to `project`.
955923
*/

0 commit comments

Comments
 (0)