Skip to content

Commit 35fa916

Browse files
committed
Merge and resolve conflicts
1 parent 250c29c commit 35fa916

File tree

2,609 files changed

+154600
-0
lines changed

Some content is hidden

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

2,609 files changed

+154600
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
const { TextDocument } = require('vscode-languageserver-textdocument');
2+
const { createConnection, TextDocuments, ProposedFeatures } = require('vscode-languageserver/node');
3+
const ts = require('typescript');
4+
const fs = require('fs/promises');
5+
const path = require('path');
6+
7+
async function decoupleFile(inputFilePath) {
8+
// Read the source file
9+
const sourceCode = await fs.readFile(inputFilePath, 'utf-8');
10+
11+
// Create output directory
12+
const outputDir = path.join(path.dirname(inputFilePath), 'decoupled');
13+
await fs.mkdir(outputDir, { recursive: true });
14+
15+
// Parse the source file
16+
const sourceFile = ts.createSourceFile(
17+
inputFilePath,
18+
sourceCode,
19+
ts.ScriptTarget.Latest,
20+
true
21+
);
22+
23+
// Store different sections
24+
const sections = new Map();
25+
26+
// Visit nodes and collect classes and major sections
27+
function visit(node) {
28+
if (ts.isClassDeclaration(node) && node.name) {
29+
// Handle classes
30+
const className = node.name.text;
31+
const classCode = sourceCode.substring(node.pos, node.end);
32+
sections.set(`${className}.js`, classCode);
33+
}
34+
else if (ts.isFunctionDeclaration(node) && node.name) {
35+
// Handle named functions
36+
const functionName = node.name.text;
37+
const functionCode = sourceCode.substring(node.pos, node.end);
38+
sections.set(`${functionName}.js`, functionCode);
39+
}
40+
else if (ts.isVariableStatement(node)) {
41+
// Handle major variable declarations
42+
const declarations = node.declarationList.declarations;
43+
for (const decl of declarations) {
44+
if (decl.name && ts.isIdentifier(decl.name)) {
45+
const varName = decl.name.text;
46+
const varCode = sourceCode.substring(node.pos, node.end);
47+
sections.set(`${varName}.js`, varCode);
48+
}
49+
}
50+
}
51+
52+
ts.forEachChild(node, visit);
53+
}
54+
55+
// Start the visitor pattern
56+
visit(sourceFile);
57+
58+
// Create index.js to re-export everything
59+
let indexContent = '';
60+
61+
// Write sections to files
62+
for (const [filename, content] of sections) {
63+
const filePath = path.join(outputDir, filename);
64+
await fs.writeFile(filePath, content);
65+
66+
// Add to index.js
67+
const moduleName = path.basename(filename, '.js');
68+
indexContent += `const { ${moduleName} } = require('./${filename}');\n`;
69+
}
70+
71+
// Export all modules in index.js
72+
indexContent += '\nmodule.exports = {\n';
73+
for (const [filename] of sections) {
74+
const moduleName = path.basename(filename, '.js');
75+
indexContent += ` ${moduleName},\n`;
76+
}
77+
indexContent += '};\n';
78+
79+
await fs.writeFile(path.join(outputDir, 'index.js'), indexContent);
80+
81+
// Create package.json
82+
const packageJson = {
83+
name: "decoupled-extension",
84+
version: "1.0.0",
85+
description: "Decoupled version of extension.js",
86+
main: "index.js",
87+
dependencies: {
88+
"vscode-languageserver": "^8.0.0",
89+
"vscode-languageserver-textdocument": "^1.0.8",
90+
"typescript": "^4.9.0"
91+
}
92+
};
93+
94+
await fs.writeFile(
95+
path.join(outputDir, 'package.json'),
96+
JSON.stringify(packageJson, null, 2)
97+
);
98+
}
99+
100+
// Function to analyze code sections using LSP
101+
async function analyzeSections(document) {
102+
const connection = createConnection(ProposedFeatures.all);
103+
const documents = new TextDocuments(TextDocument);
104+
105+
documents.listen(connection);
106+
connection.listen();
107+
108+
// Add LSP-specific analysis here if needed
109+
// This can be extended to use LSP features for better code understanding
110+
}
111+
112+
// Main execution
113+
async function main() {
114+
const inputFile = process.argv[2] || 'extension.js';
115+
116+
try {
117+
await decoupleFile(inputFile);
118+
console.log('Successfully decoupled the file into separate modules!');
119+
} catch (error) {
120+
console.error('Error decoupling file:', error);
121+
}
122+
}
123+
124+
main();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
var Hke = k$(),
3+
$$ = gd(),
4+
Wke = G$(),
5+
Y$ = NaN,
6+
Gke = /^[-+]0x[0-9a-f]+$/i,
7+
$ke = /^0b[01]+$/i,
8+
Yke = /^0o[0-7]+$/i,
9+
Kke = parseInt

