Skip to content

Commit 4906dbc

Browse files
committed
corrected read values from intersystems.servers
1 parent e2f7242 commit 4906dbc

File tree

4 files changed

+47
-23
lines changed

4 files changed

+47
-23
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@
448448
"scope": "resource",
449449
"additionalProperties": false,
450450
"default": {
451-
"active": true,
451+
"active": false,
452452
"host": "localhost",
453453
"port": 52773,
454454
"ns": "USER"
@@ -459,7 +459,8 @@
459459
"properties": {
460460
"active": {
461461
"type": "boolean",
462-
"description": "This connection is active"
462+
"description": "This connection is active",
463+
"default": false
463464
},
464465
"server": {
465466
"type": "string",

src/api/atelier.d.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,33 @@ interface ResponseStatus {
77
summary: string;
88
}
99

10-
interface ResponseResult<T> {
10+
interface Content<T> {
1111
content: T;
1212
}
1313

1414
export interface Response<T = any> {
1515
status: ResponseStatus;
1616
console: string[];
17-
result: ResponseResult<T>;
17+
result: T;
1818
}
1919

2020
interface ServerInfoFeature {
2121
name: string;
2222
enabled: string;
2323
}
2424

25+
export interface Document {
26+
name: string;
27+
db: string;
28+
ts: string;
29+
upd: boolean;
30+
cat: "RTN" | "CLS" | "CSP" | "OTH";
31+
status: string;
32+
enc: boolean;
33+
flags: number;
34+
content: string[];
35+
}
36+
2537
export interface ServerInfo {
2638
version: string;
2739
id: string;
@@ -30,17 +42,17 @@ export interface ServerInfo {
3042
namespaces: string[];
3143
}
3244

33-
export interface AtelierSearchMatch {
45+
export interface SearchMatch {
3446
text: string;
3547
line?: number;
3648
member?: string;
3749
attr?: string;
3850
attrline?: number;
3951
}
4052

41-
export interface AtelierSearchResult {
53+
export interface SearchResult {
4254
doc: string;
43-
matches: AtelierSearchMatch[];
55+
matches: SearchMatch[];
4456
}
4557

4658
export interface AtelierJob {
@@ -50,3 +62,9 @@ export interface AtelierJob {
5062
state: string;
5163
device: string;
5264
}
65+
66+
export interface DeleteStatus {
67+
name: string;
68+
db: string;
69+
status: string;
70+
}

src/api/index.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class AtelierAPI {
119119

120120
private setConnection(workspaceFolderName: string, namespace?: string): void {
121121
let serverName;
122-
if (config(`intersystems.servers.${workspaceFolderName}.webServer`)) {
122+
if (config(`intersystems.servers.${workspaceFolderName}`)) {
123123
serverName = workspaceFolderName;
124124
workspaceFolderName = currentWorkspaceFolder();
125125
}
@@ -129,10 +129,11 @@ export class AtelierAPI {
129129
}
130130

131131
if (serverName && serverName.length) {
132-
const { scheme, host, port, username, password, pathPrefix } = config(
133-
`intersystems.servers.${serverName}.webServer`,
134-
workspaceFolderName
135-
);
132+
const {
133+
webServer: { scheme, host, port, pathPrefix },
134+
username,
135+
password,
136+
} = config(`intersystems.servers.${serverName}`, workspaceFolderName);
136137
this._config = {
137138
active: conn.active,
138139
apiVersion: 1,
@@ -301,7 +302,7 @@ export class AtelierAPI {
301302
});
302303
}
303304

304-
public serverInfo(): Promise<Atelier.Response<Atelier.ServerInfo>> {
305+
public serverInfo(): Promise<Atelier.Response<Atelier.Content<Atelier.ServerInfo>>> {
305306
return this.request(0, "GET").then((info) => {
306307
if (info && info.result && info.result.content && info.result.content.api > 0) {
307308
const data = info.result.content;
@@ -332,15 +333,15 @@ export class AtelierAPI {
332333
category?: string;
333334
type?: string;
334335
filter?: string;
335-
}): Promise<any> {
336+
}): Promise<Atelier.Response> {
336337
return this.request(1, "GET", `${this.ns}/docnames/${category}/${type}`, null, {
337338
filter,
338339
generated,
339340
});
340341
}
341342

342343
// api v1+
343-
public getDoc(name: string, format?: string): Promise<any> {
344+
public getDoc(name: string, format?: string): Promise<Atelier.Response> {
344345
let params = {};
345346
if (format) {
346347
params = {
@@ -351,12 +352,16 @@ export class AtelierAPI {
351352
}
352353

353354
// api v1+
354-
public deleteDoc(name: string): Promise<any> {
355+
public deleteDoc(name: string): Promise<Atelier.Response<Atelier.Document>> {
355356
return this.request(1, "DELETE", `${this.ns}/doc/${name}`);
356357
}
357358

358359
// v1+
359-
public putDoc(name: string, data: { enc: boolean; content: string[] }, ignoreConflict?: boolean): Promise<any> {
360+
public putDoc(
361+
name: string,
362+
data: { enc: boolean; content: string[] },
363+
ignoreConflict?: boolean
364+
): Promise<Atelier.Response> {
360365
const params = { ignoreConflict };
361366
return this.request(1, "PUT", `${this.ns}/doc/${name}`, data, params);
362367
}
@@ -377,7 +382,7 @@ export class AtelierAPI {
377382
case?: boolean;
378383
wild?: boolean;
379384
word?: boolean;
380-
}): Promise<any> {
385+
}): Promise<Atelier.Response<Atelier.SearchResult[]>> {
381386
params = {
382387
files: "*.cls,*.mac,*.int,*.inc",
383388
gen: false,
@@ -409,12 +414,12 @@ export class AtelierAPI {
409414
});
410415
}
411416

412-
public cvtXmlUdl(source: string): Promise<any> {
417+
public cvtXmlUdl(source: string): Promise<Atelier.Response> {
413418
return this.request(1, "POST", `${this.ns}/`, source, {}, { "Content-Type": "application/xml" });
414419
}
415420

416421
// v2+
417-
public getmacrodefinition(docname: string, macroname: string, includes: string[]): Promise<any> {
422+
public getmacrodefinition(docname: string, macroname: string, includes: string[]): Promise<Atelier.Response> {
418423
return this.request(2, "POST", `${this.ns}/action/getmacrodefinition`, {
419424
docname,
420425
includes,

src/providers/FileSystemPovider/TextSearchProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as vscode from "vscode";
2-
import { AtelierSearchResult, AtelierSearchMatch } from "../../api/atelier";
2+
import { SearchResult, SearchMatch } from "../../api/atelier";
33
import { AtelierAPI } from "../../api";
44
import { DocumentContentProvider } from "../DocumentContentProvider";
55

@@ -30,7 +30,7 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
3030
case: query.isCaseSensitive,
3131
})
3232
.then((data) => data.result)
33-
.then((files: AtelierSearchResult[]) =>
33+
.then((files: SearchResult[]) =>
3434
files.map(async (file) => {
3535
const fileName = file.doc;
3636
const uri = DocumentContentProvider.getUri(fileName);
@@ -46,7 +46,7 @@ export class TextSearchProvider implements vscode.TextSearchProvider {
4646
.then((files) => {
4747
files.forEach((file) => {
4848
const { uri, document, matches } = file;
49-
matches.forEach((match: AtelierSearchMatch) => {
49+
matches.forEach((match: SearchMatch) => {
5050
const { text, member } = match;
5151
let { line } = match;
5252
if (member) {

0 commit comments

Comments
 (0)