Skip to content

Commit 6837229

Browse files
Merge branch 'master' into fix-163
2 parents 972f808 + 71d8bb3 commit 6837229

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5445
-3375
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vscode.d.ts
2+
vscode.proposed.d.ts

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- created
1616
jobs:
1717
build:
18+
timeout-minutes: 10
1819
runs-on: ${{ matrix.os }}
1920
strategy:
2021
matrix:
@@ -48,6 +49,9 @@ jobs:
4849
with:
4950
node-version: 12.x
5051
- run: npm install
52+
- name: lint
53+
if: runner.os == 'Linux'
54+
run: npm run lint
5155
- run: npm run compile
5256
- name: npm test
5357
uses: GabrielBB/[email protected]

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ node_modules/
22
.idea
33
*.iml
44
.vscode/**
5-
.vscode-test
6-
out
5+
.vscode-test/
6+
out/
7+
dist/
78
*.vsix
9+
vscode*.d.ts

.vscodeignore

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
.github/**
12
.vscode/**
23
.vscode-test/**
3-
typings/**
4-
out/test/**
5-
test/**
6-
# src/**
7-
# **/*.map
4+
out/
5+
src/
6+
**/*.ts
7+
**/*.map
8+
**/*.cls
89
.gitignore
9-
tsconfig.json
10+
tsconfig*.json
11+
**/tslint.json
12+
**/.eslintrc.json
13+
node_modules/
14+
webpack.config.js

package-lock.json

