Fix JavaScript sourcemap paths to show full file locations Implement --build-debug flag and complete Build UI streaming Add xterm.js terminal UI and fix asset path routing Add RSpade Build UI service with WebSocket support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
219 lines
9.4 KiB
JavaScript
Executable File
219 lines
9.4 KiB
JavaScript
Executable File
"use strict";
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
}
|
|
Object.defineProperty(o, k2, desc);
|
|
}) : (function(o, m, k, k2) {
|
|
if (k2 === undefined) k2 = k;
|
|
o[k2] = m[k];
|
|
}));
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
}) : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = (this && this.__importStar) || (function () {
|
|
var ownKeys = function(o) {
|
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
var ar = [];
|
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
return ar;
|
|
};
|
|
return ownKeys(o);
|
|
};
|
|
return function (mod) {
|
|
if (mod && mod.__esModule) return mod;
|
|
var result = {};
|
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
})();
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
});
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.JqhtmlComponentIndex = void 0;
|
|
const vscode = __importStar(require("vscode"));
|
|
const path = __importStar(require("path"));
|
|
/**
|
|
* JQHTML Component Indexer
|
|
*
|
|
* Maintains an index of all JQHTML component definitions in the workspace
|
|
* for fast lookup during goto definition operations.
|
|
*/
|
|
class JqhtmlComponentIndex {
|
|
constructor() {
|
|
this.componentMap = new Map();
|
|
// Start initial indexing
|
|
this.reindexWorkspace();
|
|
// Watch for changes to .jqhtml files
|
|
this.setupFileWatcher();
|
|
}
|
|
/**
|
|
* Set up file system watcher for .jqhtml files
|
|
*/
|
|
setupFileWatcher() {
|
|
this.fileWatcher = vscode.workspace.createFileSystemWatcher('**/*.jqhtml');
|
|
// Re-index when files are created, changed, or deleted
|
|
this.fileWatcher.onDidCreate(uri => this.indexFile(uri));
|
|
this.fileWatcher.onDidChange(uri => this.indexFile(uri));
|
|
this.fileWatcher.onDidDelete(uri => this.removeFileFromIndex(uri));
|
|
}
|
|
/**
|
|
* Re-index all .jqhtml files in the workspace
|
|
*/
|
|
reindexWorkspace() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
// Avoid multiple concurrent reindexing
|
|
if (this.indexPromise) {
|
|
return this.indexPromise;
|
|
}
|
|
this.indexPromise = this._reindexWorkspace();
|
|
yield this.indexPromise;
|
|
this.indexPromise = undefined;
|
|
});
|
|
}
|
|
_reindexWorkspace() {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
console.log('JQHTML: Starting workspace component indexing...');
|
|
this.componentMap.clear();
|
|
const workspaceFolders = vscode.workspace.workspaceFolders;
|
|
if (!workspaceFolders) {
|
|
console.log('JQHTML: No workspace folders found');
|
|
return;
|
|
}
|
|
// Search each workspace folder explicitly for multi-root workspace support
|
|
const allFiles = [];
|
|
for (const folder of workspaceFolders) {
|
|
const files = yield vscode.workspace.findFiles(new vscode.RelativePattern(folder, '**/*.jqhtml'), new vscode.RelativePattern(folder, '**/node_modules/**'));
|
|
allFiles.push(...files);
|
|
}
|
|
// Index each file
|
|
const promises = allFiles.map(uri => this.indexFile(uri));
|
|
yield Promise.all(promises);
|
|
console.log(`JQHTML: Indexed ${this.componentMap.size} components from ${allFiles.length} files`);
|
|
});
|
|
}
|
|
/**
|
|
* Index a single .jqhtml file
|
|
*/
|
|
indexFile(uri) {
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
try {
|
|
// Remove old entries from this file
|
|
this.removeFileFromIndex(uri);
|
|
// Read file content
|
|
const document = yield vscode.workspace.openTextDocument(uri);
|
|
const text = document.getText();
|
|
const lines = text.split('\n');
|
|
// Look for component definitions
|
|
// Pattern: <Define:ComponentName (followed by non-alphanumeric or end of tag)
|
|
//
|
|
// DIAGNOSTIC HISTORY:
|
|
// - Issue: Component "Contacts_Datagrid" not found in index
|
|
// - This regex SHOULD match: <Define:Contacts_Datagrid...
|
|
// - Component name pattern: [A-Z][A-Za-z0-9_]* (starts uppercase, then alphanum+underscore)
|
|
// - Contacts_Datagrid matches this pattern
|
|
//
|
|
// POSSIBLE REASONS FOR MISSED COMPONENTS:
|
|
// 1. File not in workspace folders (check workspaceFolders in console)
|
|
// 2. File in node_modules (explicitly excluded line 75)
|
|
// 3. Syntax variations:
|
|
// - Extra whitespace: <Define: Contacts_Datagrid> (space after colon) ❌
|
|
// - Wrong case: <define:Contacts_Datagrid> (lowercase 'define') ❌
|
|
// - Missing colon: <DefineContacts_Datagrid> ❌
|
|
// 4. Indexing hasn't completed yet (async operation)
|
|
// 5. File watcher didn't fire (check file modification timestamp)
|
|
//
|
|
// DEBUGGING STEPS:
|
|
// 1. Check console output "JQHTML: Indexed X components from Y files"
|
|
// 2. Check console log when file is saved (should trigger onDidChange)
|
|
// 3. Manually reload VS Code window to force reindex
|
|
// 4. Check if file path contains "node_modules"
|
|
const definePattern = /<Define:([A-Z][A-Za-z0-9_]*)(?:[^\w]|>|$)/g;
|
|
for (let lineNum = 0; lineNum < lines.length; lineNum++) {
|
|
const line = lines[lineNum];
|
|
let match;
|
|
// Reset regex for each line
|
|
definePattern.lastIndex = 0;
|
|
while ((match = definePattern.exec(line)) !== null) {
|
|
const componentName = match[1];
|
|
const charPos = match.index + '<Define:'.length;
|
|
// Store component definition
|
|
this.componentMap.set(componentName, {
|
|
name: componentName,
|
|
uri: uri,
|
|
position: new vscode.Position(lineNum, charPos),
|
|
line: line.trim()
|
|
});
|
|
// Debug: Log each component as it's indexed
|
|
console.log(`JQHTML Index: Indexed "${componentName}" from ${path.basename(uri.fsPath)}:${lineNum + 1}`);
|
|
}
|
|
}
|
|
}
|
|
catch (error) {
|
|
console.error(`JQHTML: Error indexing file ${uri.fsPath}:`, error);
|
|
}
|
|
});
|
|
}
|
|
/**
|
|
* Remove all components from a file from the index
|
|
*/
|
|
removeFileFromIndex(uri) {
|
|
// Remove all components defined in this file
|
|
const toRemove = [];
|
|
this.componentMap.forEach((def, name) => {
|
|
if (def.uri.toString() === uri.toString()) {
|
|
toRemove.push(name);
|
|
}
|
|
});
|
|
// Verbose logging commented out to reduce console noise
|
|
// if (toRemove.length > 0) {
|
|
// console.log(`JQHTML Index: Removing ${toRemove.length} component(s) from deleted file: ${uri.fsPath}`);
|
|
// console.log(`JQHTML Index: Components removed: ${toRemove.join(', ')}`);
|
|
// }
|
|
toRemove.forEach(name => {
|
|
this.componentMap.delete(name);
|
|
});
|
|
// console.log(`JQHTML Index: Current index size after removal: ${this.componentMap.size} components`);
|
|
}
|
|
/**
|
|
* Find a component definition by name
|
|
*/
|
|
findComponent(name) {
|
|
return this.componentMap.get(name);
|
|
}
|
|
/**
|
|
* Get all component names (for autocomplete)
|
|
*/
|
|
getAllComponentNames() {
|
|
return Array.from(this.componentMap.keys());
|
|
}
|
|
/**
|
|
* Check if a string is a component reference (starts with capital letter)
|
|
*/
|
|
static isComponentReference(tagName) {
|
|
return /^[A-Z]/.test(tagName);
|
|
}
|
|
/**
|
|
* Dispose of resources
|
|
*/
|
|
dispose() {
|
|
if (this.fileWatcher) {
|
|
this.fileWatcher.dispose();
|
|
}
|
|
this.componentMap.clear();
|
|
}
|
|
}
|
|
exports.JqhtmlComponentIndex = JqhtmlComponentIndex;
|
|
//# sourceMappingURL=componentIndex.js.map
|