Skip to content

Commit 141877e

Browse files
authored
Fix indexer not being built (#48)
* Fix indexer not being built with esbuild * Remove debug logs
1 parent f8f143b commit 141877e

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ tsconfig.tsbuildinfo
66
server/scripts/nwscript.nss
77
yarn-error.log
88
.DS_Store
9-
TODO.txt
9+
TODO.txt
10+
nwscript.nss

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/PhilippeChab/nwscript-ee-language-server"
99
},
1010
"license": "MIT",
11-
"version": "1.5.4",
11+
"version": "1.5.5",
1212
"author": {
1313
"name": "Philippe Chabot"
1414
},
@@ -147,7 +147,7 @@
147147
"vscode:prepublish": "yarn build",
148148
"build": "yarn clean && yarn buildClient && yarn buildServer",
149149
"buildClient": "esbuild extension=./client/src/extension.ts --sourcemap --bundle --external:vscode --platform=node --outdir=./client/out/",
150-
"buildServer": "esbuild server=./server/src/server.ts --sourcemap --bundle --external:vscode --platform=node --outdir=./server/out/",
150+
"buildServer": "esbuild server=./server/src/server.ts indexer=./server/src/Documents/DocumentsIndexer.ts --sourcemap --bundle --external:vscode --platform=node --outdir=./server/out/",
151151
"compile": "tsc -b",
152152
"compile:client": "tsc -b ./client/tsconfig.json",
153153
"compile:server": "tsc -b ./server/tsconfig.json",

server/src/Documents/Document.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,22 @@ export default class Document {
129129
}),
130130
);
131131
}
132+
133+
public debug() {
134+
console.log("'''''''''''''''''''''");
135+
console.log(this.getKey());
136+
console.log("--------------------");
137+
console.log("getChildren");
138+
console.log(JSON.stringify(this.getChildren(), null, 2));
139+
console.log("getGlobalComplexTokensWithRef");
140+
console.log(JSON.stringify(this.getGlobalComplexTokensWithRef(), null, 2));
141+
console.log("getGlobalComplexTokens");
142+
console.log(JSON.stringify(this.getGlobalComplexTokens(), null, 2));
143+
console.log("getGlobalStructComplexTokensWithRef");
144+
console.log(JSON.stringify(this.getGlobalStructComplexTokensWithRef(), null, 2));
145+
console.log("getGlobalStructComplexTokens");
146+
console.log(JSON.stringify(this.getGlobalStructComplexTokens(), null, 2));
147+
console.log("'''''''''''''''''''''");
148+
console.log("");
149+
}
132150
}

server/src/Documents/DocumentsCollection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,8 @@ export default class DocumentsCollection extends Dictionnary<string, Document> {
4949

5050
this.overwriteDocument(this.initializeDocument(document.uri, globalScope));
5151
}
52+
53+
public debug() {
54+
this.forEach((document) => document.debug());
55+
}
5256
}

server/src/ServerManager/ServerManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default class ServerManger {
8585
const filesCount = filesPath.length;
8686

8787
progressReporter.begin("Indexing files for NWScript: EE LSP ...", 0);
88-
const partCount = filesCount / numCPUs;
88+
const partCount = Math.ceil(filesCount / numCPUs);
8989
for (let i = 0; i < Math.min(numCPUs, filesCount); i++) {
9090
const worker = cluster.fork();
9191
worker.send(filesPath.slice(i * partCount, Math.min((i + 1) * partCount, filesCount - 1)).join(","));

server/src/Utils/Dictionnary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export default class Dictionnary<K extends string, V> {
2828
}
2929

3030
public debug() {
31-
console.log(JSON.stringify(Object.keys(this._dict)));
31+
console.log(JSON.stringify(Object.keys(this._dict), null, 2));
3232
}
3333
}

0 commit comments

Comments
 (0)