Fix unimplemented login route with # prefix
Fix IDE service routing and path normalization Refactor IDE services and add session rotation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -997,6 +997,11 @@ class Debugger
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't output if suppressed (e.g., for IDE service requests)
|
||||||
|
if (defined('SUPPRESS_CONSOLE_DEBUG_OUTPUT') && SUPPRESS_CONSOLE_DEBUG_OUTPUT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't output if console HTML is disabled (e.g., for AJAX requests)
|
// Don't output if console HTML is disabled (e.g., for AJAX requests)
|
||||||
if (static::$console_html_disabled) {
|
if (static::$console_html_disabled) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
namespace App\RSpade\Core\Providers;
|
namespace App\RSpade\Core\Providers;
|
||||||
|
|
||||||
use Blade;
|
use Blade;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Log;
|
use Log;
|
||||||
@@ -297,6 +298,13 @@ class Rsx_Framework_Provider extends ServiceProvider
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register Request helper macros
|
||||||
|
if (!Request::hasMacro('is_post')) {
|
||||||
|
Request::macro('is_post', function () {
|
||||||
|
return $this->isMethod('post');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Handle IDE integration domain auto-discovery
|
// Handle IDE integration domain auto-discovery
|
||||||
$this->handle_ide_domain_discovery();
|
$this->handle_ide_domain_discovery();
|
||||||
}
|
}
|
||||||
|
|||||||
193
app/RSpade/Ide/Services/auth.php
Executable file
193
app/RSpade/Ide/Services/auth.php
Executable file
@@ -0,0 +1,193 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* IDE Service Authentication
|
||||||
|
*
|
||||||
|
* SECURITY-CRITICAL: This file must be executed BEFORE any IDE service logic.
|
||||||
|
* All /_ide/service/* requests must pass through this authentication check.
|
||||||
|
*
|
||||||
|
* Two authentication modes:
|
||||||
|
* 1. Session-based auth with signature verification (production/remote)
|
||||||
|
* 2. Localhost bypass (development only, strict requirements)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Base path - framework is in system/ subdirectory
|
||||||
|
// @REALPATH-EXCEPTION - Bootstrap file: runs before helpers loaded, needs PHP's realpath()
|
||||||
|
$system_path = realpath(__DIR__ . '/../../../..');
|
||||||
|
// @REALPATH-EXCEPTION - Bootstrap file: runs before helpers loaded, needs PHP's realpath()
|
||||||
|
define('IDE_AUTH_BASE_PATH', realpath($system_path . '/..')); // Project root
|
||||||
|
define('IDE_AUTH_SYSTEM_PATH', $system_path); // Framework root
|
||||||
|
|
||||||
|
// Helper to get framework paths
|
||||||
|
function ide_auth_framework_path($relative_path) {
|
||||||
|
return IDE_AUTH_SYSTEM_PATH . '/' . ltrim($relative_path, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSON response helper
|
||||||
|
function ide_auth_json_response($data, $code = 200) {
|
||||||
|
http_response_code($code);
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($data);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error response helper
|
||||||
|
function ide_auth_error_response($message, $code = 400) {
|
||||||
|
ide_auth_json_response(['success' => false, 'error' => $message], $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if IDE services are enabled
|
||||||
|
$env_file = IDE_AUTH_BASE_PATH . '/.env';
|
||||||
|
if (file_exists($env_file)) {
|
||||||
|
$env_content = file_get_contents($env_file);
|
||||||
|
// Check if production
|
||||||
|
if (preg_match('/^APP_ENV=production$/m', $env_content)) {
|
||||||
|
// Check if explicitly enabled in production
|
||||||
|
if (!preg_match('/^RSX_IDE_SERVICES_ENABLED=true$/m', $env_content)) {
|
||||||
|
ide_auth_error_response('IDE services disabled in production', 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse request URI to get service
|
||||||
|
$request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||||
|
$service_path = str_replace('/_ide/service', '', $request_uri);
|
||||||
|
$service_path = trim($service_path, '/');
|
||||||
|
|
||||||
|
// Get request body for signature verification
|
||||||
|
$request_body = file_get_contents('php://input');
|
||||||
|
|
||||||
|
// Handle authentication
|
||||||
|
$auth_data = [];
|
||||||
|
$session_header = $_SERVER['HTTP_X_SESSION'] ?? null;
|
||||||
|
$signature_header = $_SERVER['HTTP_X_SIGNATURE'] ?? null;
|
||||||
|
|
||||||
|
// Check if this is auth/create request (no auth required for session creation)
|
||||||
|
if ($service_path === 'auth/create' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
// Generate new auth session
|
||||||
|
$session = bin2hex(random_bytes(20));
|
||||||
|
$client_key = bin2hex(random_bytes(20));
|
||||||
|
$server_key = bin2hex(random_bytes(20));
|
||||||
|
|
||||||
|
$auth_data_new = [
|
||||||
|
'session' => $session,
|
||||||
|
'client_key' => $client_key,
|
||||||
|
'server_key' => $server_key,
|
||||||
|
'created' => time()
|
||||||
|
];
|
||||||
|
|
||||||
|
// Save auth file
|
||||||
|
$bridge_dir = ide_auth_framework_path('storage/rsx-ide-bridge');
|
||||||
|
if (!is_dir($bridge_dir)) {
|
||||||
|
mkdir($bridge_dir, 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rotate old sessions - keep max 100 auth files
|
||||||
|
$auth_files = glob($bridge_dir . '/auth-*.json');
|
||||||
|
if (count($auth_files) >= 100) {
|
||||||
|
// Sort by modification time (oldest first)
|
||||||
|
usort($auth_files, function($a, $b) {
|
||||||
|
return filemtime($a) - filemtime($b);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete oldest files to get down to 99 (so we can add the new one)
|
||||||
|
$files_to_delete = count($auth_files) - 99;
|
||||||
|
for ($i = 0; $i < $files_to_delete; $i++) {
|
||||||
|
unlink($auth_files[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$auth_file = $bridge_dir . '/auth-' . $session . '.json';
|
||||||
|
file_put_contents($auth_file, json_encode($auth_data_new, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
// Return auth data (unsigned response since client doesn't have keys yet)
|
||||||
|
http_response_code(200);
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode([
|
||||||
|
'success' => true,
|
||||||
|
'session' => $session,
|
||||||
|
'client_key' => $client_key,
|
||||||
|
'server_key' => $server_key
|
||||||
|
]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication required for all other requests
|
||||||
|
// Handle authentication with localhost bypass
|
||||||
|
|
||||||
|
// Localhost bypass for IDE integration
|
||||||
|
$is_localhost_bypass = false;
|
||||||
|
$request_host = $_SERVER['HTTP_HOST'] ?? '';
|
||||||
|
$request_scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||||
|
$remote_addr = $_SERVER['REMOTE_ADDR'] ?? '';
|
||||||
|
|
||||||
|
// Check for proxy headers
|
||||||
|
$has_proxy_headers = false;
|
||||||
|
foreach ($_SERVER as $key => $value) {
|
||||||
|
if (str_starts_with($key, 'HTTP_X_')) {
|
||||||
|
if ($key === 'HTTP_X_SESSION' || $key === 'HTTP_X_SIGNATURE') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$has_proxy_headers = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if request is from loopback
|
||||||
|
$is_loopback_ip = (
|
||||||
|
!$has_proxy_headers &&
|
||||||
|
($remote_addr === '127.0.0.1' ||
|
||||||
|
$remote_addr === '::1' ||
|
||||||
|
str_starts_with($remote_addr, '127.'))
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if not in production
|
||||||
|
$is_not_production = true;
|
||||||
|
if (file_exists($env_file)) {
|
||||||
|
$env_content = file_get_contents($env_file);
|
||||||
|
if (preg_match('/^APP_ENV=production$/m', $env_content)) {
|
||||||
|
$is_not_production = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// All conditions must be true for bypass
|
||||||
|
if (
|
||||||
|
$request_host === 'localhost' &&
|
||||||
|
$request_scheme === 'http' &&
|
||||||
|
$is_loopback_ip &&
|
||||||
|
$is_not_production
|
||||||
|
) {
|
||||||
|
$is_localhost_bypass = true;
|
||||||
|
$auth_data = [
|
||||||
|
'session' => 'localhost-bypass',
|
||||||
|
'client_key' => '',
|
||||||
|
'server_key' => ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_localhost_bypass) {
|
||||||
|
// Require authentication for non-localhost
|
||||||
|
if (!$session_header || !$signature_header) {
|
||||||
|
ide_auth_error_response('Authentication required', 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load and validate session
|
||||||
|
$auth_file = ide_auth_framework_path('storage/rsx-ide-bridge/auth-' . $session_header . '.json');
|
||||||
|
if (!file_exists($auth_file)) {
|
||||||
|
ide_auth_error_response('Session not found', 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$auth_data = json_decode(file_get_contents($auth_file), true);
|
||||||
|
$expected_signature = sha1($request_body . $auth_data['client_key']);
|
||||||
|
if ($signature_header !== $expected_signature) {
|
||||||
|
ide_auth_error_response('Invalid signature', 401);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication passed - store auth data for handlers to use if needed
|
||||||
|
define('IDE_AUTH_PASSED', true);
|
||||||
|
define('IDE_AUTH_DATA', json_encode($auth_data));
|
||||||
|
define('IDE_AUTH_IS_LOCALHOST_BYPASS', $is_localhost_bypass);
|
||||||
|
|
||||||
|
// Suppress console_debug output for IDE service requests
|
||||||
|
// These are programmatic API calls, not user-facing pages
|
||||||
|
define('SUPPRESS_CONSOLE_DEBUG_OUTPUT', true);
|
||||||
File diff suppressed because it is too large
Load Diff
192
app/RSpade/Ide/Services/laravel_handler.php
Executable file
192
app/RSpade/Ide/Services/laravel_handler.php
Executable file
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* IDE Service Handler (Laravel-based)
|
||||||
|
*
|
||||||
|
* Handles all IDE service requests that require Laravel/Manifest access.
|
||||||
|
* Format-only services use the standalone handler.php instead.
|
||||||
|
*
|
||||||
|
* This handler bootstraps Laravel to access Manifest functions directly,
|
||||||
|
* eliminating duplicate logic and ensuring single source of truth.
|
||||||
|
*
|
||||||
|
* Authentication: Same localhost bypass logic as standalone handler
|
||||||
|
* See handler.php for authentication documentation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Error reporting for development
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
// Base path - framework is in system/ subdirectory
|
||||||
|
// @REALPATH-EXCEPTION - Bootstrap file: runs before helpers loaded, needs PHP's realpath()
|
||||||
|
$system_path = realpath(__DIR__ . '/../../../..');
|
||||||
|
// @REALPATH-EXCEPTION - Bootstrap file: runs before helpers loaded, needs PHP's realpath()
|
||||||
|
define('IDE_BASE_PATH', realpath($system_path . '/..')); // Project root
|
||||||
|
define('IDE_SYSTEM_PATH', $system_path); // Framework root
|
||||||
|
|
||||||
|
// Helper to get framework paths
|
||||||
|
function ide_framework_path($relative_path) {
|
||||||
|
return IDE_SYSTEM_PATH . '/' . ltrim($relative_path, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bootstrap Laravel
|
||||||
|
require_once IDE_SYSTEM_PATH . '/vendor/autoload.php';
|
||||||
|
$app = require_once IDE_SYSTEM_PATH . '/bootstrap/app.php';
|
||||||
|
|
||||||
|
// We don't need to handle HTTP requests through Laravel's kernel
|
||||||
|
// Just boot the application so we can use Manifest
|
||||||
|
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||||
|
|
||||||
|
// JSON response helper
|
||||||
|
function json_response($data, $code = 200) {
|
||||||
|
http_response_code($code);
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($data);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error response helper
|
||||||
|
function error_response($message, $code = 400) {
|
||||||
|
json_response(['success' => false, 'error' => $message], $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authentication already handled by auth.php before this file is loaded
|
||||||
|
// Retrieve auth data from constants set by auth.php
|
||||||
|
if (!defined('IDE_AUTH_PASSED')) {
|
||||||
|
error_response('Authentication check did not run - this should never happen', 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
$auth_data = json_decode(IDE_AUTH_DATA, true);
|
||||||
|
|
||||||
|
// Parse request URI to get service
|
||||||
|
$request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||||
|
$service_path = str_replace('/_ide/service', '', $request_uri);
|
||||||
|
$service_path = trim($service_path, '/');
|
||||||
|
|
||||||
|
// Get request body
|
||||||
|
$request_body = file_get_contents('php://input');
|
||||||
|
$request_data = json_decode($request_body, true);
|
||||||
|
|
||||||
|
// Merge GET parameters (for backward compatibility)
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
|
$request_data = array_merge($request_data ?? [], $_GET);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route to appropriate service handler
|
||||||
|
// This handler provides Laravel-based services (can access Manifest, models, etc.)
|
||||||
|
// Format service is handled by handler.php (standalone, no Laravel)
|
||||||
|
switch ($service_path) {
|
||||||
|
case 'manifest_build':
|
||||||
|
handle_manifest_build_service($request_data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'js_is_subclass_of':
|
||||||
|
handle_js_is_subclass_of_service($request_data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'php_is_subclass_of':
|
||||||
|
handle_php_is_subclass_of_service($request_data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'resolve_class':
|
||||||
|
// TODO: Migrate from handler.php and refactor to use Manifest directly
|
||||||
|
error_response('Service not yet migrated to Laravel handler', 501);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'definition':
|
||||||
|
// TODO: Migrate from handler.php and refactor to use Manifest directly
|
||||||
|
error_response('Service not yet migrated to Laravel handler', 501);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'complete':
|
||||||
|
// TODO: Migrate from handler.php and refactor to use Manifest directly
|
||||||
|
error_response('Service not yet migrated to Laravel handler', 501);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'exec':
|
||||||
|
case 'command':
|
||||||
|
// TODO: Migrate from handler.php
|
||||||
|
error_response('Service not yet migrated to Laravel handler', 501);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// git and git/diff services are handled by handler.php (standalone, no Laravel needed)
|
||||||
|
|
||||||
|
case 'js_lineage':
|
||||||
|
// TODO: Migrate from handler.php - or remove if js_is_subclass_of replaces it
|
||||||
|
error_response('Service not yet migrated to Laravel handler', 501);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'resolve_url':
|
||||||
|
// TODO: Migrate from handler.php and refactor to use Manifest directly
|
||||||
|
error_response('Service not yet migrated to Laravel handler', 501);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'health':
|
||||||
|
json_response(['success' => true, 'service' => 'ide-laravel', 'version' => '1.0.0']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
error_response('Unknown service: ' . $service_path, 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle manifest_build service - trigger incremental manifest update
|
||||||
|
*
|
||||||
|
* Calls Manifest::init() which performs incremental update if needed.
|
||||||
|
* Does NOT clear the manifest, just updates changed files.
|
||||||
|
*/
|
||||||
|
function handle_manifest_build_service($data) {
|
||||||
|
try {
|
||||||
|
// Manifest::init() will do incremental update if needed
|
||||||
|
\App\RSpade\Core\Manifest\Manifest::init();
|
||||||
|
json_response(['success' => true]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Return error but VS Code extension will suppress user notification
|
||||||
|
json_response(['success' => false, 'error' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle js_is_subclass_of service - check if JS class extends another
|
||||||
|
*
|
||||||
|
* Direct RPC wrapper around Manifest::js_is_subclass_of()
|
||||||
|
*/
|
||||||
|
function handle_js_is_subclass_of_service($data) {
|
||||||
|
$subclass = $data['subclass'] ?? null;
|
||||||
|
$superclass = $data['superclass'] ?? null;
|
||||||
|
|
||||||
|
if (!$subclass || !$superclass) {
|
||||||
|
json_response([
|
||||||
|
'error' => 'Missing required parameters: subclass and superclass',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$is_subclass = \App\RSpade\Core\Manifest\Manifest::js_is_subclass_of($subclass, $superclass);
|
||||||
|
json_response(['is_subclass' => $is_subclass]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
error_response('Manifest error: ' . $e->getMessage(), 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle php_is_subclass_of service - check if PHP class extends another
|
||||||
|
*
|
||||||
|
* Direct RPC wrapper around Manifest::php_is_subclass_of()
|
||||||
|
*/
|
||||||
|
function handle_php_is_subclass_of_service($data) {
|
||||||
|
$subclass = $data['subclass'] ?? null;
|
||||||
|
$superclass = $data['superclass'] ?? null;
|
||||||
|
|
||||||
|
if (!$subclass || !$superclass) {
|
||||||
|
json_response([
|
||||||
|
'error' => 'Missing required parameters: subclass and superclass',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$is_subclass = \App\RSpade\Core\Manifest\Manifest::php_is_subclass_of($subclass, $superclass);
|
||||||
|
json_response(['is_subclass' => $is_subclass]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
error_response('Manifest error: ' . $e->getMessage(), 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ exports.AutoRenameProvider = void 0;
|
|||||||
const vscode = __importStar(require("vscode"));
|
const vscode = __importStar(require("vscode"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
|
const ide_bridge_client_1 = require("./ide_bridge_client");
|
||||||
/**
|
/**
|
||||||
* Provides automatic file renaming based on RSX naming conventions
|
* Provides automatic file renaming based on RSX naming conventions
|
||||||
*
|
*
|
||||||
@@ -43,6 +44,7 @@ class AutoRenameProvider {
|
|||||||
this.config_enabled = false;
|
this.config_enabled = false;
|
||||||
this.workspace_root = '';
|
this.workspace_root = '';
|
||||||
this.is_checking = false;
|
this.is_checking = false;
|
||||||
|
this.ide_bridge_client = null;
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
find_rspade_root() {
|
find_rspade_root() {
|
||||||
@@ -327,9 +329,24 @@ class AutoRenameProvider {
|
|||||||
return class_name.toLowerCase() + '.php';
|
return class_name.toLowerCase() + '.php';
|
||||||
}
|
}
|
||||||
async get_suggested_js_filename(file_path, class_name, content) {
|
async get_suggested_js_filename(file_path, class_name, content) {
|
||||||
// Check if this extends Jqhtml_Component
|
// Check if this extends Jqhtml_Component (directly or via inheritance)
|
||||||
const is_jqhtml = content.includes('extends Jqhtml_Component') ||
|
let is_jqhtml = content.includes('extends Jqhtml_Component');
|
||||||
content.match(/extends\s+[A-Za-z0-9_]+\s+extends Jqhtml_Component/);
|
// If not directly extending, check via API
|
||||||
|
if (!is_jqhtml && content.includes('extends ')) {
|
||||||
|
// Initialize IDE bridge client if needed
|
||||||
|
if (!this.ide_bridge_client) {
|
||||||
|
const output_channel = vscode.window.createOutputChannel('RSpade Auto Rename');
|
||||||
|
this.ide_bridge_client = new ide_bridge_client_1.IdeBridgeClient(output_channel);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await this.ide_bridge_client.js_is_subclass_of(class_name, 'Jqhtml_Component');
|
||||||
|
is_jqhtml = response.is_subclass || false;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// If API call fails, fall back to direct check only
|
||||||
|
console.log('[AutoRename] JS - Failed to check inheritance:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
console.log('[AutoRename] JS - Is Jqhtml_Component:', is_jqhtml);
|
console.log('[AutoRename] JS - Is Jqhtml_Component:', is_jqhtml);
|
||||||
const dir = path.dirname(file_path);
|
const dir = path.dirname(file_path);
|
||||||
const relative_dir = path.relative(this.workspace_root, dir);
|
const relative_dir = path.relative(this.workspace_root, dir);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,77 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
/**
|
||||||
|
* RSpade Definition Provider - "Go to Definition" for RSX Classes, Routes, and Components
|
||||||
|
*
|
||||||
|
* RESOLUTION TYPE PRIORITY MATRIX
|
||||||
|
* ================================
|
||||||
|
*
|
||||||
|
* This provider determines what to navigate to when you click "Go to Definition" on various
|
||||||
|
* identifiers across different file types. The resolution logic uses CSV type lists sent to
|
||||||
|
* the server endpoint `/_ide/service/resolve_class?type=X,Y,Z` which tries each type in order.
|
||||||
|
*
|
||||||
|
* FILE TYPE HANDLERS & RESOLUTION RULES:
|
||||||
|
*
|
||||||
|
* 1. ROUTE PATTERNS (all files)
|
||||||
|
* Pattern: Rsx::Route('Controller') or Rsx.Route('Controller', 'method')
|
||||||
|
* Type: 'php_class'
|
||||||
|
* Reason: Routes always point to PHP controllers (server-side)
|
||||||
|
*
|
||||||
|
* 2. HREF PATTERNS (Blade, jqhtml)
|
||||||
|
* Pattern: href="/"
|
||||||
|
* Type: 'php_class'
|
||||||
|
* Reason: Resolves URL to controller, always PHP
|
||||||
|
*
|
||||||
|
* 3. JQHTML EXTENDS ATTRIBUTE (jqhtml only)
|
||||||
|
* Pattern: <Define:My_Component extends="DataGrid_Abstract">
|
||||||
|
* Type: 'jqhtml_class,js_class'
|
||||||
|
* Reason: Component inheritance - try jqhtml component first, then JS class
|
||||||
|
*
|
||||||
|
* 4. JQHTML $xxx ATTRIBUTES (jqhtml only)
|
||||||
|
* Pattern: $data_source=Frontend_Controller.fetch_data
|
||||||
|
* Type: 'js_class,php_class'
|
||||||
|
* Reason: Try JS class first (for components), then PHP (for controllers/models)
|
||||||
|
*
|
||||||
|
* Pattern: $handler=this.on_click
|
||||||
|
* Type: 'jqhtml_class_method'
|
||||||
|
* Special: Resolves to current component's method
|
||||||
|
*
|
||||||
|
* 5. THIS REFERENCES (jqhtml only)
|
||||||
|
* Pattern: <%= this.data.users %>
|
||||||
|
* Type: 'jqhtml_class_method'
|
||||||
|
* Reason: Always current component's method/property
|
||||||
|
*
|
||||||
|
* 6. JAVASCRIPT CLASS REFERENCES (JS, jqhtml)
|
||||||
|
* Pattern: class My_Component extends DataGrid_Abstract
|
||||||
|
* Pattern: User_Controller.fetch_all()
|
||||||
|
* Type: 'js_class,php_class'
|
||||||
|
* Reason: Try JS first (component inheritance), then PHP (controllers/models)
|
||||||
|
* Note: JS stub files (auto-generated from PHP) are client-side only, not in manifest
|
||||||
|
*
|
||||||
|
* 7. PHP CLASS REFERENCES (PHP, Blade)
|
||||||
|
* Pattern: class Contacts_DataGrid extends DataGrid_Abstract
|
||||||
|
* Pattern: use Rsx\Lib\DataGrid_QueryBuilder;
|
||||||
|
* Type: 'php_class'
|
||||||
|
* Reason: In PHP files, class references are always PHP (not JavaScript)
|
||||||
|
*
|
||||||
|
* 8. BUNDLE ALIASES (PHP only)
|
||||||
|
* Pattern: 'include' => ['jqhtml', 'frontend']
|
||||||
|
* Type: 'bundle_alias'
|
||||||
|
* Reason: Resolves to bundle class definition
|
||||||
|
*
|
||||||
|
* 9. VIEW REFERENCES (PHP, Blade)
|
||||||
|
* Pattern: @rsx_extends('frontend.layout')
|
||||||
|
* Pattern: rsx_view('frontend.dashboard')
|
||||||
|
* Type: 'view'
|
||||||
|
* Reason: Resolves to Blade view template files
|
||||||
|
*
|
||||||
|
* METHOD RESOLUTION:
|
||||||
|
* When a pattern includes a method (e.g., Controller.method), the server attempts to find
|
||||||
|
* the specific method in the class. If the method isn't found but the class is, it returns
|
||||||
|
* the class location as a fallback.
|
||||||
|
*
|
||||||
|
* IMPORTANT: The server endpoint supports CSV type lists for priority ordering.
|
||||||
|
* Example: type='php_class,js_class' tries PHP first, then JavaScript.
|
||||||
|
*/
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
@@ -88,8 +161,19 @@ class RspadeDefinitionProvider {
|
|||||||
return hrefResult;
|
return hrefResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle "this.xxx" references in .jqhtml files (highest priority for jqhtml files)
|
// Handle jqhtml-specific patterns
|
||||||
if (fileName.endsWith('.jqhtml')) {
|
if (fileName.endsWith('.jqhtml')) {
|
||||||
|
// Check for extends="ClassName" attribute
|
||||||
|
const extendsResult = await this.handleJqhtmlExtends(document, position);
|
||||||
|
if (extendsResult) {
|
||||||
|
return extendsResult;
|
||||||
|
}
|
||||||
|
// Check for $xxx=... attributes (must come before handleThisReference)
|
||||||
|
const attrResult = await this.handleJqhtmlAttribute(document, position);
|
||||||
|
if (attrResult) {
|
||||||
|
return attrResult;
|
||||||
|
}
|
||||||
|
// Handle "this.xxx" references in template expressions
|
||||||
const thisResult = await this.handleThisReference(document, position);
|
const thisResult = await this.handleThisReference(document, position);
|
||||||
if (thisResult) {
|
if (thisResult) {
|
||||||
return thisResult;
|
return thisResult;
|
||||||
@@ -132,6 +216,9 @@ class RspadeDefinitionProvider {
|
|||||||
* - Rsx::Route('Controller', 'method') (PHP)
|
* - Rsx::Route('Controller', 'method') (PHP)
|
||||||
* - Rsx.Route('Controller') (JavaScript, defaults to 'index')
|
* - Rsx.Route('Controller') (JavaScript, defaults to 'index')
|
||||||
* - Rsx.Route('Controller', 'method') (JavaScript)
|
* - Rsx.Route('Controller', 'method') (JavaScript)
|
||||||
|
*
|
||||||
|
* Resolution: Routes always point to PHP controllers (server-side)
|
||||||
|
* Type: 'php_class'
|
||||||
*/
|
*/
|
||||||
async handleRoutePattern(document, position) {
|
async handleRoutePattern(document, position) {
|
||||||
const line = document.lineAt(position.line).text;
|
const line = document.lineAt(position.line).text;
|
||||||
@@ -148,13 +235,13 @@ class RspadeDefinitionProvider {
|
|||||||
// Always go to the method when clicking anywhere in Route()
|
// Always go to the method when clicking anywhere in Route()
|
||||||
// This takes precedence over individual class name lookups
|
// This takes precedence over individual class name lookups
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, method, 'class');
|
const result = await this.queryIdeHelper(controller, method, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// If method lookup fails, try just the controller
|
// If method lookup fails, try just the controller
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, undefined, 'class');
|
const result = await this.queryIdeHelper(controller, undefined, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
}
|
}
|
||||||
catch (error2) {
|
catch (error2) {
|
||||||
@@ -178,13 +265,13 @@ class RspadeDefinitionProvider {
|
|||||||
// Single parameter - default to 'index'
|
// Single parameter - default to 'index'
|
||||||
const method = 'index';
|
const method = 'index';
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, method, 'class');
|
const result = await this.queryIdeHelper(controller, method, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// If method lookup fails, try just the controller
|
// If method lookup fails, try just the controller
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, undefined, 'class');
|
const result = await this.queryIdeHelper(controller, undefined, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
}
|
}
|
||||||
catch (error2) {
|
catch (error2) {
|
||||||
@@ -215,8 +302,8 @@ class RspadeDefinitionProvider {
|
|||||||
// Query IDE bridge to resolve "/" URL to route
|
// Query IDE bridge to resolve "/" URL to route
|
||||||
const result = await this.ide_bridge.queryUrl('/');
|
const result = await this.ide_bridge.queryUrl('/');
|
||||||
if (result && result.found && result.controller && result.method) {
|
if (result && result.found && result.controller && result.method) {
|
||||||
// Resolved to controller/method - navigate to it
|
// Resolved to controller/method - navigate to it (always PHP)
|
||||||
const phpResult = await this.queryIdeHelper(result.controller, result.method, 'class');
|
const phpResult = await this.queryIdeHelper(result.controller, result.method, 'php_class');
|
||||||
return this.createLocationFromResult(phpResult);
|
return this.createLocationFromResult(phpResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,6 +314,106 @@ class RspadeDefinitionProvider {
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Handle jqhtml extends="" attribute
|
||||||
|
* Detects patterns like:
|
||||||
|
* - <Define:My_Component extends="DataGrid_Abstract">
|
||||||
|
*
|
||||||
|
* Resolution: Try jqhtml component first, then JS class
|
||||||
|
* Type: 'jqhtml_class,js_class'
|
||||||
|
*/
|
||||||
|
async handleJqhtmlExtends(document, position) {
|
||||||
|
const line = document.lineAt(position.line).text;
|
||||||
|
// Match extends="ClassName" or extends='ClassName'
|
||||||
|
const extendsPattern = /extends\s*=\s*(['"])([A-Z][A-Za-z0-9_]*)\1/g;
|
||||||
|
let match;
|
||||||
|
while ((match = extendsPattern.exec(line)) !== null) {
|
||||||
|
const className = match[2];
|
||||||
|
const classStart = match.index + match[0].indexOf(className);
|
||||||
|
const classEnd = classStart + className.length;
|
||||||
|
// Check if cursor is on the class name
|
||||||
|
if (position.character >= classStart && position.character < classEnd) {
|
||||||
|
try {
|
||||||
|
// Try jqhtml component first, then JS class
|
||||||
|
const result = await this.queryIdeHelper(className, undefined, 'jqhtml_class,js_class');
|
||||||
|
return this.createLocationFromResult(result);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error('Error resolving jqhtml extends:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Handle jqhtml $xxx=... attributes
|
||||||
|
* Detects patterns like:
|
||||||
|
* - $data_source=Frontend_Controller.fetch_data
|
||||||
|
* - $on_click=this.handle_click
|
||||||
|
*
|
||||||
|
* Resolution logic:
|
||||||
|
* - If starts with "this.", resolve to current component's jqhtml class methods
|
||||||
|
* - Otherwise, resolve like JS class references: 'js_class,php_class'
|
||||||
|
*/
|
||||||
|
async handleJqhtmlAttribute(document, position) {
|
||||||
|
const line = document.lineAt(position.line).text;
|
||||||
|
// Match $attribute=Value or $attribute=this.method or $attribute=Class.method
|
||||||
|
// Pattern: $word=(this.)?(Word)(.word)?
|
||||||
|
const attrPattern = /\$[a-z_][a-z0-9_]*\s*=\s*(this\.)?([A-Z][A-Za-z0-9_]*)(?:\.([a-z_][a-z0-9_]*))?/gi;
|
||||||
|
let match;
|
||||||
|
while ((match = attrPattern.exec(line)) !== null) {
|
||||||
|
const hasThis = !!match[1]; // "this." prefix
|
||||||
|
const className = match[2];
|
||||||
|
const methodName = match[3]; // Optional method after dot
|
||||||
|
const classStart = match.index + match[0].indexOf(className);
|
||||||
|
const classEnd = classStart + className.length;
|
||||||
|
// Check if cursor is on the class name
|
||||||
|
if (position.character >= classStart && position.character < classEnd) {
|
||||||
|
if (hasThis) {
|
||||||
|
// this.method - resolve to current component's methods
|
||||||
|
// Get the component name from the file
|
||||||
|
let componentName;
|
||||||
|
const fullText = document.getText();
|
||||||
|
const defineMatch = fullText.match(/<Define:([A-Z][A-Za-z0-9_]*)/);
|
||||||
|
if (defineMatch) {
|
||||||
|
componentName = defineMatch[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// If no Define tag, try to get component name from filename
|
||||||
|
const fileName = document.fileName;
|
||||||
|
const baseName = fileName.split('/').pop()?.replace('.jqhtml', '') || '';
|
||||||
|
if (baseName) {
|
||||||
|
// Convert snake_case to PascalCase with underscores
|
||||||
|
componentName = baseName.split('_').map(part => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join('_');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!componentName) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// The className here is actually the method name after "this."
|
||||||
|
// We need to use the component name as the identifier
|
||||||
|
const result = await this.queryIdeHelper(componentName, className.toLowerCase(), 'jqhtml_class_method');
|
||||||
|
return this.createLocationFromResult(result);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error('Error resolving jqhtml this reference:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Class.method or Class - resolve like JS class references
|
||||||
|
try {
|
||||||
|
const result = await this.queryIdeHelper(className, methodName, 'js_class,php_class');
|
||||||
|
return this.createLocationFromResult(result);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error('Error resolving jqhtml attribute class:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Handle "this.xxx" references in .jqhtml files
|
* Handle "this.xxx" references in .jqhtml files
|
||||||
* Only handles patterns where cursor is on a word after "this."
|
* Only handles patterns where cursor is on a word after "this."
|
||||||
@@ -340,6 +527,19 @@ class RspadeDefinitionProvider {
|
|||||||
console.log('[JQHTML Component] Returning location:', component_def.uri.fsPath, 'at position', component_def.position);
|
console.log('[JQHTML Component] Returning location:', component_def.uri.fsPath, 'at position', component_def.position);
|
||||||
return new vscode.Location(component_def.uri, component_def.position);
|
return new vscode.Location(component_def.uri, component_def.position);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Handle JavaScript class references in .js and .jqhtml files
|
||||||
|
* Detects patterns like:
|
||||||
|
* - class My_Component extends DataGrid_Abstract
|
||||||
|
* - User_Controller.fetch_all()
|
||||||
|
* - await Product_Model.fetch(123)
|
||||||
|
*
|
||||||
|
* Resolution: Try JS classes first (for component inheritance), then PHP classes (for controllers/models)
|
||||||
|
* Type: 'js_class,php_class'
|
||||||
|
*
|
||||||
|
* Note: JS stub files (auto-generated from PHP) are client-side only and not in the manifest,
|
||||||
|
* so there's no conflict - the server will correctly return PHP classes when they exist.
|
||||||
|
*/
|
||||||
async handleJavaScriptDefinition(document, position) {
|
async handleJavaScriptDefinition(document, position) {
|
||||||
// Get the word at the current position
|
// Get the word at the current position
|
||||||
const wordRange = document.getWordRangeAtPosition(position, /[A-Z][A-Za-z0-9_]*/);
|
const wordRange = document.getWordRangeAtPosition(position, /[A-Z][A-Za-z0-9_]*/);
|
||||||
@@ -361,8 +561,9 @@ class RspadeDefinitionProvider {
|
|||||||
method_name = methodMatch[1];
|
method_name = methodMatch[1];
|
||||||
}
|
}
|
||||||
// Query the IDE helper endpoint
|
// Query the IDE helper endpoint
|
||||||
|
// Try JS classes first (component inheritance), then PHP (controllers/models)
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(word, method_name, 'class');
|
const result = await this.queryIdeHelper(word, method_name, 'js_class,php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -488,7 +689,9 @@ class RspadeDefinitionProvider {
|
|||||||
// Check if this looks like an RSX class name
|
// Check if this looks like an RSX class name
|
||||||
if (word.includes('_') && /^[A-Z]/.test(word)) {
|
if (word.includes('_') && /^[A-Z]/.test(word)) {
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(word, undefined, 'class');
|
// When resolving from PHP files, only look for PHP classes
|
||||||
|
// This prevents jumping to JavaScript files when clicking on PHP class references
|
||||||
|
const result = await this.queryIdeHelper(word, undefined, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
|||||||
* Centralized client for communicating with RSpade framework IDE helper endpoints.
|
* Centralized client for communicating with RSpade framework IDE helper endpoints.
|
||||||
*
|
*
|
||||||
* AUTO-DISCOVERY SYSTEM:
|
* AUTO-DISCOVERY SYSTEM:
|
||||||
* 1. Server creates storage/rsx-ide-bridge/domain.txt on first web request
|
* 1. Server creates system/storage/rsx-ide-bridge/domain.txt on first web request
|
||||||
* 2. Client reads domain.txt to discover server URL
|
* 2. Client reads domain.txt to discover server URL
|
||||||
* 3. Falls back to VS Code setting: rspade.serverUrl
|
* 3. Falls back to VS Code setting: rspade.serverUrl
|
||||||
* 4. Auto-retries with refreshed URL on connection failure
|
* 4. Auto-retries with refreshed URL on connection failure
|
||||||
@@ -128,6 +128,44 @@ class IdeBridgeClient {
|
|||||||
async queryUrl(url) {
|
async queryUrl(url) {
|
||||||
return this.request('/_ide/service/resolve_url', { url }, 'GET');
|
return this.request('/_ide/service/resolve_url', { url }, 'GET');
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Check if a JavaScript class extends another class (anywhere in the inheritance chain)
|
||||||
|
*
|
||||||
|
* @param subclass The potential subclass name
|
||||||
|
* @param superclass The potential superclass name
|
||||||
|
* @returns Promise with { is_subclass: boolean }
|
||||||
|
*/
|
||||||
|
async js_is_subclass_of(subclass, superclass) {
|
||||||
|
return this.request('/_ide/service/js_is_subclass_of', { subclass, superclass }, 'GET');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Check if a PHP class extends another class (anywhere in the inheritance chain)
|
||||||
|
*
|
||||||
|
* @param subclass The potential subclass name
|
||||||
|
* @param superclass The potential superclass name
|
||||||
|
* @returns Promise with { is_subclass: boolean }
|
||||||
|
*/
|
||||||
|
async php_is_subclass_of(subclass, superclass) {
|
||||||
|
return this.request('/_ide/service/php_is_subclass_of', { subclass, superclass }, 'GET');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Trigger incremental manifest build
|
||||||
|
*
|
||||||
|
* Calls Manifest::init() on the server to update the manifest cache.
|
||||||
|
* Does NOT clear the manifest, just performs incremental update of changed files.
|
||||||
|
*
|
||||||
|
* @returns Promise with { success: boolean }
|
||||||
|
*/
|
||||||
|
async manifest_build() {
|
||||||
|
try {
|
||||||
|
return await this.request('/_ide/service/manifest_build', {}, 'GET');
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// Log to console but don't throw - errors are silent to user
|
||||||
|
console.warn('[IdeBridge] Manifest build failed:', error.message);
|
||||||
|
return { success: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
async make_request_with_retry(endpoint, data, method, retry_count) {
|
async make_request_with_retry(endpoint, data, method, retry_count) {
|
||||||
if (retry_count > 0) {
|
if (retry_count > 0) {
|
||||||
this.output_channel.appendLine(`\n--- RETRY ATTEMPT ${retry_count} ---`);
|
this.output_channel.appendLine(`\n--- RETRY ATTEMPT ${retry_count} ---`);
|
||||||
@@ -146,9 +184,14 @@ class IdeBridgeClient {
|
|||||||
// Only retry once
|
// Only retry once
|
||||||
if (retry_count === 0) {
|
if (retry_count === 0) {
|
||||||
const error_msg = error.message || '';
|
const error_msg = error.message || '';
|
||||||
// Session expired or signature invalid - recreate session
|
// Authentication failure - recreate session
|
||||||
if (error_msg.includes('Session not found') || error_msg.includes('Invalid signature')) {
|
// Handles: "Session not found", "Invalid signature", "Authentication required"
|
||||||
this.output_channel.appendLine('Session/signature error, recreating session...');
|
// or any HTTP 401 response
|
||||||
|
if (error_msg.includes('Session not found') ||
|
||||||
|
error_msg.includes('Invalid signature') ||
|
||||||
|
error_msg.includes('Authentication required') ||
|
||||||
|
error_msg.includes('HTTP 401')) {
|
||||||
|
this.output_channel.appendLine('Authentication failed, recreating session...');
|
||||||
this.auth_data = null;
|
this.auth_data = null;
|
||||||
return this.make_request_with_retry(endpoint, data, method, retry_count + 1);
|
return this.make_request_with_retry(endpoint, data, method, retry_count + 1);
|
||||||
}
|
}
|
||||||
@@ -327,7 +370,7 @@ class IdeBridgeClient {
|
|||||||
this.show_detailed_error();
|
this.show_detailed_error();
|
||||||
throw new Error('RSpade project root not found');
|
throw new Error('RSpade project root not found');
|
||||||
}
|
}
|
||||||
const domain_file = path.join(rspade_root, 'storage', 'rsx-ide-bridge', 'domain.txt');
|
const domain_file = path.join(rspade_root, 'system', 'storage', 'rsx-ide-bridge', 'domain.txt');
|
||||||
this.output_channel.appendLine(`Checking for domain file: ${domain_file}`);
|
this.output_channel.appendLine(`Checking for domain file: ${domain_file}`);
|
||||||
if (await exists(domain_file)) {
|
if (await exists(domain_file)) {
|
||||||
const domain = (await read_file(domain_file, 'utf8')).trim();
|
const domain = (await read_file(domain_file, 'utf8')).trim();
|
||||||
@@ -338,7 +381,7 @@ class IdeBridgeClient {
|
|||||||
// domain.txt doesn't exist yet - schedule retry
|
// domain.txt doesn't exist yet - schedule retry
|
||||||
this.schedule_retry();
|
this.schedule_retry();
|
||||||
this.show_detailed_error();
|
this.show_detailed_error();
|
||||||
throw new Error('RSpade: storage/rsx-ide-bridge/domain.txt not found. Please load site in browser or configure server URL.');
|
throw new Error('RSpade: system/storage/rsx-ide-bridge/domain.txt not found. Please load site in browser or configure server URL.');
|
||||||
}
|
}
|
||||||
async negotiate_protocol(url_or_hostname) {
|
async negotiate_protocol(url_or_hostname) {
|
||||||
// Parse the input to extract hostname
|
// Parse the input to extract hostname
|
||||||
@@ -427,7 +470,7 @@ class IdeBridgeClient {
|
|||||||
if (!rspade_root) {
|
if (!rspade_root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const domain_file = path.join(rspade_root, 'storage', 'rsx-ide-bridge', 'domain.txt');
|
const domain_file = path.join(rspade_root, 'system', 'storage', 'rsx-ide-bridge', 'domain.txt');
|
||||||
const domain_dir = path.dirname(domain_file);
|
const domain_dir = path.dirname(domain_file);
|
||||||
// Watch the directory (file might not exist yet)
|
// Watch the directory (file might not exist yet)
|
||||||
if (fs.existsSync(domain_dir)) {
|
if (fs.existsSync(domain_dir)) {
|
||||||
@@ -469,10 +512,11 @@ class IdeBridgeClient {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
for (const folder of vscode.workspace.workspaceFolders) {
|
for (const folder of vscode.workspace.workspaceFolders) {
|
||||||
// Try new structure first
|
// Try new structure first - check for system/app/RSpade
|
||||||
const system_app_rspade = path.join(folder.uri.fsPath, 'system', 'app', 'RSpade');
|
const system_app_rspade = path.join(folder.uri.fsPath, 'system', 'app', 'RSpade');
|
||||||
if (fs.existsSync(system_app_rspade)) {
|
if (fs.existsSync(system_app_rspade)) {
|
||||||
return path.join(folder.uri.fsPath, 'system');
|
// Return project root (not system directory)
|
||||||
|
return folder.uri.fsPath;
|
||||||
}
|
}
|
||||||
// Fall back to legacy structure
|
// Fall back to legacy structure
|
||||||
const app_rspade = path.join(folder.uri.fsPath, 'app', 'RSpade');
|
const app_rspade = path.join(folder.uri.fsPath, 'app', 'RSpade');
|
||||||
@@ -507,7 +551,7 @@ class IdeBridgeClient {
|
|||||||
this.output_channel.appendLine('\nThe extension needs to know your development server URL.');
|
this.output_channel.appendLine('\nThe extension needs to know your development server URL.');
|
||||||
this.output_channel.appendLine('\nPlease do ONE of the following:\n');
|
this.output_channel.appendLine('\nPlease do ONE of the following:\n');
|
||||||
this.output_channel.appendLine('1. Load your site in a web browser');
|
this.output_channel.appendLine('1. Load your site in a web browser');
|
||||||
this.output_channel.appendLine(' This will auto-create: storage/rsx-ide-bridge/domain.txt\n');
|
this.output_channel.appendLine(' This will auto-create: system/storage/rsx-ide-bridge/domain.txt\n');
|
||||||
this.output_channel.appendLine('2. Set VS Code setting: rspade.serverUrl');
|
this.output_channel.appendLine('2. Set VS Code setting: rspade.serverUrl');
|
||||||
this.output_channel.appendLine(' File → Preferences → Settings → Search "rspade"');
|
this.output_channel.appendLine(' File → Preferences → Settings → Search "rspade"');
|
||||||
this.output_channel.appendLine(' Set to your development URL (e.g., https://myapp.test)\n');
|
this.output_channel.appendLine(' Set to your development URL (e.g., https://myapp.test)\n');
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -56,20 +56,21 @@ const LIFECYCLE_DOCS = {
|
|||||||
on_destroy: 'Component destruction phase - cleanup resources. Called before component is removed. MUST be synchronous.',
|
on_destroy: 'Component destruction phase - cleanup resources. Called before component is removed. MUST be synchronous.',
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Cache for lineage lookups
|
* Cache for subclass checks
|
||||||
*/
|
*/
|
||||||
const lineage_cache = new Map();
|
const subclass_cache = new Map();
|
||||||
/**
|
/**
|
||||||
* IDE Bridge client instance (shared across all providers)
|
* IDE Bridge client instance (shared across all providers)
|
||||||
*/
|
*/
|
||||||
let ide_bridge_client = null;
|
let ide_bridge_client = null;
|
||||||
/**
|
/**
|
||||||
* Get JavaScript class lineage from backend via IDE bridge
|
* Check if a JavaScript class extends another class (anywhere in inheritance chain)
|
||||||
*/
|
*/
|
||||||
async function get_js_lineage(class_name) {
|
async function is_subclass_of_jqhtml_component(class_name) {
|
||||||
|
const cache_key = `${class_name}:Jqhtml_Component`;
|
||||||
// Check cache first
|
// Check cache first
|
||||||
if (lineage_cache.has(class_name)) {
|
if (subclass_cache.has(cache_key)) {
|
||||||
return lineage_cache.get(class_name);
|
return subclass_cache.get(cache_key);
|
||||||
}
|
}
|
||||||
// Initialize IDE bridge client if needed
|
// Initialize IDE bridge client if needed
|
||||||
if (!ide_bridge_client) {
|
if (!ide_bridge_client) {
|
||||||
@@ -77,15 +78,15 @@ async function get_js_lineage(class_name) {
|
|||||||
ide_bridge_client = new ide_bridge_client_1.IdeBridgeClient(output_channel);
|
ide_bridge_client = new ide_bridge_client_1.IdeBridgeClient(output_channel);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await ide_bridge_client.request('/_ide/service/js_lineage', { class: class_name });
|
const response = await ide_bridge_client.js_is_subclass_of(class_name, 'Jqhtml_Component');
|
||||||
const lineage = response.lineage || [];
|
const is_subclass = response.is_subclass || false;
|
||||||
// Cache the result
|
// Cache the result
|
||||||
lineage_cache.set(class_name, lineage);
|
subclass_cache.set(cache_key, is_subclass);
|
||||||
return lineage;
|
return is_subclass;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// Re-throw error to fail loud - no silent fallbacks
|
// Re-throw error to fail loud - no silent fallbacks
|
||||||
throw new Error(`Failed to get JS lineage for ${class_name}: ${error.message}`);
|
throw new Error(`Failed to check if ${class_name} extends Jqhtml_Component: ${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -169,16 +170,14 @@ class JqhtmlLifecycleSemanticTokensProvider {
|
|||||||
// Check if directly extends Jqhtml_Component
|
// Check if directly extends Jqhtml_Component
|
||||||
const is_jqhtml = directly_extends_jqhtml(text);
|
const is_jqhtml = directly_extends_jqhtml(text);
|
||||||
console.log(`[JQHTML] Directly extends Jqhtml_Component: ${is_jqhtml}`);
|
console.log(`[JQHTML] Directly extends Jqhtml_Component: ${is_jqhtml}`);
|
||||||
// If not directly extending, check lineage
|
// If not directly extending, check inheritance chain
|
||||||
let extends_jqhtml = is_jqhtml;
|
let extends_jqhtml = is_jqhtml;
|
||||||
if (!is_jqhtml && has_extends_clause(text)) {
|
if (!is_jqhtml && has_extends_clause(text)) {
|
||||||
const class_name = extract_class_name(text);
|
const class_name = extract_class_name(text);
|
||||||
console.log(`[JQHTML] Checking lineage for class: ${class_name}`);
|
console.log(`[JQHTML] Checking inheritance for class: ${class_name}`);
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
const lineage = await get_js_lineage(class_name);
|
extends_jqhtml = await is_subclass_of_jqhtml_component(class_name);
|
||||||
console.log(`[JQHTML] Lineage: ${JSON.stringify(lineage)}`);
|
console.log(`[JQHTML] Extends Jqhtml_Component via inheritance: ${extends_jqhtml}`);
|
||||||
extends_jqhtml = lineage.includes('Jqhtml_Component');
|
|
||||||
console.log(`[JQHTML] Extends Jqhtml_Component via lineage: ${extends_jqhtml}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Highlight lifecycle methods (only if extends Jqhtml_Component)
|
// Highlight lifecycle methods (only if extends Jqhtml_Component)
|
||||||
@@ -271,8 +270,7 @@ class JqhtmlLifecycleHoverProvider {
|
|||||||
if (!is_jqhtml) {
|
if (!is_jqhtml) {
|
||||||
const class_name = extract_class_name(text);
|
const class_name = extract_class_name(text);
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
const lineage = await get_js_lineage(class_name);
|
extends_jqhtml = await is_subclass_of_jqhtml_component(class_name);
|
||||||
extends_jqhtml = lineage.includes('Jqhtml_Component');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!extends_jqhtml) {
|
if (!extends_jqhtml) {
|
||||||
@@ -346,8 +344,7 @@ class JqhtmlLifecycleDiagnosticProvider {
|
|||||||
if (!is_jqhtml) {
|
if (!is_jqhtml) {
|
||||||
const class_name = extract_class_name(text);
|
const class_name = extract_class_name(text);
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
const lineage = await get_js_lineage(class_name);
|
extends_jqhtml = await is_subclass_of_jqhtml_component(class_name);
|
||||||
extends_jqhtml = lineage.includes('Jqhtml_Component');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.document_cache.set(cache_key, extends_jqhtml);
|
this.document_cache.set(cache_key, extends_jqhtml);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
|||||||
"name": "rspade-framework",
|
"name": "rspade-framework",
|
||||||
"displayName": "RSpade Framework Support",
|
"displayName": "RSpade Framework Support",
|
||||||
"description": "VS Code extension for RSpade framework with code folding, formatting, and namespace management",
|
"description": "VS Code extension for RSpade framework with code folding, formatting, and namespace management",
|
||||||
"version": "0.1.182",
|
"version": "0.1.186",
|
||||||
"publisher": "rspade",
|
"publisher": "rspade",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.74.0"
|
"vscode": "^1.74.0"
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
import { IdeBridgeClient } from './ide_bridge_client';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides automatic file renaming based on RSX naming conventions
|
* Provides automatic file renaming based on RSX naming conventions
|
||||||
@@ -17,6 +18,7 @@ export class AutoRenameProvider {
|
|||||||
private config_enabled: boolean = false;
|
private config_enabled: boolean = false;
|
||||||
private workspace_root: string = '';
|
private workspace_root: string = '';
|
||||||
private is_checking = false;
|
private is_checking = false;
|
||||||
|
private ide_bridge_client: IdeBridgeClient | null = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.init();
|
this.init();
|
||||||
@@ -354,9 +356,25 @@ export class AutoRenameProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async get_suggested_js_filename(file_path: string, class_name: string, content: string): Promise<string> {
|
private async get_suggested_js_filename(file_path: string, class_name: string, content: string): Promise<string> {
|
||||||
// Check if this extends Jqhtml_Component
|
// Check if this extends Jqhtml_Component (directly or via inheritance)
|
||||||
const is_jqhtml = content.includes('extends Jqhtml_Component') ||
|
let is_jqhtml = content.includes('extends Jqhtml_Component');
|
||||||
content.match(/extends\s+[A-Za-z0-9_]+\s+extends Jqhtml_Component/);
|
|
||||||
|
// If not directly extending, check via API
|
||||||
|
if (!is_jqhtml && content.includes('extends ')) {
|
||||||
|
// Initialize IDE bridge client if needed
|
||||||
|
if (!this.ide_bridge_client) {
|
||||||
|
const output_channel = vscode.window.createOutputChannel('RSpade Auto Rename');
|
||||||
|
this.ide_bridge_client = new IdeBridgeClient(output_channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await this.ide_bridge_client.js_is_subclass_of(class_name, 'Jqhtml_Component');
|
||||||
|
is_jqhtml = response.is_subclass || false;
|
||||||
|
} catch (error) {
|
||||||
|
// If API call fails, fall back to direct check only
|
||||||
|
console.log('[AutoRename] JS - Failed to check inheritance:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('[AutoRename] JS - Is Jqhtml_Component:', is_jqhtml);
|
console.log('[AutoRename] JS - Is Jqhtml_Component:', is_jqhtml);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* RSpade Definition Provider - "Go to Definition" for RSX Classes, Routes, and Components
|
||||||
|
*
|
||||||
|
* RESOLUTION TYPE PRIORITY MATRIX
|
||||||
|
* ================================
|
||||||
|
*
|
||||||
|
* This provider determines what to navigate to when you click "Go to Definition" on various
|
||||||
|
* identifiers across different file types. The resolution logic uses CSV type lists sent to
|
||||||
|
* the server endpoint `/_ide/service/resolve_class?type=X,Y,Z` which tries each type in order.
|
||||||
|
*
|
||||||
|
* FILE TYPE HANDLERS & RESOLUTION RULES:
|
||||||
|
*
|
||||||
|
* 1. ROUTE PATTERNS (all files)
|
||||||
|
* Pattern: Rsx::Route('Controller') or Rsx.Route('Controller', 'method')
|
||||||
|
* Type: 'php_class'
|
||||||
|
* Reason: Routes always point to PHP controllers (server-side)
|
||||||
|
*
|
||||||
|
* 2. HREF PATTERNS (Blade, jqhtml)
|
||||||
|
* Pattern: href="/"
|
||||||
|
* Type: 'php_class'
|
||||||
|
* Reason: Resolves URL to controller, always PHP
|
||||||
|
*
|
||||||
|
* 3. JQHTML EXTENDS ATTRIBUTE (jqhtml only)
|
||||||
|
* Pattern: <Define:My_Component extends="DataGrid_Abstract">
|
||||||
|
* Type: 'jqhtml_class,js_class'
|
||||||
|
* Reason: Component inheritance - try jqhtml component first, then JS class
|
||||||
|
*
|
||||||
|
* 4. JQHTML $xxx ATTRIBUTES (jqhtml only)
|
||||||
|
* Pattern: $data_source=Frontend_Controller.fetch_data
|
||||||
|
* Type: 'js_class,php_class'
|
||||||
|
* Reason: Try JS class first (for components), then PHP (for controllers/models)
|
||||||
|
*
|
||||||
|
* Pattern: $handler=this.on_click
|
||||||
|
* Type: 'jqhtml_class_method'
|
||||||
|
* Special: Resolves to current component's method
|
||||||
|
*
|
||||||
|
* 5. THIS REFERENCES (jqhtml only)
|
||||||
|
* Pattern: <%= this.data.users %>
|
||||||
|
* Type: 'jqhtml_class_method'
|
||||||
|
* Reason: Always current component's method/property
|
||||||
|
*
|
||||||
|
* 6. JAVASCRIPT CLASS REFERENCES (JS, jqhtml)
|
||||||
|
* Pattern: class My_Component extends DataGrid_Abstract
|
||||||
|
* Pattern: User_Controller.fetch_all()
|
||||||
|
* Type: 'js_class,php_class'
|
||||||
|
* Reason: Try JS first (component inheritance), then PHP (controllers/models)
|
||||||
|
* Note: JS stub files (auto-generated from PHP) are client-side only, not in manifest
|
||||||
|
*
|
||||||
|
* 7. PHP CLASS REFERENCES (PHP, Blade)
|
||||||
|
* Pattern: class Contacts_DataGrid extends DataGrid_Abstract
|
||||||
|
* Pattern: use Rsx\Lib\DataGrid_QueryBuilder;
|
||||||
|
* Type: 'php_class'
|
||||||
|
* Reason: In PHP files, class references are always PHP (not JavaScript)
|
||||||
|
*
|
||||||
|
* 8. BUNDLE ALIASES (PHP only)
|
||||||
|
* Pattern: 'include' => ['jqhtml', 'frontend']
|
||||||
|
* Type: 'bundle_alias'
|
||||||
|
* Reason: Resolves to bundle class definition
|
||||||
|
*
|
||||||
|
* 9. VIEW REFERENCES (PHP, Blade)
|
||||||
|
* Pattern: @rsx_extends('frontend.layout')
|
||||||
|
* Pattern: rsx_view('frontend.dashboard')
|
||||||
|
* Type: 'view'
|
||||||
|
* Reason: Resolves to Blade view template files
|
||||||
|
*
|
||||||
|
* METHOD RESOLUTION:
|
||||||
|
* When a pattern includes a method (e.g., Controller.method), the server attempts to find
|
||||||
|
* the specific method in the class. If the method isn't found but the class is, it returns
|
||||||
|
* the class location as a fallback.
|
||||||
|
*
|
||||||
|
* IMPORTANT: The server endpoint supports CSV type lists for priority ordering.
|
||||||
|
* Example: type='php_class,js_class' tries PHP first, then JavaScript.
|
||||||
|
*/
|
||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
@@ -94,8 +168,21 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle "this.xxx" references in .jqhtml files (highest priority for jqhtml files)
|
// Handle jqhtml-specific patterns
|
||||||
if (fileName.endsWith('.jqhtml')) {
|
if (fileName.endsWith('.jqhtml')) {
|
||||||
|
// Check for extends="ClassName" attribute
|
||||||
|
const extendsResult = await this.handleJqhtmlExtends(document, position);
|
||||||
|
if (extendsResult) {
|
||||||
|
return extendsResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for $xxx=... attributes (must come before handleThisReference)
|
||||||
|
const attrResult = await this.handleJqhtmlAttribute(document, position);
|
||||||
|
if (attrResult) {
|
||||||
|
return attrResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle "this.xxx" references in template expressions
|
||||||
const thisResult = await this.handleThisReference(document, position);
|
const thisResult = await this.handleThisReference(document, position);
|
||||||
if (thisResult) {
|
if (thisResult) {
|
||||||
return thisResult;
|
return thisResult;
|
||||||
@@ -143,6 +230,9 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
* - Rsx::Route('Controller', 'method') (PHP)
|
* - Rsx::Route('Controller', 'method') (PHP)
|
||||||
* - Rsx.Route('Controller') (JavaScript, defaults to 'index')
|
* - Rsx.Route('Controller') (JavaScript, defaults to 'index')
|
||||||
* - Rsx.Route('Controller', 'method') (JavaScript)
|
* - Rsx.Route('Controller', 'method') (JavaScript)
|
||||||
|
*
|
||||||
|
* Resolution: Routes always point to PHP controllers (server-side)
|
||||||
|
* Type: 'php_class'
|
||||||
*/
|
*/
|
||||||
private async handleRoutePattern(
|
private async handleRoutePattern(
|
||||||
document: vscode.TextDocument,
|
document: vscode.TextDocument,
|
||||||
@@ -165,12 +255,12 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
// Always go to the method when clicking anywhere in Route()
|
// Always go to the method when clicking anywhere in Route()
|
||||||
// This takes precedence over individual class name lookups
|
// This takes precedence over individual class name lookups
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, method, 'class');
|
const result = await this.queryIdeHelper(controller, method, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If method lookup fails, try just the controller
|
// If method lookup fails, try just the controller
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, undefined, 'class');
|
const result = await this.queryIdeHelper(controller, undefined, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
} catch (error2) {
|
} catch (error2) {
|
||||||
console.error('Error querying IDE helper for route:', error);
|
console.error('Error querying IDE helper for route:', error);
|
||||||
@@ -196,12 +286,12 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
// Single parameter - default to 'index'
|
// Single parameter - default to 'index'
|
||||||
const method = 'index';
|
const method = 'index';
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, method, 'class');
|
const result = await this.queryIdeHelper(controller, method, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If method lookup fails, try just the controller
|
// If method lookup fails, try just the controller
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(controller, undefined, 'class');
|
const result = await this.queryIdeHelper(controller, undefined, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
} catch (error2) {
|
} catch (error2) {
|
||||||
console.error('Error querying IDE helper for route:', error);
|
console.error('Error querying IDE helper for route:', error);
|
||||||
@@ -240,8 +330,8 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
const result = await this.ide_bridge.queryUrl('/');
|
const result = await this.ide_bridge.queryUrl('/');
|
||||||
|
|
||||||
if (result && result.found && result.controller && result.method) {
|
if (result && result.found && result.controller && result.method) {
|
||||||
// Resolved to controller/method - navigate to it
|
// Resolved to controller/method - navigate to it (always PHP)
|
||||||
const phpResult = await this.queryIdeHelper(result.controller, result.method, 'class');
|
const phpResult = await this.queryIdeHelper(result.controller, result.method, 'php_class');
|
||||||
return this.createLocationFromResult(phpResult);
|
return this.createLocationFromResult(phpResult);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -253,6 +343,123 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle jqhtml extends="" attribute
|
||||||
|
* Detects patterns like:
|
||||||
|
* - <Define:My_Component extends="DataGrid_Abstract">
|
||||||
|
*
|
||||||
|
* Resolution: Try jqhtml component first, then JS class
|
||||||
|
* Type: 'jqhtml_class,js_class'
|
||||||
|
*/
|
||||||
|
private async handleJqhtmlExtends(
|
||||||
|
document: vscode.TextDocument,
|
||||||
|
position: vscode.Position
|
||||||
|
): Promise<vscode.Definition | undefined> {
|
||||||
|
const line = document.lineAt(position.line).text;
|
||||||
|
|
||||||
|
// Match extends="ClassName" or extends='ClassName'
|
||||||
|
const extendsPattern = /extends\s*=\s*(['"])([A-Z][A-Za-z0-9_]*)\1/g;
|
||||||
|
let match;
|
||||||
|
|
||||||
|
while ((match = extendsPattern.exec(line)) !== null) {
|
||||||
|
const className = match[2];
|
||||||
|
const classStart = match.index + match[0].indexOf(className);
|
||||||
|
const classEnd = classStart + className.length;
|
||||||
|
|
||||||
|
// Check if cursor is on the class name
|
||||||
|
if (position.character >= classStart && position.character < classEnd) {
|
||||||
|
try {
|
||||||
|
// Try jqhtml component first, then JS class
|
||||||
|
const result = await this.queryIdeHelper(className, undefined, 'jqhtml_class,js_class');
|
||||||
|
return this.createLocationFromResult(result);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error resolving jqhtml extends:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle jqhtml $xxx=... attributes
|
||||||
|
* Detects patterns like:
|
||||||
|
* - $data_source=Frontend_Controller.fetch_data
|
||||||
|
* - $on_click=this.handle_click
|
||||||
|
*
|
||||||
|
* Resolution logic:
|
||||||
|
* - If starts with "this.", resolve to current component's jqhtml class methods
|
||||||
|
* - Otherwise, resolve like JS class references: 'js_class,php_class'
|
||||||
|
*/
|
||||||
|
private async handleJqhtmlAttribute(
|
||||||
|
document: vscode.TextDocument,
|
||||||
|
position: vscode.Position
|
||||||
|
): Promise<vscode.Definition | undefined> {
|
||||||
|
const line = document.lineAt(position.line).text;
|
||||||
|
|
||||||
|
// Match $attribute=Value or $attribute=this.method or $attribute=Class.method
|
||||||
|
// Pattern: $word=(this.)?(Word)(.word)?
|
||||||
|
const attrPattern = /\$[a-z_][a-z0-9_]*\s*=\s*(this\.)?([A-Z][A-Za-z0-9_]*)(?:\.([a-z_][a-z0-9_]*))?/gi;
|
||||||
|
let match;
|
||||||
|
|
||||||
|
while ((match = attrPattern.exec(line)) !== null) {
|
||||||
|
const hasThis = !!match[1]; // "this." prefix
|
||||||
|
const className = match[2];
|
||||||
|
const methodName = match[3]; // Optional method after dot
|
||||||
|
|
||||||
|
const classStart = match.index + match[0].indexOf(className);
|
||||||
|
const classEnd = classStart + className.length;
|
||||||
|
|
||||||
|
// Check if cursor is on the class name
|
||||||
|
if (position.character >= classStart && position.character < classEnd) {
|
||||||
|
if (hasThis) {
|
||||||
|
// this.method - resolve to current component's methods
|
||||||
|
// Get the component name from the file
|
||||||
|
let componentName: string | undefined;
|
||||||
|
const fullText = document.getText();
|
||||||
|
const defineMatch = fullText.match(/<Define:([A-Z][A-Za-z0-9_]*)/);
|
||||||
|
|
||||||
|
if (defineMatch) {
|
||||||
|
componentName = defineMatch[1];
|
||||||
|
} else {
|
||||||
|
// If no Define tag, try to get component name from filename
|
||||||
|
const fileName = document.fileName;
|
||||||
|
const baseName = fileName.split('/').pop()?.replace('.jqhtml', '') || '';
|
||||||
|
if (baseName) {
|
||||||
|
// Convert snake_case to PascalCase with underscores
|
||||||
|
componentName = baseName.split('_').map(part =>
|
||||||
|
part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()
|
||||||
|
).join('_');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!componentName) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// The className here is actually the method name after "this."
|
||||||
|
// We need to use the component name as the identifier
|
||||||
|
const result = await this.queryIdeHelper(componentName, className.toLowerCase(), 'jqhtml_class_method');
|
||||||
|
return this.createLocationFromResult(result);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error resolving jqhtml this reference:', error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Class.method or Class - resolve like JS class references
|
||||||
|
try {
|
||||||
|
const result = await this.queryIdeHelper(className, methodName, 'js_class,php_class');
|
||||||
|
return this.createLocationFromResult(result);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error resolving jqhtml attribute class:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle "this.xxx" references in .jqhtml files
|
* Handle "this.xxx" references in .jqhtml files
|
||||||
* Only handles patterns where cursor is on a word after "this."
|
* Only handles patterns where cursor is on a word after "this."
|
||||||
@@ -391,6 +598,19 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
return new vscode.Location(component_def.uri, component_def.position);
|
return new vscode.Location(component_def.uri, component_def.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle JavaScript class references in .js and .jqhtml files
|
||||||
|
* Detects patterns like:
|
||||||
|
* - class My_Component extends DataGrid_Abstract
|
||||||
|
* - User_Controller.fetch_all()
|
||||||
|
* - await Product_Model.fetch(123)
|
||||||
|
*
|
||||||
|
* Resolution: Try JS classes first (for component inheritance), then PHP classes (for controllers/models)
|
||||||
|
* Type: 'js_class,php_class'
|
||||||
|
*
|
||||||
|
* Note: JS stub files (auto-generated from PHP) are client-side only and not in the manifest,
|
||||||
|
* so there's no conflict - the server will correctly return PHP classes when they exist.
|
||||||
|
*/
|
||||||
private async handleJavaScriptDefinition(
|
private async handleJavaScriptDefinition(
|
||||||
document: vscode.TextDocument,
|
document: vscode.TextDocument,
|
||||||
position: vscode.Position
|
position: vscode.Position
|
||||||
@@ -420,8 +640,9 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query the IDE helper endpoint
|
// Query the IDE helper endpoint
|
||||||
|
// Try JS classes first (component inheritance), then PHP (controllers/models)
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(word, method_name, 'class');
|
const result = await this.queryIdeHelper(word, method_name, 'js_class,php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error querying IDE helper:', error);
|
console.error('Error querying IDE helper:', error);
|
||||||
@@ -563,7 +784,9 @@ export class RspadeDefinitionProvider implements vscode.DefinitionProvider {
|
|||||||
// Check if this looks like an RSX class name
|
// Check if this looks like an RSX class name
|
||||||
if (word.includes('_') && /^[A-Z]/.test(word)) {
|
if (word.includes('_') && /^[A-Z]/.test(word)) {
|
||||||
try {
|
try {
|
||||||
const result = await this.queryIdeHelper(word, undefined, 'class');
|
// When resolving from PHP files, only look for PHP classes
|
||||||
|
// This prevents jumping to JavaScript files when clicking on PHP class references
|
||||||
|
const result = await this.queryIdeHelper(word, undefined, 'php_class');
|
||||||
return this.createLocationFromResult(result);
|
return this.createLocationFromResult(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error querying IDE helper for class:', error);
|
console.error('Error querying IDE helper for class:', error);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Centralized client for communicating with RSpade framework IDE helper endpoints.
|
* Centralized client for communicating with RSpade framework IDE helper endpoints.
|
||||||
*
|
*
|
||||||
* AUTO-DISCOVERY SYSTEM:
|
* AUTO-DISCOVERY SYSTEM:
|
||||||
* 1. Server creates storage/rsx-ide-bridge/domain.txt on first web request
|
* 1. Server creates system/storage/rsx-ide-bridge/domain.txt on first web request
|
||||||
* 2. Client reads domain.txt to discover server URL
|
* 2. Client reads domain.txt to discover server URL
|
||||||
* 3. Falls back to VS Code setting: rspade.serverUrl
|
* 3. Falls back to VS Code setting: rspade.serverUrl
|
||||||
* 4. Auto-retries with refreshed URL on connection failure
|
* 4. Auto-retries with refreshed URL on connection failure
|
||||||
@@ -119,6 +119,46 @@ export class IdeBridgeClient {
|
|||||||
return this.request('/_ide/service/resolve_url', { url }, 'GET');
|
return this.request('/_ide/service/resolve_url', { url }, 'GET');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a JavaScript class extends another class (anywhere in the inheritance chain)
|
||||||
|
*
|
||||||
|
* @param subclass The potential subclass name
|
||||||
|
* @param superclass The potential superclass name
|
||||||
|
* @returns Promise with { is_subclass: boolean }
|
||||||
|
*/
|
||||||
|
public async js_is_subclass_of(subclass: string, superclass: string): Promise<{ is_subclass: boolean }> {
|
||||||
|
return this.request('/_ide/service/js_is_subclass_of', { subclass, superclass }, 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a PHP class extends another class (anywhere in the inheritance chain)
|
||||||
|
*
|
||||||
|
* @param subclass The potential subclass name
|
||||||
|
* @param superclass The potential superclass name
|
||||||
|
* @returns Promise with { is_subclass: boolean }
|
||||||
|
*/
|
||||||
|
public async php_is_subclass_of(subclass: string, superclass: string): Promise<{ is_subclass: boolean }> {
|
||||||
|
return this.request('/_ide/service/php_is_subclass_of', { subclass, superclass }, 'GET');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger incremental manifest build
|
||||||
|
*
|
||||||
|
* Calls Manifest::init() on the server to update the manifest cache.
|
||||||
|
* Does NOT clear the manifest, just performs incremental update of changed files.
|
||||||
|
*
|
||||||
|
* @returns Promise with { success: boolean }
|
||||||
|
*/
|
||||||
|
public async manifest_build(): Promise<{ success: boolean }> {
|
||||||
|
try {
|
||||||
|
return await this.request('/_ide/service/manifest_build', {}, 'GET');
|
||||||
|
} catch (error: any) {
|
||||||
|
// Log to console but don't throw - errors are silent to user
|
||||||
|
console.warn('[IdeBridge] Manifest build failed:', error.message);
|
||||||
|
return { success: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async make_request_with_retry(
|
private async make_request_with_retry(
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
data: any,
|
data: any,
|
||||||
@@ -145,9 +185,14 @@ export class IdeBridgeClient {
|
|||||||
if (retry_count === 0) {
|
if (retry_count === 0) {
|
||||||
const error_msg = error.message || '';
|
const error_msg = error.message || '';
|
||||||
|
|
||||||
// Session expired or signature invalid - recreate session
|
// Authentication failure - recreate session
|
||||||
if (error_msg.includes('Session not found') || error_msg.includes('Invalid signature')) {
|
// Handles: "Session not found", "Invalid signature", "Authentication required"
|
||||||
this.output_channel.appendLine('Session/signature error, recreating session...');
|
// or any HTTP 401 response
|
||||||
|
if (error_msg.includes('Session not found') ||
|
||||||
|
error_msg.includes('Invalid signature') ||
|
||||||
|
error_msg.includes('Authentication required') ||
|
||||||
|
error_msg.includes('HTTP 401')) {
|
||||||
|
this.output_channel.appendLine('Authentication failed, recreating session...');
|
||||||
this.auth_data = null;
|
this.auth_data = null;
|
||||||
return this.make_request_with_retry(endpoint, data, method, retry_count + 1);
|
return this.make_request_with_retry(endpoint, data, method, retry_count + 1);
|
||||||
}
|
}
|
||||||
@@ -367,7 +412,7 @@ export class IdeBridgeClient {
|
|||||||
throw new Error('RSpade project root not found');
|
throw new Error('RSpade project root not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const domain_file = path.join(rspade_root, 'storage', 'rsx-ide-bridge', 'domain.txt');
|
const domain_file = path.join(rspade_root, 'system', 'storage', 'rsx-ide-bridge', 'domain.txt');
|
||||||
this.output_channel.appendLine(`Checking for domain file: ${domain_file}`);
|
this.output_channel.appendLine(`Checking for domain file: ${domain_file}`);
|
||||||
|
|
||||||
if (await exists(domain_file)) {
|
if (await exists(domain_file)) {
|
||||||
@@ -380,7 +425,7 @@ export class IdeBridgeClient {
|
|||||||
// domain.txt doesn't exist yet - schedule retry
|
// domain.txt doesn't exist yet - schedule retry
|
||||||
this.schedule_retry();
|
this.schedule_retry();
|
||||||
this.show_detailed_error();
|
this.show_detailed_error();
|
||||||
throw new Error('RSpade: storage/rsx-ide-bridge/domain.txt not found. Please load site in browser or configure server URL.');
|
throw new Error('RSpade: system/storage/rsx-ide-bridge/domain.txt not found. Please load site in browser or configure server URL.');
|
||||||
}
|
}
|
||||||
|
|
||||||
private async negotiate_protocol(url_or_hostname: string): Promise<string> {
|
private async negotiate_protocol(url_or_hostname: string): Promise<string> {
|
||||||
@@ -483,7 +528,7 @@ export class IdeBridgeClient {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const domain_file = path.join(rspade_root, 'storage', 'rsx-ide-bridge', 'domain.txt');
|
const domain_file = path.join(rspade_root, 'system', 'storage', 'rsx-ide-bridge', 'domain.txt');
|
||||||
const domain_dir = path.dirname(domain_file);
|
const domain_dir = path.dirname(domain_file);
|
||||||
|
|
||||||
// Watch the directory (file might not exist yet)
|
// Watch the directory (file might not exist yet)
|
||||||
@@ -531,10 +576,11 @@ export class IdeBridgeClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const folder of vscode.workspace.workspaceFolders) {
|
for (const folder of vscode.workspace.workspaceFolders) {
|
||||||
// Try new structure first
|
// Try new structure first - check for system/app/RSpade
|
||||||
const system_app_rspade = path.join(folder.uri.fsPath, 'system', 'app', 'RSpade');
|
const system_app_rspade = path.join(folder.uri.fsPath, 'system', 'app', 'RSpade');
|
||||||
if (fs.existsSync(system_app_rspade)) {
|
if (fs.existsSync(system_app_rspade)) {
|
||||||
return path.join(folder.uri.fsPath, 'system');
|
// Return project root (not system directory)
|
||||||
|
return folder.uri.fsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to legacy structure
|
// Fall back to legacy structure
|
||||||
@@ -576,7 +622,7 @@ export class IdeBridgeClient {
|
|||||||
this.output_channel.appendLine('\nThe extension needs to know your development server URL.');
|
this.output_channel.appendLine('\nThe extension needs to know your development server URL.');
|
||||||
this.output_channel.appendLine('\nPlease do ONE of the following:\n');
|
this.output_channel.appendLine('\nPlease do ONE of the following:\n');
|
||||||
this.output_channel.appendLine('1. Load your site in a web browser');
|
this.output_channel.appendLine('1. Load your site in a web browser');
|
||||||
this.output_channel.appendLine(' This will auto-create: storage/rsx-ide-bridge/domain.txt\n');
|
this.output_channel.appendLine(' This will auto-create: system/storage/rsx-ide-bridge/domain.txt\n');
|
||||||
this.output_channel.appendLine('2. Set VS Code setting: rspade.serverUrl');
|
this.output_channel.appendLine('2. Set VS Code setting: rspade.serverUrl');
|
||||||
this.output_channel.appendLine(' File → Preferences → Settings → Search "rspade"');
|
this.output_channel.appendLine(' File → Preferences → Settings → Search "rspade"');
|
||||||
this.output_channel.appendLine(' Set to your development URL (e.g., https://myapp.test)\n');
|
this.output_channel.appendLine(' Set to your development URL (e.g., https://myapp.test)\n');
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ const LIFECYCLE_DOCS: { [key: string]: string } = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache for lineage lookups
|
* Cache for subclass checks
|
||||||
*/
|
*/
|
||||||
const lineage_cache = new Map<string, string[]>();
|
const subclass_cache = new Map<string, boolean>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IDE Bridge client instance (shared across all providers)
|
* IDE Bridge client instance (shared across all providers)
|
||||||
@@ -44,12 +44,14 @@ const lineage_cache = new Map<string, string[]>();
|
|||||||
let ide_bridge_client: IdeBridgeClient | null = null;
|
let ide_bridge_client: IdeBridgeClient | null = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get JavaScript class lineage from backend via IDE bridge
|
* Check if a JavaScript class extends another class (anywhere in inheritance chain)
|
||||||
*/
|
*/
|
||||||
async function get_js_lineage(class_name: string): Promise<string[]> {
|
async function is_subclass_of_jqhtml_component(class_name: string): Promise<boolean> {
|
||||||
|
const cache_key = `${class_name}:Jqhtml_Component`;
|
||||||
|
|
||||||
// Check cache first
|
// Check cache first
|
||||||
if (lineage_cache.has(class_name)) {
|
if (subclass_cache.has(cache_key)) {
|
||||||
return lineage_cache.get(class_name)!;
|
return subclass_cache.get(cache_key)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize IDE bridge client if needed
|
// Initialize IDE bridge client if needed
|
||||||
@@ -59,16 +61,16 @@ async function get_js_lineage(class_name: string): Promise<string[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await ide_bridge_client.request('/_ide/service/js_lineage', { class: class_name });
|
const response = await ide_bridge_client.js_is_subclass_of(class_name, 'Jqhtml_Component');
|
||||||
const lineage = response.lineage || [];
|
const is_subclass = response.is_subclass || false;
|
||||||
|
|
||||||
// Cache the result
|
// Cache the result
|
||||||
lineage_cache.set(class_name, lineage);
|
subclass_cache.set(cache_key, is_subclass);
|
||||||
|
|
||||||
return lineage;
|
return is_subclass;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
// Re-throw error to fail loud - no silent fallbacks
|
// Re-throw error to fail loud - no silent fallbacks
|
||||||
throw new Error(`Failed to get JS lineage for ${class_name}: ${error.message}`);
|
throw new Error(`Failed to check if ${class_name} extends Jqhtml_Component: ${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,17 +166,15 @@ export class JqhtmlLifecycleSemanticTokensProvider implements vscode.DocumentSem
|
|||||||
const is_jqhtml = directly_extends_jqhtml(text);
|
const is_jqhtml = directly_extends_jqhtml(text);
|
||||||
console.log(`[JQHTML] Directly extends Jqhtml_Component: ${is_jqhtml}`);
|
console.log(`[JQHTML] Directly extends Jqhtml_Component: ${is_jqhtml}`);
|
||||||
|
|
||||||
// If not directly extending, check lineage
|
// If not directly extending, check inheritance chain
|
||||||
let extends_jqhtml = is_jqhtml;
|
let extends_jqhtml = is_jqhtml;
|
||||||
|
|
||||||
if (!is_jqhtml && has_extends_clause(text)) {
|
if (!is_jqhtml && has_extends_clause(text)) {
|
||||||
const class_name = extract_class_name(text);
|
const class_name = extract_class_name(text);
|
||||||
console.log(`[JQHTML] Checking lineage for class: ${class_name}`);
|
console.log(`[JQHTML] Checking inheritance for class: ${class_name}`);
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
const lineage = await get_js_lineage(class_name);
|
extends_jqhtml = await is_subclass_of_jqhtml_component(class_name);
|
||||||
console.log(`[JQHTML] Lineage: ${JSON.stringify(lineage)}`);
|
console.log(`[JQHTML] Extends Jqhtml_Component via inheritance: ${extends_jqhtml}`);
|
||||||
extends_jqhtml = lineage.includes('Jqhtml_Component');
|
|
||||||
console.log(`[JQHTML] Extends Jqhtml_Component via lineage: ${extends_jqhtml}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,8 +286,7 @@ export class JqhtmlLifecycleHoverProvider implements vscode.HoverProvider {
|
|||||||
if (!is_jqhtml) {
|
if (!is_jqhtml) {
|
||||||
const class_name = extract_class_name(text);
|
const class_name = extract_class_name(text);
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
const lineage = await get_js_lineage(class_name);
|
extends_jqhtml = await is_subclass_of_jqhtml_component(class_name);
|
||||||
extends_jqhtml = lineage.includes('Jqhtml_Component');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,8 +384,7 @@ export class JqhtmlLifecycleDiagnosticProvider {
|
|||||||
if (!is_jqhtml) {
|
if (!is_jqhtml) {
|
||||||
const class_name = extract_class_name(text);
|
const class_name = extract_class_name(text);
|
||||||
if (class_name) {
|
if (class_name) {
|
||||||
const lineage = await get_js_lineage(class_name);
|
extends_jqhtml = await is_subclass_of_jqhtml_component(class_name);
|
||||||
extends_jqhtml = lineage.includes('Jqhtml_Component');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
node_modules/.package-lock.json
generated
vendored
34
node_modules/.package-lock.json
generated
vendored
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "html",
|
"name": "system",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
@@ -2227,9 +2227,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/core": {
|
"node_modules/@jqhtml/core": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.2.142.tgz",
|
||||||
"integrity": "sha512-GViirzsF3VfYe7boTyeP35VxhrWSkerbghnzrPwdag+9LrDKqjc76tDCP8XtO7ddgVlm/VDZpvUQQUXEd57eDA==",
|
"integrity": "sha512-8X1p+z82Y1sRm6pp7tfuakfN43xx0BgIEXf2Wz/C6mTSn8pygmOREE8Leodwdy9EQtZXif8N8Qmtz50s7X4wjA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
@@ -2253,9 +2253,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/parser": {
|
"node_modules/@jqhtml/parser": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.2.142.tgz",
|
||||||
"integrity": "sha512-DC1GlzZvMhlqxJDNjJ184r+h21W+HhS6GRcG2W/Eo75LnmehakMG9yO4WHeZ9809isl/7+fEwZbk2jM+FD3KVA==",
|
"integrity": "sha512-ATn7qrZPWNi/G2WkDUchicGyCTqDLKFYjfE69ckie5S+zRS8zTAUJSS60N+LzUdwgM5N9v8V7C//6P85fggYuw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/jest": "^29.5.11",
|
"@types/jest": "^29.5.11",
|
||||||
@@ -2273,9 +2273,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/router": {
|
"node_modules/@jqhtml/router": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/router/-/router-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/router/-/router-2.2.142.tgz",
|
||||||
"integrity": "sha512-ybiQ6SRZxbYDPwrOML99T9gWJqNM2w43QnptJwWMg+E2zvAr48KpVJhcNJlsOlqGykME5PJOvxioMdMlfaEG5A==",
|
"integrity": "sha512-x9gCid0jvkMWFKSbFEcFl6iygFGiDtYbZBai5LOBipUMXUlQw13rJv+ZBe1W+SM2PorUTuJXoTY6O+OxDJS/1g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
@@ -2293,21 +2293,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/vscode-extension": {
|
"node_modules/@jqhtml/vscode-extension": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.2.142.tgz",
|
||||||
"integrity": "sha512-9xM9/JqXKestgeivCCWfr49RD0D279ZG/K/PxU2u4kc+mE1kEwpkmVnN4QGGw4rzXUjPFdIoG3ogaMY2gRjFew==",
|
"integrity": "sha512-3A8dOjpK01SgxMC3rTjgHNgRvQLKHdBnGFlWCu2Qk1f70DqTHGGwPUbWHNEQcpQw3LhjINYF8WQ8yu/Dkl9Qnw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.74.0"
|
"vscode": "^1.74.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/webpack-loader": {
|
"node_modules/@jqhtml/webpack-loader": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.2.142.tgz",
|
||||||
"integrity": "sha512-kSWsTnGa5USX8HKFYdAhfdAD5l/UiIwBJXmUZeLYaLSZvCePBEMfrk9rKbPtfkpNrbTnHhipF6DZmSOElmoPAg==",
|
"integrity": "sha512-SUTREV2M1bUJb5s9h4b4q6cTDAl6EBtbPk7J2hMFpy7XwKpv68DVI2lCAOVOwjM1xQXDiTGOM+0gwWqwzEqE+w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jqhtml/parser": "2.2.137",
|
"@jqhtml/parser": "2.2.142",
|
||||||
"@types/loader-utils": "^2.0.6",
|
"@types/loader-utils": "^2.0.6",
|
||||||
"@types/node": "^20.0.0",
|
"@types/node": "^20.0.0",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
|
|||||||
2
node_modules/@jqhtml/core/dist/index.cjs
generated
vendored
2
node_modules/@jqhtml/core/dist/index.cjs
generated
vendored
@@ -2728,7 +2728,7 @@ function init(jQuery) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Version - will be replaced during build with actual version from package.json
|
// Version - will be replaced during build with actual version from package.json
|
||||||
const version = '2.2.137';
|
const version = '2.2.142';
|
||||||
// Default export with all functionality
|
// Default export with all functionality
|
||||||
const jqhtml = {
|
const jqhtml = {
|
||||||
// Core
|
// Core
|
||||||
|
|||||||
2
node_modules/@jqhtml/core/dist/index.js
generated
vendored
2
node_modules/@jqhtml/core/dist/index.js
generated
vendored
@@ -2724,7 +2724,7 @@ function init(jQuery) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Version - will be replaced during build with actual version from package.json
|
// Version - will be replaced during build with actual version from package.json
|
||||||
const version = '2.2.137';
|
const version = '2.2.142';
|
||||||
// Default export with all functionality
|
// Default export with all functionality
|
||||||
const jqhtml = {
|
const jqhtml = {
|
||||||
// Core
|
// Core
|
||||||
|
|||||||
4
node_modules/@jqhtml/core/dist/jqhtml-core.esm.js
generated
vendored
4
node_modules/@jqhtml/core/dist/jqhtml-core.esm.js
generated
vendored
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* JQHTML Core v2.2.137
|
* JQHTML Core v2.2.142
|
||||||
* (c) 2025 JQHTML Team
|
* (c) 2025 JQHTML Team
|
||||||
* Released under the MIT License
|
* Released under the MIT License
|
||||||
*/
|
*/
|
||||||
@@ -2729,7 +2729,7 @@ function init(jQuery) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Version - will be replaced during build with actual version from package.json
|
// Version - will be replaced during build with actual version from package.json
|
||||||
const version = '2.2.137';
|
const version = '2.2.142';
|
||||||
// Default export with all functionality
|
// Default export with all functionality
|
||||||
const jqhtml = {
|
const jqhtml = {
|
||||||
// Core
|
// Core
|
||||||
|
|||||||
2
node_modules/@jqhtml/core/package.json
generated
vendored
2
node_modules/@jqhtml/core/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jqhtml/core",
|
"name": "@jqhtml/core",
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"description": "Core runtime library for JQHTML",
|
"description": "Core runtime library for JQHTML",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
2
node_modules/@jqhtml/parser/dist/codegen.js
generated
vendored
2
node_modules/@jqhtml/parser/dist/codegen.js
generated
vendored
@@ -1201,7 +1201,7 @@ export class CodeGenerator {
|
|||||||
for (const [name, component] of this.components) {
|
for (const [name, component] of this.components) {
|
||||||
code += `// Component: ${name}\n`;
|
code += `// Component: ${name}\n`;
|
||||||
code += `jqhtml_components.set('${name}', {\n`;
|
code += `jqhtml_components.set('${name}', {\n`;
|
||||||
code += ` _jqhtml_version: '2.2.137',\n`; // Version will be replaced during build
|
code += ` _jqhtml_version: '2.2.142',\n`; // Version will be replaced during build
|
||||||
code += ` name: '${name}',\n`;
|
code += ` name: '${name}',\n`;
|
||||||
code += ` tag: '${component.tagName}',\n`;
|
code += ` tag: '${component.tagName}',\n`;
|
||||||
code += ` defaultAttributes: ${this.serializeAttributeObject(component.defaultAttributes)},\n`;
|
code += ` defaultAttributes: ${this.serializeAttributeObject(component.defaultAttributes)},\n`;
|
||||||
|
|||||||
2
node_modules/@jqhtml/parser/package.json
generated
vendored
2
node_modules/@jqhtml/parser/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jqhtml/parser",
|
"name": "@jqhtml/parser",
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"description": "JQHTML template parser - converts templates to JavaScript",
|
"description": "JQHTML template parser - converts templates to JavaScript",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
2
node_modules/@jqhtml/router/dist/jqhtml-router.esm.js
generated
vendored
2
node_modules/@jqhtml/router/dist/jqhtml-router.esm.js
generated
vendored
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* JQHTML Router v2.2.137
|
* JQHTML Router v2.2.142
|
||||||
* (c) 2025 JQHTML Team
|
* (c) 2025 JQHTML Team
|
||||||
* Released under the MIT License
|
* Released under the MIT License
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
node_modules/@jqhtml/router/package.json
generated
vendored
2
node_modules/@jqhtml/router/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jqhtml/router",
|
"name": "@jqhtml/router",
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"description": "Client-side routing for JQHTML applications",
|
"description": "Client-side routing for JQHTML applications",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
2
node_modules/@jqhtml/vscode-extension/.version
generated
vendored
2
node_modules/@jqhtml/vscode-extension/.version
generated
vendored
@@ -1 +1 @@
|
|||||||
2.2.137
|
2.2.142
|
||||||
|
|||||||
BIN
node_modules/@jqhtml/vscode-extension/jqhtml-vscode-extension-2.2.137.vsix
generated
vendored
BIN
node_modules/@jqhtml/vscode-extension/jqhtml-vscode-extension-2.2.137.vsix
generated
vendored
Binary file not shown.
BIN
node_modules/@jqhtml/vscode-extension/jqhtml-vscode-extension-2.2.142.vsix
generated
vendored
Executable file
BIN
node_modules/@jqhtml/vscode-extension/jqhtml-vscode-extension-2.2.142.vsix
generated
vendored
Executable file
Binary file not shown.
10
node_modules/@jqhtml/vscode-extension/out/componentIndex.js
generated
vendored
10
node_modules/@jqhtml/vscode-extension/out/componentIndex.js
generated
vendored
@@ -44,6 +44,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.JqhtmlComponentIndex = void 0;
|
exports.JqhtmlComponentIndex = void 0;
|
||||||
const vscode = __importStar(require("vscode"));
|
const vscode = __importStar(require("vscode"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
/**
|
/**
|
||||||
* JQHTML Component Indexer
|
* JQHTML Component Indexer
|
||||||
*
|
*
|
||||||
@@ -97,6 +98,11 @@ class JqhtmlComponentIndex {
|
|||||||
const files = yield vscode.workspace.findFiles(new vscode.RelativePattern(folder, '**/*.jqhtml'), new vscode.RelativePattern(folder, '**/node_modules/**'));
|
const files = yield vscode.workspace.findFiles(new vscode.RelativePattern(folder, '**/*.jqhtml'), new vscode.RelativePattern(folder, '**/node_modules/**'));
|
||||||
allFiles.push(...files);
|
allFiles.push(...files);
|
||||||
}
|
}
|
||||||
|
// Debug: Log all discovered files
|
||||||
|
console.log(`JQHTML: Found ${allFiles.length} .jqhtml files to index:`);
|
||||||
|
allFiles.forEach(uri => {
|
||||||
|
console.log(` - ${uri.fsPath}`);
|
||||||
|
});
|
||||||
// Index each file
|
// Index each file
|
||||||
const promises = allFiles.map(uri => this.indexFile(uri));
|
const promises = allFiles.map(uri => this.indexFile(uri));
|
||||||
yield Promise.all(promises);
|
yield Promise.all(promises);
|
||||||
@@ -155,8 +161,8 @@ class JqhtmlComponentIndex {
|
|||||||
position: new vscode.Position(lineNum, charPos),
|
position: new vscode.Position(lineNum, charPos),
|
||||||
line: line.trim()
|
line: line.trim()
|
||||||
});
|
});
|
||||||
// Debug: Log each component as it's indexed (commented out - too verbose)
|
// Debug: Log each component as it's indexed
|
||||||
// console.log(`JQHTML Index: Indexed "${componentName}" from ${path.basename(uri.fsPath)}:${lineNum + 1}`);
|
console.log(`JQHTML Index: Indexed "${componentName}" from ${path.basename(uri.fsPath)}:${lineNum + 1}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
node_modules/@jqhtml/vscode-extension/out/componentIndex.js.map
generated
vendored
2
node_modules/@jqhtml/vscode-extension/out/componentIndex.js.map
generated
vendored
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"componentIndex.js","sourceRoot":"","sources":["../src/componentIndex.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAcjC;;;;;GAKG;AACH,MAAa,oBAAoB;IAK7B;QAJQ,iBAAY,GAAqC,IAAI,GAAG,EAAE,CAAC;QAK/D,yBAAyB;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,qCAAqC;QACrC,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,gBAAgB;QACpB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;QAE3E,uDAAuD;QACvD,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,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
node_modules/@jqhtml/vscode-extension/out/definitionProvider.js
generated
vendored
@@ -69,6 +69,19 @@ class JqhtmlDefinitionProvider {
|
|||||||
console.log(`JQHTML: In $ attribute context:`, dollarAttrResult);
|
console.log(`JQHTML: In $ attribute context:`, dollarAttrResult);
|
||||||
return yield this.handleDollarAttributeDefinition(document, position, dollarAttrResult);
|
return yield this.handleDollarAttributeDefinition(document, position, dollarAttrResult);
|
||||||
}
|
}
|
||||||
|
// IMPORTANT: Check for slot syntax BEFORE extracting word
|
||||||
|
// This prevents slot names from being treated as component names
|
||||||
|
// Check if we're in a slot tag by looking for <# or </# before cursor
|
||||||
|
const beforeCursor = line.substring(0, position.character);
|
||||||
|
if (beforeCursor.match(/<\/?#\s*[A-Z][A-Za-z0-9_]*$/)) {
|
||||||
|
// We're in a slot tag - extract the full slot name from the line
|
||||||
|
const slotNameMatch = line.match(/<\/?#\s*([A-Z][A-Za-z0-9_]*)/);
|
||||||
|
if (slotNameMatch) {
|
||||||
|
const slotName = slotNameMatch[1];
|
||||||
|
console.log(`JQHTML: Detected slot tag syntax for slot: ${slotName}`);
|
||||||
|
return yield this.handleSlotDefinition(document, position, slotName);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Get the word at the cursor position
|
// Get the word at the cursor position
|
||||||
const wordRange = document.getWordRangeAtPosition(position, /[A-Z][A-Za-z0-9_]*/);
|
const wordRange = document.getWordRangeAtPosition(position, /[A-Z][A-Za-z0-9_]*/);
|
||||||
if (!wordRange) {
|
if (!wordRange) {
|
||||||
@@ -119,11 +132,6 @@ class JqhtmlDefinitionProvider {
|
|||||||
if (beforeWord.match(/<\/\s*$/) || beforeWord.match(/<\/Define:\s*$/)) {
|
if (beforeWord.match(/<\/\s*$/) || beforeWord.match(/<\/Define:\s*$/)) {
|
||||||
isInTagContext = true;
|
isInTagContext = true;
|
||||||
}
|
}
|
||||||
// Check for slot syntax: <#slotname> or </#slotname>
|
|
||||||
if (beforeWord.match(/<#\s*$/) || beforeWord.match(/<\/#\s*$/)) {
|
|
||||||
// This is a slot, not a component
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (!isInTagContext) {
|
if (!isInTagContext) {
|
||||||
// Also check if cursor is inside the tag name (not in attributes)
|
// Also check if cursor is inside the tag name (not in attributes)
|
||||||
const afterWord = line.substring(wordRange.end.character);
|
const afterWord = line.substring(wordRange.end.character);
|
||||||
@@ -483,6 +491,171 @@ class JqhtmlDefinitionProvider {
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Handle goto definition for slot tags (<#SlotName>)
|
||||||
|
*
|
||||||
|
* IMPLEMENTATION SCOPE (Narrow, for now):
|
||||||
|
* - Handles direct extends="ComponentName" on <Define:> tags
|
||||||
|
* - Handles direct <ComponentName> invocation tags
|
||||||
|
* - Does NOT traverse full inheritance chain (TODO: add later)
|
||||||
|
* - Just looks for direct parent component
|
||||||
|
*
|
||||||
|
* LOGIC:
|
||||||
|
* 1. Extract slot name from cursor position
|
||||||
|
* 2. Find parent component:
|
||||||
|
* - If inside <Define extends="Parent">, use Parent
|
||||||
|
* - If inside <Parent> invocation, use Parent
|
||||||
|
* 3. Find Parent.jqhtml file
|
||||||
|
* 4. Search for <%= content('SlotName') %>
|
||||||
|
* 5. Navigate to that line
|
||||||
|
*/
|
||||||
|
handleSlotDefinition(document, position, slotName) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
console.log(`JQHTML: Handling slot definition for: ${slotName}`);
|
||||||
|
// Find the parent component that defines this slot
|
||||||
|
const parentComponentName = this.findParentComponentForSlot(document, position);
|
||||||
|
if (!parentComponentName) {
|
||||||
|
console.log(`JQHTML: Could not determine parent component for slot`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
console.log(`JQHTML: Parent component for slot: ${parentComponentName}`);
|
||||||
|
// Debug: Show what's in the index
|
||||||
|
const allComponents = this.componentIndex.getAllComponentNames();
|
||||||
|
console.log(`JQHTML: Index currently contains ${allComponents.length} components:`, allComponents.join(', '));
|
||||||
|
// Find the parent component definition file
|
||||||
|
const parentComponent = this.componentIndex.findComponent(parentComponentName);
|
||||||
|
if (!parentComponent) {
|
||||||
|
console.log(`JQHTML: Parent component '${parentComponentName}' not found in index`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
console.log(`JQHTML: Found parent component file: ${parentComponent.uri.fsPath}`);
|
||||||
|
// Search for content('SlotName') in the parent component file
|
||||||
|
const slotUsageLocation = yield this.findSlotUsageInTemplate(parentComponent.uri, slotName);
|
||||||
|
if (!slotUsageLocation) {
|
||||||
|
console.log(`JQHTML: Slot usage content('${slotName}') not found in ${parentComponent.uri.fsPath}`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
console.log(`JQHTML: Found slot usage at line ${slotUsageLocation.range.start.line + 1}`);
|
||||||
|
return slotUsageLocation;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Find the parent component that should define this slot
|
||||||
|
*
|
||||||
|
* Looks for either:
|
||||||
|
* 1. <Define:ChildComponent extends="ParentComponent"> - check if slots are top-level
|
||||||
|
* 2. <ParentComponent> - find enclosing component invocation tag
|
||||||
|
*/
|
||||||
|
findParentComponentForSlot(document, position) {
|
||||||
|
const currentLine = position.line;
|
||||||
|
// Strategy 1: Look for <Define extends="ParentComponent"> where slots are at top level
|
||||||
|
// Scan upward to find the Define tag
|
||||||
|
let defineTagStartLine = -1;
|
||||||
|
for (let i = currentLine; i >= 0; i--) {
|
||||||
|
const lineText = document.lineAt(i).text;
|
||||||
|
// Check if we found a <Define:ComponentName
|
||||||
|
if (lineText.match(/<Define:([A-Z][A-Za-z0-9_]*)/)) {
|
||||||
|
defineTagStartLine = i;
|
||||||
|
console.log(`JQHTML: Found <Define: tag at line ${i + 1}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If we found a Define tag, look for extends attribute in the tag (may be multi-line)
|
||||||
|
if (defineTagStartLine >= 0) {
|
||||||
|
// Collect all lines from Define tag start until we find the closing >
|
||||||
|
let tagContent = '';
|
||||||
|
for (let i = defineTagStartLine; i < document.lineCount; i++) {
|
||||||
|
const lineText = document.lineAt(i).text;
|
||||||
|
tagContent += lineText + ' ';
|
||||||
|
// Stop when we find the closing > of the opening tag
|
||||||
|
if (lineText.includes('>')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Now check if this multi-line tag has extends attribute
|
||||||
|
const extendsMatch = tagContent.match(/\bextends\s*=\s*["']([A-Z][A-Za-z0-9_]*)["']/);
|
||||||
|
if (extendsMatch) {
|
||||||
|
const parentComponentName = extendsMatch[1];
|
||||||
|
console.log(`JQHTML: Found extends="${parentComponentName}" in Define tag`);
|
||||||
|
// TODO: Verify that the slot is at top level (not nested inside other tags)
|
||||||
|
// For now, we assume if we found a Define with extends, that's the parent
|
||||||
|
return parentComponentName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log(`JQHTML: Define tag found but no extends attribute`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Strategy 2: Look for enclosing <ParentComponent> invocation tag
|
||||||
|
// Scan upward to find opening tag
|
||||||
|
let tagStack = [];
|
||||||
|
for (let i = currentLine; i >= 0; i--) {
|
||||||
|
const lineText = document.lineAt(i).text;
|
||||||
|
// Find all component tags on this line (both opening and closing)
|
||||||
|
// Component tags: <ComponentName> or </ComponentName>
|
||||||
|
const tagRegex = /<\/?([A-Z][A-Za-z0-9_]*)[^>]*>/g;
|
||||||
|
let match;
|
||||||
|
// Collect all tags on this line
|
||||||
|
const tagsOnLine = [];
|
||||||
|
while ((match = tagRegex.exec(lineText)) !== null) {
|
||||||
|
const fullMatch = match[0];
|
||||||
|
const componentName = match[1];
|
||||||
|
const isClosing = fullMatch.startsWith('</');
|
||||||
|
tagsOnLine.push({ tag: componentName, isClosing });
|
||||||
|
}
|
||||||
|
// Process tags in reverse order (right to left on the line)
|
||||||
|
for (let j = tagsOnLine.length - 1; j >= 0; j--) {
|
||||||
|
const { tag, isClosing } = tagsOnLine[j];
|
||||||
|
if (isClosing) {
|
||||||
|
// Closing tag - add to stack
|
||||||
|
tagStack.push(tag);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Opening tag
|
||||||
|
if (tagStack.length > 0 && tagStack[tagStack.length - 1] === tag) {
|
||||||
|
// This opening tag matches the last closing tag on stack - they cancel out
|
||||||
|
tagStack.pop();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// This is an unclosed opening tag - this is our parent!
|
||||||
|
console.log(`JQHTML: Found enclosing component invocation: <${tag}>`);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(`JQHTML: No parent component found for slot`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Search for <%= content('SlotName') %> in a template file
|
||||||
|
*/
|
||||||
|
findSlotUsageInTemplate(templateUri, slotName) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
const templateDoc = yield vscode.workspace.openTextDocument(templateUri);
|
||||||
|
const templateText = templateDoc.getText();
|
||||||
|
// Search for content('SlotName') or content("SlotName")
|
||||||
|
// Also handle optional whitespace
|
||||||
|
const contentRegex = new RegExp(`<%=\\s*content\\s*\\(\\s*['"]${slotName}['"]\\s*\\)`, 'g');
|
||||||
|
const match = contentRegex.exec(templateText);
|
||||||
|
if (match) {
|
||||||
|
const matchPosition = templateDoc.positionAt(match.index);
|
||||||
|
console.log(`JQHTML: Found content('${slotName}') at line ${matchPosition.line + 1}`);
|
||||||
|
// Return location pointing to the slot name within content('SlotName')
|
||||||
|
const slotNameStartIndex = match.index + match[0].indexOf(slotName);
|
||||||
|
const slotNamePosition = templateDoc.positionAt(slotNameStartIndex);
|
||||||
|
const slotNameRange = new vscode.Range(slotNamePosition, new vscode.Position(slotNamePosition.line, slotNamePosition.character + slotName.length));
|
||||||
|
return new vscode.Location(templateUri, slotNameRange);
|
||||||
|
}
|
||||||
|
console.log(`JQHTML: No content('${slotName}') found in template`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(`JQHTML: Error reading template file:`, error);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.JqhtmlDefinitionProvider = JqhtmlDefinitionProvider;
|
exports.JqhtmlDefinitionProvider = JqhtmlDefinitionProvider;
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
node_modules/@jqhtml/vscode-extension/out/definitionProvider.js.map
generated
vendored
2
node_modules/@jqhtml/vscode-extension/out/definitionProvider.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/@jqhtml/vscode-extension/package.json
generated
vendored
2
node_modules/@jqhtml/vscode-extension/package.json
generated
vendored
@@ -2,7 +2,7 @@
|
|||||||
"name": "@jqhtml/vscode-extension",
|
"name": "@jqhtml/vscode-extension",
|
||||||
"displayName": "JQHTML",
|
"displayName": "JQHTML",
|
||||||
"description": "Syntax highlighting and language support for JQHTML template files",
|
"description": "Syntax highlighting and language support for JQHTML template files",
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"publisher": "jqhtml",
|
"publisher": "jqhtml",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
4
node_modules/@jqhtml/webpack-loader/package.json
generated
vendored
4
node_modules/@jqhtml/webpack-loader/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@jqhtml/webpack-loader",
|
"name": "@jqhtml/webpack-loader",
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"description": "Webpack loader for JQHTML templates",
|
"description": "Webpack loader for JQHTML templates",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"template"
|
"template"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jqhtml/parser": "2.2.137",
|
"@jqhtml/parser": "2.2.142",
|
||||||
"@types/loader-utils": "^2.0.6",
|
"@types/loader-utils": "^2.0.6",
|
||||||
"@types/node": "^20.0.0",
|
"@types/node": "^20.0.0",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
|
|||||||
34
package-lock.json
generated
34
package-lock.json
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "html",
|
"name": "system",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
@@ -2658,9 +2658,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/core": {
|
"node_modules/@jqhtml/core": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/core/-/core-2.2.142.tgz",
|
||||||
"integrity": "sha512-GViirzsF3VfYe7boTyeP35VxhrWSkerbghnzrPwdag+9LrDKqjc76tDCP8XtO7ddgVlm/VDZpvUQQUXEd57eDA==",
|
"integrity": "sha512-8X1p+z82Y1sRm6pp7tfuakfN43xx0BgIEXf2Wz/C6mTSn8pygmOREE8Leodwdy9EQtZXif8N8Qmtz50s7X4wjA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
@@ -2684,9 +2684,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/parser": {
|
"node_modules/@jqhtml/parser": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/parser/-/parser-2.2.142.tgz",
|
||||||
"integrity": "sha512-DC1GlzZvMhlqxJDNjJ184r+h21W+HhS6GRcG2W/Eo75LnmehakMG9yO4WHeZ9809isl/7+fEwZbk2jM+FD3KVA==",
|
"integrity": "sha512-ATn7qrZPWNi/G2WkDUchicGyCTqDLKFYjfE69ckie5S+zRS8zTAUJSS60N+LzUdwgM5N9v8V7C//6P85fggYuw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/jest": "^29.5.11",
|
"@types/jest": "^29.5.11",
|
||||||
@@ -2704,9 +2704,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/router": {
|
"node_modules/@jqhtml/router": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/router/-/router-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/router/-/router-2.2.142.tgz",
|
||||||
"integrity": "sha512-ybiQ6SRZxbYDPwrOML99T9gWJqNM2w43QnptJwWMg+E2zvAr48KpVJhcNJlsOlqGykME5PJOvxioMdMlfaEG5A==",
|
"integrity": "sha512-x9gCid0jvkMWFKSbFEcFl6iygFGiDtYbZBai5LOBipUMXUlQw13rJv+ZBe1W+SM2PorUTuJXoTY6O+OxDJS/1g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
@@ -2724,21 +2724,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/vscode-extension": {
|
"node_modules/@jqhtml/vscode-extension": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/vscode-extension/-/vscode-extension-2.2.142.tgz",
|
||||||
"integrity": "sha512-9xM9/JqXKestgeivCCWfr49RD0D279ZG/K/PxU2u4kc+mE1kEwpkmVnN4QGGw4rzXUjPFdIoG3ogaMY2gRjFew==",
|
"integrity": "sha512-3A8dOjpK01SgxMC3rTjgHNgRvQLKHdBnGFlWCu2Qk1f70DqTHGGwPUbWHNEQcpQw3LhjINYF8WQ8yu/Dkl9Qnw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.74.0"
|
"vscode": "^1.74.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jqhtml/webpack-loader": {
|
"node_modules/@jqhtml/webpack-loader": {
|
||||||
"version": "2.2.137",
|
"version": "2.2.142",
|
||||||
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.2.137.tgz",
|
"resolved": "http://privatenpm.hanson.xyz/@jqhtml/webpack-loader/-/webpack-loader-2.2.142.tgz",
|
||||||
"integrity": "sha512-kSWsTnGa5USX8HKFYdAhfdAD5l/UiIwBJXmUZeLYaLSZvCePBEMfrk9rKbPtfkpNrbTnHhipF6DZmSOElmoPAg==",
|
"integrity": "sha512-SUTREV2M1bUJb5s9h4b4q6cTDAl6EBtbPk7J2hMFpy7XwKpv68DVI2lCAOVOwjM1xQXDiTGOM+0gwWqwzEqE+w==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jqhtml/parser": "2.2.137",
|
"@jqhtml/parser": "2.2.142",
|
||||||
"@types/loader-utils": "^2.0.6",
|
"@types/loader-utils": "^2.0.6",
|
||||||
"@types/node": "^20.0.0",
|
"@types/node": "^20.0.0",
|
||||||
"@types/webpack": "^5.28.5",
|
"@types/webpack": "^5.28.5",
|
||||||
|
|||||||
@@ -17,12 +17,47 @@ define('LARAVEL_START', microtime(true));
|
|||||||
|
|
||||||
$request_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
$request_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||||
|
|
||||||
// Handle new IDE service endpoints (not the legacy _idehelper which uses Laravel)
|
// Handle IDE service endpoints
|
||||||
if (str_starts_with($request_path, '/_ide/service')) {
|
if (str_starts_with($request_path, '/_ide/service')) {
|
||||||
// Handle IDE services with authentication
|
// SECURITY-CRITICAL: Authenticate FIRST before any service logic
|
||||||
$service_handler = __DIR__ . '/../app/RSpade/Ide/Services/handler.php';
|
// This checks session auth OR localhost bypass before proceeding
|
||||||
if (file_exists($service_handler)) {
|
require_once __DIR__ . '/../app/RSpade/Ide/Services/auth.php';
|
||||||
require_once $service_handler;
|
|
||||||
|
// If we reach here, authentication passed (auth.php exits on failure)
|
||||||
|
|
||||||
|
// SECURITY: Explicit whitelist only - handlers must be explicitly defined here.
|
||||||
|
// User input (service name) determines WHICH handler, but cannot inject arbitrary paths.
|
||||||
|
// TODO: Improve the design of this subsystem invocation later.
|
||||||
|
|
||||||
|
// Extract service name
|
||||||
|
$service_name = str_replace('/_ide/service', '', $request_path);
|
||||||
|
$service_name = trim($service_name, '/');
|
||||||
|
|
||||||
|
// Whitelist of allowed handlers
|
||||||
|
$allowed_handlers = [
|
||||||
|
'format' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'definition' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'complete' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'exec' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'command' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'resolve_class' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'git' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
'git/diff' => __DIR__ . '/../app/RSpade/Ide/Services/handler.php',
|
||||||
|
// All other services use the Laravel handler
|
||||||
|
'default' => __DIR__ . '/../app/RSpade/Ide/Services/laravel_handler.php',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Determine which handler to use
|
||||||
|
if (isset($allowed_handlers[$service_name])) {
|
||||||
|
$handler_path = $allowed_handlers[$service_name];
|
||||||
|
} else {
|
||||||
|
// Services not explicitly listed use the Laravel handler
|
||||||
|
$handler_path = $allowed_handlers['default'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the whitelisted handler
|
||||||
|
if (file_exists($handler_path)) {
|
||||||
|
require_once $handler_path;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user