Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.14k stars 299 forks source link

PHP Include Handler Assumes Relative URLs #3710

Open ssigwart opened 5 years ago

ssigwart commented 5 years ago

Short Summary

The following code only works for relative include paths or absolute paths. https://github.com/Komodo/KomodoEdit/blob/3a6fd631da21003af89b9f9bb855d936c753411c/src/chrome/komodo/content/hyperlinks/filehandler.js#L220-L223

Steps to Reproduce

Set up a PHP project with www and includes top level folders. Add www/index.php which includes require_once('MyClass.class.php'); . Add includes/MyClass.class.php. In www/index.php, click the hyperlink to MyClass.class.php.

Expected Desired results

includes/MyClass.class.php should open.

Actual results

Error message that file can't be found.

Platform Information

Doesn't matter.

Additional Information

Ideally, it would know the PHP include paths, but that's impractical since set_include_path can be used anywhere in the PHP code. @cgchoffman or @Naatan, do you have any objections to me adding a Project level preference to add a list of include paths? Then I can update filehandler.js to use alternativePaths of filename_jump_handler.

th3coop commented 5 years ago

@ssigwart, can you use Prefs > Languages > PHP > PHP Directories?

ssigwart commented 5 years ago

I think I'd run into problems there. The directories are already included and scanned, it's just that filename_jump_handler doesn't know the exact location of the files. I didn't test it, but I'm pretty sure it doesn't look at that setting to find the file.

th3coop commented 5 years ago

but I'm pretty sure it doesn't look at that setting to find the file.

yeah exactly. I was thinking change filename_jump_handler to use it but it seems so specific to have a pref that says "I'll have files here, and here, and here and here". I wonder if this could hook into the Commando Files scope. @Naatan, I just had a look at the Files scope code to see if it could be used here but the search code that takes a onComplete function doesn't receive anything from the search.

Is there a way that code that's not part of that scope to use the cached structure to quickly find a file in the project?