Lines changed: 4961 additions & 1314 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040
],
4141
"engines": {
42-
"vscode": "^1.41.0"
42+
"vscode": "^1.46.0"
4343
},
4444
"enableProposedApi": true,
4545
"activationEvents": [
@@ -63,7 +63,7 @@
6363
"onFileSystem:objectscript",
6464
"onDebugInitialConfigurations"
6565
],
66-
"main": "./out/extension",
66+
"main": "./dist/extension",
6767
"contributes": {
6868
"menus": {
6969
"commandPalette": [
@@ -728,56 +728,64 @@
728728
]
729729
},
730730
"scripts": {
731-
"vscode:prepublish": "npm run compile",
731+
"vscode:prepublish": "webpack --mode production",
732+
"webpack": "webpack --mode development",
733+
"webpack-dev": "webpack --mode development --watch",
732734
"package": "vsce package",
733-
"compile": "tsc -p ./",
735+
"compile": "webpack --mode production && tsc -p ./",
734736
"watch": "tsc -w -p ./tsconfig.json",
735737
"pretest": "npm run compile",
736738
"test": "node ./out/test/runTest.js",
737-
"lint": "node ./node_modules/tslint/bin/tslint --project tsconfig.json -t verbose",
738-
"lint-fix": "tslint --project tsconfig.json -t verbose --fix"
739+
"lint": "eslint src/**",
740+
"lint-fix": "eslint --fix src/**",
741+
"download-api": "vscode-dts dev",
742+
"postdownload-api": "vscode-dts master",
743+
"postinstall": "npm run download-api"
739744
},
740745
"devDependencies": {
741-
"@types/glob": "^7.1.1",
742-
"@types/mocha": "^5.2.7",
743-
"@types/node": "^12.12.26",
744-
"@types/request": "^2.48.4",
745-
"@types/request-promise": "^4.1.45",
746-
"@types/vscode": "^1.41.0",
747-
"@types/ws": "^6.0.4",
746+
"@types/glob": "^7.1.2",
747+
"@types/mocha": "^7.0.2",
748+
"@types/node": "^14.0.14",
749+
"@types/request": "^2.48.5",
750+
"@types/request-promise": "^4.1.46",
751+
"@types/ws": "^7.2.5",
748752
"@types/xmldom": "^0.1.29",
749-
"@typescript-eslint/eslint-plugin": "^2.19.0",
750-
"@typescript-eslint/parser": "^2.19.0",
751-
"eslint": "^6.8.0",
752-
"eslint-config-airbnb": "^18.0.1",
753-
"eslint-config-prettier": "^6.10.0",
754-
"eslint-plugin-import": "^2.20.1",
755-
"eslint-plugin-jsx-a11y": "^6.2.3",
756-
"eslint-plugin-node": "^10.0.0",
757-
"eslint-plugin-prettier": "^3.1.2",
753+
"@typescript-eslint/eslint-plugin": "^3.4.0",
754+
"@typescript-eslint/parser": "^3.4.0",
755+
"eslint": "^7.3.1",
756+
"eslint-config-airbnb": "^18.2.0",
757+
"eslint-config-prettier": "^6.11.0",
758+
"eslint-plugin-import": "^2.21.2",
759+
"eslint-plugin-jsx-a11y": "^6.3.1",
760+
"eslint-plugin-node": "^11.1.0",
761+
"eslint-plugin-prettier": "^3.1.4",
758762
"eslint-plugin-promise": "^4.2.1",
759763
"extend": "^3.0.2",
760-
"minimist": ">=1.2.2",
761-
"mocha": "^6.2.2",
762-
"prettier": "^1.19.1",
763-
"tape": "^4.13.0",
764-
"typescript": "^3.7.5",
765-
"vsce": "^1.73.0",
766-
"vscode-debugadapter-testsupport": "^1.40.1",
767-
"vscode-test": "^1.3.0"
764+
"minimist": ">=1.2.5",
765+
"mocha": "^8.0.1",
766+
"prettier": "^2.0.5",
767+
"tape": "^5.0.1",
768+
"ts-loader": "^7.0.5",
769+
"typescript": "^3.9.5",
770+
"vsce": "^1.77.0",
771+
"vscode-debugadapter-testsupport": "^1.41.0",
772+
"vscode-dts": "^0.3.1",
773+
"vscode-test": "^1.4.0",
774+
"webpack": "^4.43.0",
775+
"webpack-cli": "^3.3.12"
768776
},
769777
"dependencies": {
770778
"await-notify": "^1.0.1",
771779
"glob": "^7.1.6",
772-
"iconv-lite": "^0.5.1",
773-
"mkdirp": "^1.0.3",
774-
"request": "^2.88.0",
780+
"iconv-lite": "^0.6.0",
781+
"mkdirp": "^1.0.4",
782+
"request": "^2.88.2",
775783
"request-promise": "^4.2.5",
776784
"vscode-cache": "^0.3.0",
777-
"vscode-debugadapter": "^1.39.1",
778-
"vscode-debugprotocol": "^1.39.0",
779-
"vscode-extension-telemetry": "^0.1.2",
780-
"ws": "^7.2.1",
781-
"xmldom": "^0.1.31"
785+
"vscode-debugadapter": "^1.41.0",
786+
"vscode-debugprotocol": "^1.41.0",
787+
"vscode-extension-telemetry": "^0.1.6",
788+
"ws": "^7.3.0",
789+
"xmldom": "^0.3.0"
782790
}
783791
}