extension-decoupler/decoupled/$.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
var Zae = Yt(),
3+
Xae = jae(),
4+
$ = (tle.exports = Zae.util = Zae.util || {})
5+
;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
var Fe = G0.asn1,
3+
$0 = (sce.exports = G0.pkcs7asn1 = G0.pkcs7asn1 || {})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
var $0e = Ws(),
3+
Zdt = (e, t, r) => {
4+
let n = new $0e(e, r),
5+
i = new $0e(t, r)
6+
return n.compare(i) || n.compareBuild(i)
7+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
var $0t = 2e3,
3+
S1 = class extends z {
4+
constructor(r, n, i, s, o) {
5+
super()
6+
this._completionsModel = r
7+
this._config = s
8+
this._timelineReporter = o
9+
;(this._pendingCompletions = new w1(n)),
10+
(this._stateController = new yA(i)),
11+
this.addDisposable(this._pendingCompletions),
12+
this.addDisposable(this._deletedCompletions),
13+
this.addDisposable(
14+
Xh.window.onDidChangeTextEditorSelection((a) => {
15+
a.textEditor.document.uri.scheme === "file" && uf(!1)
16+
}),
17+
)
18+
}
19+
_logger = X("InlineCompletionProvider")
20+
_pendingCompletions
21+
_deletedCompletions = new I1()
22+
_stateController
23+
async provideInlineCompletionItems(r, n, i, s) {
24+
let o = new _1()
25+
if (
26+
!this._config.config.completions.enableAutomaticCompletions &&
27+
i.triggerKind === Xh.InlineCompletionTriggerKind.Automatic
28+
)
29+
return uf(!1), []
30+
this._stateController.dispose(),
31+
this._logger.debug(
32+
`Inline Request - ${r.uri.toString()} ${Zh(r, n)}${v1(" ", i.selectedCompletionInfo?.text)}`,
33+
),
34+
this._logger.verbose(Dxe(r, i))
35+
let a = await this._getCompletions(r, n, i, o),
36+
l = this._deletedCompletions.processRequest(a)
37+
if (s.isCancellationRequested) return this._logger.debug("Completion cancelled"), pxe(), uf(!1), []
38+
if ((gxe(l), !l)) return this._logger.debug("Returning no completions"), uf(!1), []
39+
;(o.emitTime = Date.now()), l.isReused || this._timelineReporter.reportCompletionTimeline(l.requestId, o)
40+
let c = l.completions.map((u) => {
41+
this._logger.verbose(`AugmentCompletion: ${u.toString()}`)
42+
let f = new Xh.InlineCompletionItem(
43+
u.completionText + u.suffixReplacementText,
44+
new Xh.Range(
45+
r.positionAt(u.range.startOffset),
46+
r.positionAt(u.range.endOffset + u.skippedSuffix.length),
47+
),
48+
)
49+
return (
50+
this._logger.verbose(`InlineCompletionItem: ${JSON.stringify(f.insertText)} ${AC(r, f.range)}`), f
51+
)
52+
})
53+
return c.length > 0 && uf(!0), c
54+
}
55+
async _getCompletions(r, n, i, s) {
56+
let o = this._pendingCompletions.getPendingCompletion(r, n)
57+
if (o && o.completions.length > 0) {
58+
let l = this._processCompletionForMode(o, i)
59+
return this._logger.debug(`Returning ${l.length} completions`), { ...o, completions: l }
60+
}
61+
if (i.selectedCompletionInfo?.text) {
62+
this._logger.debug(
63+
"Returning no completions because the provider request includes selected text that does not match an Augment suggestion",
64+
)
65+
return
66+
}
67+
let a = this._stateController.setState($xe)
68+
try {
69+
let l = await this._completionsModel.generateCompletion(r, n, s)
70+
if (l && l.completions.length === 0) {
71+
let c = this._stateController.setState(Yxe)
72+
setTimeout(() => {
73+
c.dispose()
74+
}, $0t)
75+
}
76+
return l
77+
} catch (l) {
78+
l instanceof bh || this._stateController.setState(Gxe)
79+
} finally {
80+
a.dispose()
81+
}
82+
}
83+
_processCompletionForMode(r, n) {
84+
if (!n.selectedCompletionInfo || !n.selectedCompletionInfo.text) return r.completions
85+
let i = n.selectedCompletionInfo.range.start
86+
return r.completions.map((o) => C1(r, o, i))
87+
}
88+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
var $1 = class e extends Zn {
3+
constructor(r, n, i, s) {
4+
super("NextEditResolutionReporter", n ?? e.defaultMaxRecords, i ?? e.defaultUploadMsec, s ?? e.defaultBatchSize)
5+
this._apiServer = r
6+
}
7+
static defaultMaxRecords = 1e4
8+
static defaultBatchSize = 1e3
9+
static defaultUploadMsec = 1e4
10+
reportResolution(r, n, i, s) {
11+
let [o, a] = kn(n),
12+
[l, c] = kn(i)
13+
this.report({
14+
request_id: r,
15+
emit_time_sec: o,
16+
emit_time_nsec: a,
17+
resolve_time_sec: l,
18+
resolve_time_nsec: c,
19+
is_accepted: s,
20+
})
21+
}
22+
performUpload(r) {
23+
return this._apiServer.resolveNextEdits(r)
24+
}
25+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
function $1e(e) {
3+
if (e === null) return !0
4+
var t = e.length
5+
return (t === 1 && e === "~") || (t === 4 && (e === "null" || e === "Null" || e === "NULL"))
6+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
function $2(d, h, A) {
3+
var E = $i(h),
4+
S = qw(h, E)
5+
A == null &&
6+
!(Un(h) && (S.length || !E.length)) &&
7+
((A = h), (h = d), (d = this), (S = qw(h, $i(h))))
8+
var P = !(Un(A) && "chain" in A) || !!A.chain,
9+
U = ud(d)
10+
return (
11+
ds(S, function (H) {
12+
var Z = h[H]
13+
;(d[H] = Z),
14+
U &&
15+
(d.prototype[H] = function () {
16+
var ce = this.__chain__
17+
if (P || ce) {
18+
var ue = d(this.__wrapped__),
19+
Ae = (ue.__actions__ = wo(this.__actions__))
20+
return (
21+
Ae.push({ func: Z, args: arguments, thisArg: d }),
22+
(ue.__chain__ = ce),
23+
ue
24+
)
25+
}
26+
return Z.apply(d, js([this.value()], arguments))
27+
})
28+
}),
29+
d
30+
)
31+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
var W2e = /^[_:A-Za-z][-.:\w]+$/,
3+
G2e = /^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/,
4+
Kv =
5+
"_A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",
6+
Jv =
7+
"-._A-Za-z0-9\xB7\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",
8+
Jg = "[" + Kv + "][" + Jv + "]*",
9+
dL = Kv + ":",
10+
fL = Jv + ":",
11+
$2e = new RegExp("^[" + dL + "][" + fL + "]*$"),
12+
Y2e = new RegExp("^(" + Jg + "|" + Jg + ":" + Jg + ")$"),
13+
bJ = /[\uD800-\uDB7F\uDC00-\uDFFF]/,
14+
xJ = /[\uD800-\uDB7F\uDC00-\uDFFF]/g,
15+
_J = /[\uD800-\uDB7F][\uDC00-\uDFFF]/g

0 commit comments

Comments
 (0)