Skip to content

Commit e40490f

Browse files
committed
some small fixes
1 parent dd63fd7 commit e40490f

File tree

6 files changed

+29
-42
lines changed

6 files changed

+29
-42
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Improvements in Server Explorer build tree.
88
- Fixed memory leak when exporting large amount of files.
99
- Some other fixes
10+
- Server view can be opened in explorer as virtual file system with schema `isfs://`
1011

1112
## [0.7.11]
1213

api/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ export class AtelierAPI {
179179
} else {
180180
return data;
181181
}
182+
})
183+
.catch((error) => {
184+
console.error(error);
185+
throw error;
182186
});
183187
});
184188
}

commands/compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function loadChanges(files: CurrentFile[]): Promise<any> {
4343
.then((data) => {
4444
const content = (data.result.content || []).join("\n");
4545
if (file.uri.scheme === "file") {
46-
fs.writeFileSync(file.uri.toString(), content);
46+
fs.writeFileSync(file.fileName, content);
4747
} else if (file.uri.scheme === FILESYSTEM_SCHEMA) {
4848
fileSystemProvider.writeFile(file.uri, Buffer.from(content), { overwrite: true, create: false });
4949
}

commands/export.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ export async function exportList(files: string[], workspaceFolder: string): Prom
129129
outputChannel.appendLine(`Items failed to export: \n${errors.join("\n")}`);
130130
}
131131
};
132-
return run(files).then(() => {
133-
outputChannel.appendLine("finish1");
134-
});
132+
return run(files);
135133
}
136134