src/api/index.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ export class AtelierAPI {
7272

7373
public updateCookies(newCookies: string[]): Promise<any> {
7474
const cookies = this.cache.get("cookies", []);
75-
newCookies.forEach(cookie => {
75+
newCookies.forEach((cookie) => {
7676
const [cookieName] = cookie.split("=");
77-
const index = cookies.findIndex(el => el.startsWith(cookieName));
77+
const index = cookies.findIndex((el) => el.startsWith(cookieName));
7878
if (index >= 0) {
7979
cookies[index] = cookie;
8080
} else {
@@ -123,7 +123,7 @@ export class AtelierAPI {
123123
return "";
124124
}
125125
const result = [];
126-
Object.keys(params).forEach(key => {
126+
Object.keys(params).forEach((key) => {
127127
const value = params[key];
128128
if (typeof value === "boolean") {
129129
result.push(`${key}=${value ? "1" : "0"}`);
@@ -156,7 +156,7 @@ export class AtelierAPI {
156156
auth = this.request(0, "HEAD");
157157
}
158158
const connInfo = `${host}:${port}[${this.ns}]`;
159-
return auth.then(cookie => {
159+
return auth.then((cookie) => {
160160
return (
161161
request({
162162
agent,
@@ -173,8 +173,8 @@ export class AtelierAPI {
173173
uri: `${proto}://${host}:${port}${path}`,
174174
})
175175
// .catch(error => error.error)
176-
.then(response => this.updateCookies(response.headers["set-cookie"]).then(() => response))
177-
.then(response => {
176+
.then((response) => this.updateCookies(response.headers["set-cookie"]).then(() => response))
177+
.then((response) => {
178178
panel.text = `${connInfo} - Connected`;
179179
// console.log(`APIResponse: ${method} ${proto}://${host}:${port}${path}`)
180180
if (method === "HEAD") {
@@ -188,18 +188,19 @@ export class AtelierAPI {
188188
}
189189
if (data.console) {
190190
// Let studio actions handle their console output
191-
const isStudioAction = data.result.content != undefined
192-
&& data.result.content.length !== 0
193-
&& data.result.content[0] != undefined
194-
&& data.result.content[0].action != undefined;
195-
if(!isStudioAction) {
191+
const isStudioAction =
192+
data.result.content != undefined &&
193+
data.result.content.length !== 0 &&
194+
data.result.content[0] != undefined &&
195+
data.result.content[0].action != undefined;
196+
if (!isStudioAction) {
196197
outputConsole(data.console);
197198
}
198199
}
199200
if (data.result.status && data.result.status !== "") {
200201
const status: string = data.result.status;
201202
outputChannel.appendLine(status);
202-
if(status.endsWith("is marked as read only by source control hooks.")) {
203+
if (status.endsWith("is marked as read only by source control hooks.")) {
203204
vscode.window.showWarningMessage(status, { modal: true });
204205
}
205206
throw new Error(data.result.status);
@@ -212,9 +213,9 @@ export class AtelierAPI {
212213
return data;
213214
}
214215
})
215-
.catch(error => {
216+
.catch((error) => {
216217
if (error.error && error.error.code === "ECONNREFUSED") {
217-
setTimeout(checkConnection, 1000);
218+
setTimeout(checkConnection, 30000);
218219
}
219220
console.error(error);
220221
throw error;
@@ -224,7 +225,7 @@ export class AtelierAPI {
224225
}
225226

226227
public serverInfo(): Promise<any> {
227-
return this.request(0, "GET").then(info => {
228+
return this.request(0, "GET").then((info) => {
228229
if (info && info.result && info.result.content && info.result.content.api > 0) {
229230
const data = info.result.content;
230231
const apiVersion = data.api;

src/commands/compile.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async function importFile(file: CurrentFile): Promise<any> {
3232
}
3333

3434
function updateOthers(others: string[]) {
35-
others.forEach(item => {
35+
others.forEach((item) => {
3636
const uri = DocumentContentProvider.getUri(item);
3737
documentContentProvider.update(uri);
3838
});
@@ -44,11 +44,11 @@ export async function loadChanges(files: CurrentFile[]): Promise<any> {
4444
}
4545
const api = new AtelierAPI(files[0].uri);
4646
return Promise.all(
47-
files.map(file =>
47+
files.map((file) =>
4848
api
4949
.getDoc(file.name)
50-
.then(data => {
51-
const content = (data.result.content || []).join("\n");
50+
.then((data) => {
51+
const content = (data.result.content || []).join(file.eol === vscode.EndOfLine.LF ? "\n" : "\r\n");
5252
if (file.uri.scheme === "file") {
5353
fs.writeFileSync(file.fileName, content);
5454
} else if (file.uri.scheme === FILESYSTEM_SCHEMA) {
@@ -59,7 +59,7 @@ export async function loadChanges(files: CurrentFile[]): Promise<any> {
5959
}
6060
})
6161
.then(() => api.actionIndex([file.name]))
62-
.then(data => data.result.content[0].others)
62+
.then((data) => data.result.content[0].others)
6363
.then(updateOthers)
6464
)
6565
);
@@ -73,15 +73,15 @@ async function compile(docs: CurrentFile[], flags?: string): Promise<any> {
7373
{
7474
cancellable: false,
7575
location: vscode.ProgressLocation.Notification,
76-
title: `Compiling: ${docs.length === 1 ? docs.map(el => el.name).join(", ") : docs.length + " files"}`,
76+
title: `Compiling: ${docs.length === 1 ? docs.map((el) => el.name).join(", ") : docs.length + " files"}`,
7777
},
7878
() =>
7979
api
8080
.actionCompile(
81-
docs.map(el => el.name),
81+
docs.map((el) => el.name),
8282
flags
8383
)
84-
.then(data => {
84+
.then((data) => {
8585
const info = docs.length > 1 ? "" : `${docs[0].name}: `;
8686
if (data.status && data.status.errors && data.status.errors.length) {
8787
throw new Error(`${info}Compile error`);
@@ -94,7 +94,7 @@ async function compile(docs: CurrentFile[], flags?: string): Promise<any> {
9494
outputChannel.appendLine(error.message);
9595
outputChannel.show(true);
9696
if (!config("suppressCompileErrorMessages")) {
97-
vscode.window.showErrorMessage(error.message, "Show details").then(data => {
97+
vscode.window.showErrorMessage(error.message, "Show details").then((data) => {
9898
outputChannel.show(true);
9999
});
100100
}
@@ -116,7 +116,7 @@ export async function importAndCompile(askFLags = false, document?: vscode.TextD
116116
const defaultFlags = config().compileFlags;
117117
const flags = askFLags ? await compileFlags() : defaultFlags;
118118
return importFile(file)
119-
.catch(error => {
119+
.catch((error) => {
120120
// console.error(error);
121121
throw error;
122122
})
@@ -158,12 +158,12 @@ export async function namespaceCompile(askFLags = false): Promise<any> {
158158

159159
function importFiles(files) {
160160
return Promise.all<CurrentFile>(
161-
files.map(file =>
161+
files.map((file) =>
162162
vscode.workspace
163163
.openTextDocument(file)
164164
.then(currentFile)
165-
.then(curFile =>
166-
importFile(curFile).then(data => {
165+
.then((curFile) =>
166+
importFile(curFile).then((data) => {
167167
outputChannel.appendLine("Imported file: " + curFile.fileName);
168168
return curFile;
169169
})
@@ -184,7 +184,7 @@ export async function importFolder(uri: vscode.Uri): Promise<any> {
184184
matchBase: true,
185185
nocase: true,
186186
},
187-
(error, files) => importFiles(files.map(name => path.join(folder, name)))
187+
(error, files) => importFiles(files.map((name) => path.join(folder, name)))
188188
);
189189
}
190190

src/commands/delete.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ function deleteList(items: string[], workspaceFolder: string): Promise<any> {
1515

1616
const api = new AtelierAPI();
1717
api.setConnection(workspaceFolder);
18-
return Promise.all(items.map(item => api.deleteDoc(item))).then(files => {
19-
outputChannel.appendLine(`Deleted items: ${files.filter(el => el.result).length}`);
20-
const failed = files.filter(el => !el.result).map(el => `${el.file} - ${el.error}`);
21-
if (files.find(el => !el.result)) {
18+
return Promise.all(items.map((item) => api.deleteDoc(item))).then((files) => {
19+
outputChannel.appendLine(`Deleted items: ${files.filter((el) => el.result).length}`);
20+
const failed = files.filter((el) => !el.result).map((el) => `${el.file} - ${el.error}`);
21+
if (files.find((el) => !el.result)) {
2222
outputChannel.appendLine(`Items failed to delete: \n${failed.join("\n")}`);
2323
}
2424
});
@@ -28,13 +28,13 @@ export async function deleteItem(node: RootNode | PackageNode | ClassNode | Rout
2828
const workspaceFolder = node.workspaceFolder;
2929
const nodesList = node instanceof RootNode ? node.getChildren(node) : Promise.resolve([node]);
3030
return nodesList
31-
.then(nodes =>
31+
.then((nodes) =>
3232
nodes.reduce(
3333
(list, subNode) => list.concat(subNode instanceof PackageNode ? subNode.getClasses() : [subNode.fullName]),
3434
[]
3535
)
3636
)
37-
.then(items => {
37+
.then((items) => {
3838
deleteList(items, workspaceFolder);
3939
explorerProvider.refresh();
4040
});

0 commit comments

Comments
 (0)