Skip to content

Commit 908ed7c

Browse files
authored
Merge branch 'master' into #165-explorer_show_system
2 parents 973f8b6 + 5f1fdeb commit 908ed7c

File tree

9 files changed

+41
-17
lines changed

9 files changed

+41
-17
lines changed

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"kind": "build"
2222
},
2323
"isBackground": true,
24-
"problemMatcher": "$tsc-watch"
24+
"problemMatcher": "$eslint-stylish"
2525
}
2626
]
2727
}

src/debug/debugAdapterFactory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import net = require("net");
22
import vscode = require("vscode");
33
import { ObjectScriptDebugSession } from "./debugSession";
44

5-
export class ObjectScriptDebugAdapterDescriptorFactory implements vscode.DebugAdapterDescriptorFactory {
5+
export class ObjectScriptDebugAdapterDescriptorFactory
6+
implements vscode.DebugAdapterDescriptorFactory, vscode.Disposable {
67
private server?: net.Server;
78

89
public createDebugAdapterDescriptor(
@@ -26,7 +27,7 @@ export class ObjectScriptDebugAdapterDescriptorFactory implements vscode.DebugAd
2627
return new vscode.DebugAdapterServer(port);
2728
}
2829

29-
public dispose() {
30+
public dispose(): void {
3031
if (this.server) {
3132
this.server.close();
3233
}

src/explorer/models/nodeBase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class NodeBase {
4646
};
4747
}
4848

49-
public async getChildren(element): Promise<NodeBase[]> {
49+
public async getChildren(element: NodeBase): Promise<NodeBase[]> {
5050
return [];
5151
}
5252

src/explorer/models/packageNode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as vscode from "vscode";
22
import { RootNode } from "./rootNode";
3+
import { NodeOptions } from "./nodeBase";
34

45
export class PackageNode extends RootNode {
5-
public constructor(label: string, fullName: string, category: string, options) {
6+
public constructor(label: string, fullName: string, category: string, options: NodeOptions) {
67
super(label, fullName, "dataNode:packageNode", category, options);
78
}
89

src/explorer/models/rootNode.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PackageNode } from "./packageNode";
55
import { RoutineNode } from "./routineNode";
66
import { AtelierAPI } from "../../api";
77
import { ClassNode } from "./classesNode";
8+
import { StudioOpenDialog } from "../../queries";
89

910
export class RootNode extends NodeBase {
1011
public readonly contextValue: string;
@@ -37,12 +38,12 @@ export class RootNode extends NodeBase {
3738
};
3839
}
3940

40-
public async getChildren(element): Promise<NodeBase[]> {
41+
public async getChildren(element: NodeBase): Promise<NodeBase[]> {
4142
const path = this instanceof PackageNode || this.isCsp ? this.fullName + "/" : "";
4243
return this.getItems(path, this._category);
4344
}
4445

45-
public getList(path: string, category: string, flat: boolean) {
46+
public getList(path: string, category: string, flat: boolean): Promise<(StudioOpenDialog & { fullName: string })[]> {
4647
const sql = "CALL %Library.RoutineMgr_StudioOpenDialog(?,?,?,?,?,?,?)";
4748
// const sql = "CALL %Library.RoutineMgr_StudioOpenDialog(?,,,,,,?)";
4849
let spec = "";
@@ -86,7 +87,7 @@ export class RootNode extends NodeBase {
8687
return content;
8788
})
8889
.then((data) =>
89-
data.map((el) => {
90+
data.map((el: StudioOpenDialog) => {
9091
let fullName = el.Name;
9192
if (this instanceof PackageNode) {
9293
fullName = this.fullName + "." + el.Name;

src/providers/FileSystemPovider/FileSystemProvider.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import * as url from "url";
44
import { AtelierAPI } from "../../api";
55
import { Directory } from "./Directory";
66
import { File } from "./File";
7+
import { fireOtherStudioAction, OtherStudioAction } from "../../commands/studio";
8+
import { StudioOpenDialog } from "../../queries";
79

810
export type Entry = File | Directory;
911

@@ -55,7 +57,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
5557
.actionQuery(sql, [spec, dir, orderBy, system, flat, notStudio, generated])
5658
.then((data) => data.result.content || [])
5759
.then((data) =>
58-
data.map((item) => {
60+
data.map((item: StudioOpenDialog) => {
5961
const name = item.Name;
6062
const fullName = folder === "" ? name : folder + "/" + name;
6163
if (item.Type === "10" || item.Type === "9") {
@@ -151,11 +153,15 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
151153
throw new Error("Not implemented");
152154
}
153155
})
154-
.then(() =>
156+
.then((response) => {
157+
if (response && response.result.ext && response.result.ext[0] && response.result.ext[1]) {
158+
fireOtherStudioAction(OtherStudioAction.CreatedNewDocument, uri, response.result.ext[0]);
159+
fireOtherStudioAction(OtherStudioAction.FirstTimeDocumentSave, uri, response.result.ext[1]);
160+
}
155161
this._lookupAsFile(uri).then((entry) => {
156162
this._fireSoon({ type: vscode.FileChangeType.Changed, uri });
157-
})
158-
);
163+
});
164+
});
159165
}
160166

161167
public delete(uri: vscode.Uri, options: { recursive: boolean }): void | Thenable<void> {
@@ -166,7 +172,12 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
166172
return;
167173
}
168174
const api = new AtelierAPI(uri);
169-
return api.deleteDoc(fileName).then(() => this._fireSoon({ type: vscode.FileChangeType.Deleted, uri }));
175+
return api.deleteDoc(fileName).then((response) => {
176+
if (response.result.ext) {
177+
fireOtherStudioAction(OtherStudioAction.DeletedDocument, uri, response.result.ext);
178+
}
179+
this._fireSoon({ type: vscode.FileChangeType.Deleted, uri });
180+
});
170181
}
171182

172183
public rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { overwrite: boolean }): void | Thenable<void> {

src/providers/ObjectScriptCompletionItemProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
203203
});
204204
}
205205

206-
public listSystemVariables(search: string) {
206+
public listSystemVariables(search: string): vscode.CompletionItem[] {
207207
return systemVariables
208208
.filter((el) => el.label.startsWith(search) || el.alias.findIndex((el2) => el2.startsWith(search)) >= 0)
209209
.map((el) => {
@@ -217,7 +217,7 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
217217
});
218218
}
219219

220-
public listStructuredSystemVariables(search: string, open = false) {
220+
public listStructuredSystemVariables(search: string, open = false): vscode.CompletionItem[] {
221221
return structuredSystemVariables.map((el) => {
222222
return {
223223
...el,
@@ -436,7 +436,7 @@ export class ObjectScriptCompletionItemProvider implements vscode.CompletionItem
436436
position: vscode.Position,
437437
token: vscode.CancellationToken,
438438
context: vscode.CompletionContext
439-
) {
439+
): vscode.ProviderResult<vscode.CompletionItem[] | vscode.CompletionList> {
440440
const range = document.getWordRangeAtPosition(position, /\$system(\.\b\w+\b)?(\.\b\w+\b)?\./i);
441441
const text = range ? document.getText(range) : "";
442442
const [, className] = text.match(/\$system(\.\b\w+\b)?(\.\b\w+\b)?\./i);

src/providers/WorkspaceSymbolProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from "vscode";
22
import { AtelierAPI } from "../api";
33
import { ClassDefinition } from "../utils/classDefinition";
44
import { DocumentContentProvider } from "./DocumentContentProvider";
5+
import { StudioOpenDialog } from "../queries";
56

67
export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
78
public provideWorkspaceSymbols(
@@ -48,7 +49,7 @@ export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider {
4849
const generated = "0";
4950

5051
const data = await api.actionQuery(sql, [query, direction, orderBy, systemFiles, flat, notStudio, generated]);
51-
return data.result.content.map(({ Name }) => ({
52+
return data.result.content.map(({ Name }: StudioOpenDialog) => ({
5253
kind: vscode.SymbolKind.File,
5354
location: {
5455
uri: DocumentContentProvider.getUri(Name),

src/queries.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export interface StudioOpenDialog {
2+
Name: string;
3+
IsDirectory: string;
4+
Type: string;
5+
Size: string;
6+
Date: string;
7+
Description: string;
8+
IconType: string;
9+
}

0 commit comments

Comments
 (0)