Skip to content

Commit 1326bdd

Browse files
committed
corrected read values from intersystems.servers
1 parent f00474d commit 1326bdd

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
@@ -509,7 +509,7 @@
509509
"scope": "resource",
510510
"additionalProperties": false,
511511
"default": {
512-
"active": true,
512+
"active": false,
513513
"host": "localhost",
514514
"port": 52773,
515515
"ns": "USER"
@@ -520,7 +520,8 @@
520520
"properties": {
521521
"active": {
522522
"type": "boolean",
523-
"description": "This connection is active"
523+
"description": "This connection is active",
524+
"default": false
524525
},
525526
"server": {
526527
"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
@@ -129,7 +129,7 @@ export class AtelierAPI {
129129

130130
private setConnection(workspaceFolderName: string, namespace?: string): void {
131131
let serverName;
132-
if (config(`intersystems.servers.${workspaceFolderName}.webServer`)) {
132+
if (config(`intersystems.servers.${workspaceFolderName}`)) {
133133
serverName = workspaceFolderName;
134134
workspaceFolderName = currentWorkspaceFolder();
135135
}
@@ -139,10 +139,11 @@ export class AtelierAPI {
139139
}
140140

141141
if (serverName && serverName.length) {
142-
const { scheme, host, port, username, password, pathPrefix } = config(
143-
`intersystems.servers.${serverName}.webServer`,
144-
workspaceFolderName
145-
);
142+
const {
143+
webServer: { scheme, host, port, pathPrefix },
144+
username,
145+
password,
146+
} = config(`intersystems.servers.${serverName}`, workspaceFolderName);
146147
this._config = {
147148
active: conn.active,
148149
apiVersion: 1,
@@ -308,7 +309,7 @@ export class AtelierAPI {
308309
});
309310
}
310311

311-
public serverInfo(): Promise<Atelier.Response<Atelier.ServerInfo>> {
312+
public serverInfo(): Promise<Atelier.Response<Atelier.Content<Atelier.ServerInfo>>> {
312313
return this.request(0, "GET").then((info) => {
313314
if (info && info.result && info.result.content && info.result.content.api > 0) {
314315
const data = info.result.content;
@@ -339,15 +340,15 @@ export class AtelierAPI {
339340
category?: string;
340341
type?: string;
341342
filter?: string;
342-
}): Promise<any> {
343+
}): Promise<Atelier.Response> {
343344
return this.request(1, "GET", `${this.ns}/docnames/${category}/${type}`, null, {
344345
filter,
345346
generated,
346347
});
347348
}
348349

349350
// api v1+
350-
public getDoc(name: string, format?: string): Promise<any> {
351+
public getDoc(name: string, format?: string): Promise<Atelier.Response> {
351352
let params = {};
352353
if (format) {
353354
params = {
@@ -359,12 +360,16 @@ export class AtelierAPI {
359360
}
360361

361362
// api v1+
362-
public deleteDoc(name: string): Promise<any> {
363+
public deleteDoc(name: string): Promise<Atelier.Response<Atelier.Document>> {
363364
return this.request(1, "DELETE", `${this.ns}/doc/${name}`);
364365
}
365366

366367
// v1+
367-
public putDoc(name: string, data: { enc: boolean; content: string[] }, ignoreConflict?: boolean): Promise<any> {
368+
public putDoc(
369+
name: string,
370+
data: { enc: boolean; content: string[] },
371+
ignoreConflict?: boolean
372+
): Promise<Atelier.Response> {
368373
const params = { ignoreConflict };
369374
name = this.transformNameIfCsp(name);
370375
return this.request(1, "PUT", `${this.ns}/doc/${name}`, data, params);
@@ -386,7 +391,7 @@ export class AtelierAPI {
386391
case?: boolean;
387392
wild?: boolean;
388393
word?: boolean;
389-
}): Promise<any> {
394+
}): Promise<Atelier.Response<Atelier.SearchResult[]>> {
390395
params = {
391396
files: "*.cls,*.mac,*.int,*.inc",
392397
gen: false,
@@ -419,12 +424,12 @@ export class AtelierAPI {
419424
});
420425
}
421426

422-
public cvtXmlUdl(source: string): Promise<any> {
427+
public cvtXmlUdl(source: string): Promise<Atelier.Response> {
423428
return this.request(1, "POST", `${this.ns}/`, source, {}, { "Content-Type": "application/xml" });
424429
}
425430

426431
// v2+
427-
public getmacrodefinition(docname: string, macroname: string, includes: string[]): Promise<any> {
432+
public getmacrodefinition(docname: string, macroname: string, includes: string[]): Promise<Atelier.Response> {
428433
return this.request(2, "POST", `${this.ns}/action/getmacrodefinition`, {
429434
docname,
430435
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)