137135
export async function exportAll(workspaceFolder?: string): Promise<any> {
@@ -140,7 +138,8 @@ export async function exportAll(workspaceFolder?: string): Promise<any> {
140138
.filter((folder) => config("conn", folder.name).active)
141139
.map((el) => el.name);
142140
if (list.length > 1) {
143-
return vscode.window.showQuickPick(list).then(exportAll);
141+
return vscode.window.showQuickPick(list)
142+
.then((folder) => folder ? exportAll : null);
144143
} else {
145144
workspaceFolder = list.pop();
146145
}

package.json

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,21 @@
3939
},
4040
"activationEvents": [
4141
"workspaceContains:*.cls",
42-
"onFileSystem:isfs",
42+
"workspaceContains:*.mac",
4343
"onCommand:vscode-objectscript.export",
4444
"onCommand:vscode-objectscript.compile",
4545
"onCommand:vscode-objectscript.viewOthers",
4646
"onCommand:vscode-objectscript.previewXml",
4747
"onCommand:vscode-objectscript.explorer.refresh",
4848
"onCommand:vscode-objectscript.explorer.openClass",
4949
"onCommand:vscode-objectscript.explorer.openRoutine",
50-
"onCommand:vscode-objectscript.explorer.hideSystem",
50+
"onCommand:vscode-objectscript.compileFolder",
5151
"onLanguage:objectscript",
5252
"onLanguage:objectscript-class",
5353
"onLanguage:objectscript-macros",
5454
"onLanguage:xml",
5555
"onView:ObjectScriptExplorer",
56+
"onFileSystem:isfs",
5657
"onFileSystem:objectscript",
5758
"onDebugInitialConfigurations"
5859
],
@@ -70,11 +71,11 @@
7071
},
7172
{
7273
"command": "vscode-objectscript.compile",
73-
"when": "vscode-objectscript.connectActive"
74+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
7475
},
7576
{
7677
"command": "vscode-objectscript.compileWithFlags",
77-
"when": "vscode-objectscript.connectActive"
78+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
7879
},
7980
{
8081
"command": "vscode-objectscript.compileAll",
@@ -86,39 +87,35 @@
8687
},
8788
{
8889
"command": "vscode-objectscript.viewOthers",
89-
"when": "vscode-objectscript.connectActive"
90+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
9091
},
9192
{
9293
"command": "vscode-objectscript.subclass",
93-
"when": "vscode-objectscript.connectActive"
94+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
9495
},
9596
{
9697
"command": "vscode-objectscript.superclass",
97-
"when": "vscode-objectscript.connectActive"
98+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
9899
},
99100
{
100101
"command": "vscode-objectscript.previewXml",
101-
"when": "vscode-objectscript.connectActive"
102+
"when": "editorLangId = xml && vscode-objectscript.connectActive"
102103
},
103104
{
104105
"command": "vscode-objectscript.explorer.export",
105-
"when": "true"
106+
"when": "vscode-objectscript.connectActive"
106107
},
107108
{
108109
"command": "vscode-objectscript.explorer.delete",
109110
"when": "false"
110111
},
111112
{
112113
"command": "vscode-objectscript.explorer.refresh",
113-
"when": "true"
114-
},
115-
{
116-
"command": "vscode-objectscript.explorer.showSystem",
117-
"when": "true"
114+
"when": "vscode-objectscript.connectActive"
118115
},
119116
{
120-
"command": "vscode-objectscript.explorer.hideSystem",
121-
"when": "true"
117+
"command": "vscode-objectscript.compileFolder",
118+
"when": "false"
122119
}
123120
],
124121
"view/title": [
@@ -141,14 +138,6 @@
141138
"command": "vscode-objectscript.explorer.delete",
142139
"when": "view == ObjectScriptExplorer && viewItem =~ /^dataNode:/"
143140
},
144-
{
145-
"command": "vscode-objectscript.explorer.showSystem",
146-
"when": "view == ObjectScriptExplorer && viewItem == serverNode"
147-
},
148-
{
149-
"command": "vscode-objectscript.explorer.hideSystem",
150-
"when": "view == ObjectScriptExplorer && viewItem == serverNodeSystem"
151-
},
152141
{
153142
"command": "vscode-objectscript.explorer.otherNamespace",
154143
"when": "view == ObjectScriptExplorer && viewItem == serverNode",
@@ -309,16 +298,6 @@
309298
"command": "vscode-objectscript.compileAllWithFlags",
310299
"title": "Compile all namespace files with specified flags"
311300
},
312-
{
313-
"command": "vscode-objectscript.explorer.showSystem",
314-
"title": "Show system objects",
315-
"category": "ObjecScript"
316-
},
317-
{
318-
"command": "vscode-objectscript.explorer.hideSystem",
319-
"title": "Hide system objects",
320-
"category": "ObjecScript"
321-
},
322301
{
323302
"command": "vscode-objectscript.explorer.export",
324303
"title": "Export",

providers/ObjectScriptCompletionItemProvider.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
323323
className = text.split(" ").pop();
324324
}
325325
// tslint:disable-next-line: max-line-length
326-
pattern = /(?:(Extends |CompileAfter *=|DependsOn *=|PropertyClass *=) *\(? *)((%?[a-zA-Z][a-zA-Z0-9]*(?:\.[a-zA-Z][a-zA-Z0-9]*)*)(, *%?[a-zA-Z][a-zA-Z0-9]*(?:\.[a-zA-Z][a-zA-Z0-9]*)*|, *)*.?)?/i;
326+
pattern = /(?:(Extends |CompileAfter *=|DependsOn *=|PropertyClass *=) *\(? *)((%?[a-zA-Z0-9]*(?:\.[a-zA-Z0-9]*)*)(, *%?[a-zA-Z0-9]*(?:\.[a-zA-Z0-9]*)*|, *)*.?)?/i;
327327
if ((!range)
328328
// && (!document.getWordRangeAtPosition(position, /\bExtends\b\s*/i))
329329
&& document.getWordRangeAtPosition(position, pattern)) {
330-
range = document.getWordRangeAtPosition(position, /%?[a-zA-Z][a-zA-Z0-9.]*/)
330+
range = document.getWordRangeAtPosition(position, /%?[a-zA-Z][a-zA-Z0-9.]*|%/)
331331
|| new vscode.Range(position, position);
332332
text = document.getText(range);
333333
className = text.split(/\s|\(/).pop();
@@ -396,12 +396,16 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
396396
const api = new AtelierAPI();
397397
return api.actionQuery(sql, params).then((data) => {
398398
return data.result.content
399+
.map((el) => ({
400+
...el,
401+
AsPackage: (el.AsPackage === "1"),
402+
}))
399403
.map((el) => ({
400404
command: el.AsPackage ? { title: "", command: "editor.action.triggerSuggest" } : null,
401405
insertText: new vscode.SnippetString(el.PartName + (el.AsPackage ? "." : "")),
402406
kind: el.AsPackage ? vscode.CompletionItemKind.Folder : vscode.CompletionItemKind.Class,
403407
label: el.PartName,
404-
range: document.getWordRangeAtPosition(position, /%?\b[a-zA-Z][a-zA-Z0-9]*\b/),
408+
range: document.getWordRangeAtPosition(position, /%?\b[a-zA-Z][a-zA-Z0-9]*\b|%/),
405409
sortText: el.Priority + el.PartName + (el.AsPackage ? "0" : "1"),
406410
}));
407411
});

0 commit comments

Comments
 (0)