@jpoly1219/context-extractor 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/app.js +2 -1
- package/dist/src/runner.js +10 -1
- package/dist/src/typescript-driver.js +13 -2
- package/package.json +2 -2
package/dist/src/app.js
CHANGED
|
@@ -125,7 +125,7 @@ class App {
|
|
|
125
125
|
else if (this.language === types_1.Language.OCaml) {
|
|
126
126
|
relevantTypes.delete("_");
|
|
127
127
|
}
|
|
128
|
-
console.log(
|
|
128
|
+
// console.log(relevantTypes)
|
|
129
129
|
let repo = [];
|
|
130
130
|
if (this.language === types_1.Language.TypeScript) {
|
|
131
131
|
repo = (0, utils_1.getAllTSFiles)(this.repoPath);
|
|
@@ -134,6 +134,7 @@ class App {
|
|
|
134
134
|
repo = (0, utils_1.getAllOCamlFiles)(this.repoPath);
|
|
135
135
|
}
|
|
136
136
|
const relevantHeaders = await this.languageDriver.extractRelevantHeaders(this.lspClient, repo, relevantTypes, holeContext.functionTypeSpan);
|
|
137
|
+
// console.log(relevantHeaders)
|
|
137
138
|
// Postprocess the map.
|
|
138
139
|
if (this.language === types_1.Language.TypeScript) {
|
|
139
140
|
relevantTypes.delete("");
|
package/dist/src/runner.js
CHANGED
|
@@ -9,7 +9,16 @@ const types_1 = require("./types");
|
|
|
9
9
|
// extract("/home/jacob/projects/context-extractor/targets/emojipaint/sketch.ts").then(r => console.log("emojipaint\n", r));
|
|
10
10
|
(async () => {
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
let x;
|
|
13
|
+
x = await (0, main_1.extractContext)(types_1.Language.TypeScript, "/home/jacob/projects/context-extractor/targets/todo/sketch.ts", "/home/jacob/projects/context-extractor/targets/todo/");
|
|
14
|
+
console.dir(x, { depth: null });
|
|
15
|
+
x = await (0, main_1.extractContext)(types_1.Language.TypeScript, "/home/jacob/projects/context-extractor/targets/playlist/sketch.ts", "/home/jacob/projects/context-extractor/targets/playlist/");
|
|
16
|
+
console.dir(x, { depth: null });
|
|
17
|
+
x = await (0, main_1.extractContext)(types_1.Language.TypeScript, "/home/jacob/projects/context-extractor/targets/passwords/sketch.ts", "/home/jacob/projects/context-extractor/targets/passwords/");
|
|
18
|
+
console.dir(x, { depth: null });
|
|
19
|
+
x = await (0, main_1.extractContext)(types_1.Language.TypeScript, "/home/jacob/projects/context-extractor/targets/booking/sketch.ts", "/home/jacob/projects/context-extractor/targets/booking/");
|
|
20
|
+
console.dir(x, { depth: null });
|
|
21
|
+
x = await (0, main_1.extractContext)(types_1.Language.TypeScript, "/home/jacob/projects/context-extractor/targets/emojipaint/sketch.ts", "/home/jacob/projects/context-extractor/targets/emojipaint/");
|
|
13
22
|
console.dir(x, { depth: null });
|
|
14
23
|
// const y = await completeWithLLM(
|
|
15
24
|
// x!,
|
|
@@ -390,9 +390,15 @@ class TypeScriptDriver {
|
|
|
390
390
|
normalize(typeSpan, relevantTypes) {
|
|
391
391
|
// NOTE: BUGFIX
|
|
392
392
|
// console.log(`normalize: ${typeSpan}`)
|
|
393
|
+
// console.log(`normalize: ${typeSpan}`)
|
|
394
|
+
// console.log(`normalize: ${typeSpan == undefined}`)
|
|
393
395
|
if (typeSpan.slice(typeSpan.length - 2) == " =") {
|
|
394
|
-
typeSpan = typeSpan.slice(typeSpan.length - 2);
|
|
396
|
+
typeSpan = typeSpan.slice(0, typeSpan.length - 2);
|
|
397
|
+
}
|
|
398
|
+
if (typeSpan.slice(typeSpan.length - 1) == ";") {
|
|
399
|
+
typeSpan = typeSpan.slice(0, typeSpan.length - 1);
|
|
395
400
|
}
|
|
401
|
+
// console.log(typeSpan)
|
|
396
402
|
let normalForm = "";
|
|
397
403
|
// pattern matching for typeSpan
|
|
398
404
|
if (this.typeChecker.isPrimitive(typeSpan)) {
|
|
@@ -462,9 +468,14 @@ class TypeScriptDriver {
|
|
|
462
468
|
normalize2(typeSpan, relevantTypes) {
|
|
463
469
|
// NOTE: BUGFIX
|
|
464
470
|
// console.log(`normalize: ${typeSpan}`)
|
|
471
|
+
// console.log(`normalize: ${typeSpan == undefined}`)
|
|
465
472
|
if (typeSpan.slice(typeSpan.length - 2) == " =") {
|
|
466
|
-
typeSpan = typeSpan.slice(typeSpan.length - 2);
|
|
473
|
+
typeSpan = typeSpan.slice(0, typeSpan.length - 2);
|
|
474
|
+
}
|
|
475
|
+
if (typeSpan.slice(typeSpan.length - 1) == ";") {
|
|
476
|
+
typeSpan = typeSpan.slice(0, typeSpan.length - 1);
|
|
467
477
|
}
|
|
478
|
+
// console.log(typeSpan)
|
|
468
479
|
let normalForm = "";
|
|
469
480
|
const analysisResult = this.typeChecker.analyzeTypeString(typeSpan);
|
|
470
481
|
// pattern matching for typeSpan
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpoly1219/context-extractor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Extract relevant context from an incomplete program sketch.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dist/"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "npx tsc && npm run copy-deps",
|
|
15
|
+
"build": "rm -rf dist/ && npx tsc && npm run copy-deps",
|
|
16
16
|
"copy-deps": "npm run copy-lsp-client && npm run copy-ocaml",
|
|
17
17
|
"copy-lsp-client": "shx cp -r ts-lsp-client-dist dist/",
|
|
18
18
|
"copy-ocaml": "shx mkdir -p dist/src/ocaml-utils/ && shx cp -r src/ocaml-utils/_build dist/src/ocaml-utils/_build/",
|