Giter Club home page Giter Club logo

php-ide-serenata's People

Contributors

adtc avatar bpedroza avatar dependabot[bot] avatar dipyalov avatar gert-dev avatar hultberg avatar m-bobrowicz avatar machitgarha avatar sjuvonen avatar uzitech avatar vinkla avatar wcatron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-ide-serenata's Issues

Uncaught Unexpected end of input

Atom Version: 1.2.1
System: Mac OS X 10.11
Thrown From: php-integrator-base package, v0.2.0

Stack Trace

Uncaught Unexpected end of input

At /Users/xxxx/.atom/packages/php-integrator-base/lib/Proxy.coffee:57

undefined

Commands

     -2:31.7.0 core:backspace (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
     -2:31.4.0 core:move-right (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
  2x -2:31.1.0 core:backspace (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
     -2:30.3.0 core:move-right (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
     -2:28.1.0 core:backspace (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
     -2:27.2.0 core:save (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
     -1:50.4.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -1:47.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:47.6.0 php-integrator-base:configuration (atom-text-editor.editor)
     -1:42.5.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -1:34.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:34.6.0 php-integrator-base:configuration (atom-text-editor.editor)
  4x -0:58.7.0 symbols-view:go-to-declaration (atom-text-editor.editor.is-focused)
     -0:09.8.0 core:move-left (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
  2x -0:07.5.0 core:move-right (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)
     -0:05.6.0 core:save (atom-text-editor#php-integrator-base.additionalScripts.editor.mini.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  },
  "php-integrator-base": {
    "composerCommand": "/usr/local/bin/composer.phar",
    "autoloadScripts": [
      "vendor/autoload.php"
    ],
    "classMapScripts": [
      "vendor/composer/autoload_classmap.php"
    ],
    "additionalScripts": [
      "plugins/**/*.php",
      "themes/**/*.php"
    ],
    "phpCommand": "/usr/local/php5/bin/php"
  }
}

Installed Packages

# User
angularjs, v0.3.3
atom-jade, v0.3.0
atom-material-syntax, v0.2.4
atom-material-ui, v0.8.0
autocomplete-angular-material, v0.4.0
emmet, v2.3.14
file-icons, v1.6.11
language-jade, v0.6.2
php-integrator-base, v0.2.0
php-integrator-navigation, v0.2.1
react, v0.12.10
webbox-color, v0.5.9

# Dev
No dev packages

Uncaught TypeError: Cannot read property 'getTokenIterator' of undefined

[Enter steps to reproduce below:]

  1. edit the php view.. e.g. somefile.php
  2. add php foreach block to html
<?php foreach ($sites_links as $key => $sitelink): ?>
    <li>
         <a href="<?=$sitelink['link'];?>"><?=$sitelink['name'];?></a>
    </li>
<?php endforeach; ?>

Atom Version: 1.4.0
System: Windows 10
Thrown From: php-integrator-base package, v0.4.7

Stack Trace

Uncaught TypeError: Cannot read property 'getTokenIterator' of undefined

At C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\pane.js:829

TypeError: Cannot read property 'getTokenIterator' of undefined
    at TokenizedBuffer.module.exports.TokenizedBuffer.scopeDescriptorForPosition (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\tokenized-buffer.js:694:47)
    at DisplayBuffer.module.exports.DisplayBuffer.scopeDescriptorForBufferPosition (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\display-buffer.js:832:35)
    at TextEditor.module.exports.TextEditor.scopeDescriptorForBufferPosition (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\text-editor.js:2400:33)
    at CachingParser.module.exports.Parser.determineFullClassName (file:///C:/Users/riart/.atom/packages/php-integrator-base/lib/Parser.coffee:102:38)
    at CachingParser.module.exports.CachingParser.wrapCachedRequestToParent (file:///C:/Users/riart/.atom/packages/php-integrator-base/lib/CachingParser.coffee:47:84)
    at CachingParser.module.exports.CachingParser.determineFullClassName (file:///C:/Users/riart/.atom/packages/php-integrator-base/lib/CachingParser.coffee:65:17)
    at Service.module.exports.Service.determineFullClassName (file:///C:/Users/riart/.atom/packages/php-integrator-base/lib/Service.coffee:123:24)
    at MethodProvider.module.exports.MethodProvider.registerAnnotations (file:///C:/Users/riart/.atom/packages/php-integrator-annotations/lib/MethodProvider.coffee:13:33)
    at MethodProvider.module.exports.AbstractProvider.rescan (file:///C:/Users/riart/.atom/packages/php-integrator-annotations/lib/AbstractProvider.coffee:280:10)
    at file:///C:/Users/riart/.atom/packages/php-integrator-annotations/lib/AbstractProvider.coffee:120:14
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1067:27)
    at TextBuffer.module.exports.TextBuffer.save (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1037:19)
    at TextEditor.module.exports.TextEditor.save (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\text-editor.js:602:26)
    at Pane.module.exports.Pane.saveItem (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\pane.js:534:18)
    at Pane.module.exports.Pane.saveActiveItem (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\pane.js:517:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\workspace.js:643:35)
    at atom-workspace.commandRegistry.add.core:save (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\register-default-commands.js:173:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:536:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:359:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\window-event-handler.js:97:36)
    at HTMLDocument.<anonymous> (C:\Users\riart\AppData\Local\atom\app-1.4.0\resources\app.asar\src\window-event-handler.js:3:61)

Commands

  2x -1:20.9.0 core:backspace (atom-text-editor.editor.is-focused)
  2x -1:18.4.0 core:save (atom-text-editor.editor.is-focused)
     -0:47 core:cut (atom-text-editor.editor.is-focused)
  2x -0:46.7.0 core:save (atom-text-editor.editor.is-focused)
     -0:41.6.0 core:paste (atom-text-editor.editor.is-focused)
     -0:35.2.0 core:copy (atom-text-editor.editor.is-focused)
     -0:34.7.0 core:paste (atom-text-editor.editor.is-focused)
  2x -0:34.1.0 core:save (atom-text-editor.editor.is-focused)
     -0:23.8.0 core:cut (atom-text-editor.editor.is-focused)
     -0:20.2.0 autocomplete-plus:confirm (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:19.6.0 core:paste (atom-text-editor.editor.is-focused)
     -0:18.8.0 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
  3x -0:17.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:06.5.0 core:copy (atom-text-editor.editor.is-focused)
     -0:04.4.0 core:paste (atom-text-editor.editor.is-focused)
     -0:00.9.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {},
  "php-integrator-base": {}
}

Installed Packages

# User
docs-snippets, v0.8.0
less-compiler, v0.6.2
php-integrator-annotations, v0.2.3
php-integrator-autocomplete-plus, v0.4.0
php-integrator-base, v0.4.7
php-integrator-navigation, v0.3.0
php-integrator-tooltips, v0.3.0
terminal-panel, v1.14.1

# Dev
No dev packages

How to disable adding lines to my project

I see that integrator (or one of it's components) adding lines like that to my project classes:

use ORM;
use URL;

I no need to auto adding this lines, my system was autoloading this classes and work without it.
And when this strings added my project was crashed.

How to disable this feature?

"Indexing failed!"

Using Atom 1.3.2, php-integrator-base 0.3.1.

Every time I run atom, I see "Indexing..." for a while in in the status bar. Then, when I save a file, I always see "Indexing failed!".

Steps to reproduce:

  1. $ composer create-project --prefer-dist codeigniter/framework ci
  2. $ cd ci
  3. $ atom .
  4. Open application/controllers/Welcome.php file
  5. Save the file (File -> Save or Ctrl+S)

Indexing silently fails if PHP doesn't have sqlite extension.

Underlying PHP service returns the following text:

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /Users/dip/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:
#0 /Users/dip/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('sqlite:/Users/d...', NULL, NULL, Array)
#1 /Users/dip/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php(60): Doctrine\DBAL\Driver\PDOConnection->__construct('sqlite:/Users/d...', NULL, NULL, Array)
#2 /Users/dip/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOSqlite\Driver->connect(Array, NULL, NULL, Array)
#3 /Users/dip/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(816): Doctrine\DBAL\Connection->connect()
#4 /Users/dip/.atom/packages/php-integrator-base/php/src/IndexDatabase.php(77): Doctrine\DB in /Users/dip/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 84

So indexing service tries to parse it like JSON and silently fails.

PHP-integrator should validate this issue and show a notification, so user can install all the required PHP extensions.

Stream progress when doing a full index.

By streaming output from the ReindexProvider, we can show a progress bar that actually goes to 100% instead of a so-called 'marquee' progress bar. spawnSync or exec should already be able to handle streaming.

"unable to open database file" when indexes directory does not exist

PHP backend throws a Fatal Error when the 'indexes' directory does not exist. Manually creating directory seems to solve the problem.

Steps to reproduce:
  1. Remove indexes directory if exists.
  2. Run from command line:
/usr/bin/php -d memory_limit=-1 ~/.atom/packages/php-integrator-base/lib/../php/src/Main.php ~/.atom/packages/php-integrator-base/indexes/PROJECT_DB_HASH.sqlite --reindex PATH_TO_PHP_PROJECT --stream-progress

Sample output:

PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [14] unable to open database file' in /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
Stack trace:
#0 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('sqlite:/home/to...', NULL, NULL, Array)
#1 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php(60): Doctrine\DBAL\Driver\PDOConnection->__construct('sqlite:/home/to...', NULL, NULL, Array)
#2 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOSqlite\Driver->connect(Array, NULL, NULL, Array)
#3 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(780): Doctrine\DBAL\Connection->connect()
#4 /home/tocjent/.atom/packages/php-integrator-b in /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 81

Interfaces are cheating and can extend multiple other interfaces.

The IndexDataAdapter assumes that every structural element can have at most one base class, but apparently interfaces can use the extends keyword to extend multiple interfaces at the same time.

There are several things that need to be modified to accomodate this:

  • OutlineIndexingVisitor needs to be able to return multiple parents.
  • DependencyFetchingVisitor needs to fetch the multiple parents and list them as dependency.
  • Indexer must take multiple dependencies into account when doing topological sorting (might already happen automatically).
  • Update getParentFqsens in getParentFqsens.
  • IndexDataAdapter must be updated to inherit from multiple base structural elements.

No proper way to handle properties and methods with the same name.

When a class has a method and property with the same name, problems arise:

$foo->testMe();
$foo->testMe = 5;

Previously all class members were returned in one large associative array, making arrays of members that had the same name. With commit d1cad92, methods and properties are now returned in separate associative arrays, more elegantly dealing with this problem. However, the CoffeeScript side only uses getClassMember, which checks these associative arrays and just returns the first match it can find. Whether or not we're dealing with the property or method depends on the context of the code (i.e. parentheses at the end or not). Perhaps getClassMemberAt can check the scope or check for an opening parenthesis and ask the Parser for respectively a property or a method to disambiguate the query.

Only list void as a return type when there is a docblock, but no return tag.

Functions and methods that omit the @return tag in their docblock automatically return void. However, built-in PHP functions and method from built-in classes do not have any docblock at all. These should not be receiving void as return type, but rather null (i.e. the type is unknown). The same applies to functions and methods that have no docblock at all.

Indexing failed when adding _ide_helper.php

_ide_helper is a handy-dandy tool for making laravel's facades work a little more nicely with autocompletion and code navigation. Unfortunately, i get "Indexing failed" when i try to add it to the "additional scripts" section in php-integrator-base's settings.

Any idea what might be the problem?

I'm fairly new to Atom, so unfortunately i'm at a loss for debugging this myself, otherwise i would spend a bit more time. If you can point me in the right direction to get started debugging this, i'd be happy to resolve this.

Also use descriptions placed after the @var statement for properties.

Currently, descriptions after the @var statement are parsed, but they are not actually used, for example, this works and shows the correct description:

/**
 * A short description.
 *
 * @var Foo
 */
protected $foo;

But this doesn't:

/**
 * @var Foo A short description.
 */
protected $foo;

When both are present, we should probably just use the last one present (i.e. the one after the @var tag) as this is ambiguous information and should be fixed in the user's docblock.

Check if statements for 'instanceof' to determine the type of variables.

Whenever an if statement with an instanceof of a variable shows up, we can deduce its type correctly (assuming that it's not being overridden or reassigned afterwards):

if ($someCondition && ($foo instanceof My\Foo\Class) || $someOtherCondition) {
    // We can now show autocompletion for My\Foo\Class on $foo->...
}

Callables are actually of type 'Closure'.

When using callables, that are actually defined by setting a variable to an anonymous function (closure), you're actually getting an object of type Closure, for example:

$test = function () {};
$test->bindTo($this);

This would need to be modified in getResultingTypeFromCallStack so it picks up closures and returns their type as \Closure.

Correctly deduce the type of standalone function calls.

With 1d1867b it is now possible to have include files with global helper functions that contain docblocks. However, the type information from the docblock is not used in call stacks, for example:

/**
 * @return \DateTime
 */
function helper() { ... }

$test = helper();
$test-> // No autocompletion, the type of '$test' is 'helper()' instead of \DateTime.
helper()-> // No autocompletion for \DateTime either.

Failed to load the php-integrator-base package

[Enter steps to reproduce below:]

  1. Clone the latest into packages (which according to changelog is 0.4 and package.json is 0.3.1?)
  2. Open Atom

Atom Version: 1.3.2
System: Mac OS X 10.11.2
Thrown From: php-integrator-base package, v0.3.1

Stack Trace

Failed to load the php-integrator-base package

At Cannot find module 'jquery'

Error: Cannot find module 'jquery'
    at Module._resolveFilename (module.js:336:15)
    at Function.Module._resolveFilename (/Applications/Atom.app/Contents/Resources/app.asar/src/module-cache.js:383:52)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
    at Object.<anonymous> (/Users/jason/.atom/packages/php-integrator-base/lib/Main.coffee:4:5)
    at Object.<anonymous> (/Users/jason/.atom/packages/php-integrator-base/lib/Main.coffee:1:1)
    at Module._compile (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:103:30)
    at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:208:21)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
    at Package.module.exports.Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:663:34)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:115:28
    at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:92:15)
    at Package.module.exports.Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:106:12)
    at PackageManager.module.exports.PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:438:14)
    at PackageManager.module.exports.PackageManager.loadPackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:390:14)
    at AtomEnvironment.module.exports.AtomEnvironment.startEditorWindow (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:682:21)
    at module.exports (/Applications/Atom.app/Contents/Resources/app.asar/src/initialize-application-window.js:28:10)
    at setupWindow (file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.js:86:5)
    at window.onload (file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.js:41:9)

Commands

Config

{
  "core": {},
  "php-integrator-base": {}
}

Installed Packages

# User
Sublime-Style-Column-Selection, v1.3.0
column-select, v0.2.0
emmet, v2.3.17
linter, v1.11.3
linter-jshint, v1.2.1
php-integrator-autocomplete-plus, v0.3.0
php-integrator-base, v0.3.1
php-integrator-tooltips, v0.2.1
pigments, v0.19.5
project-manager, v2.6.5
vim-mode, v0.64.0
vim-mode-visual-block, v0.2.14
vim-surround, v0.8.1

# Dev
No dev packages

Does this work on HackLang?

I am a HackLang user and curious if this works for it. HackLang files start with <?hh instead of <?php and have source.hack in their scope instead of source.php.

Support @return static

Right now when you use /** @return static */ as a return value it's not autocompleting the right return type. For example:

<?php

class DB {
    static public function getObjectByID($object,$id) {
        $return = new $object();
        $return->id = $id;
        return $return;
    }
}

class Model {
    var $id;
    function Model($id) {
        $this->id = $id;
    }
    /**
      * @return static
      */
    static public function getByID($id) {
        return DB::getObjectByID(get_called_class(),$id);
    }
}

class CustomModel extends Model {
    var $field;
}

CustomModel::getByID(2)->field = "Testing";

// Autocomplete thinks that CustomModel::getByID(2) returns Model instead of CustomModel.

?>

I free handed this so sorry for mistakes. I did properly separate these into different files on my actual project.

Also sorry for putting in so many issues, really enjoying using this and I'll try to contribute when I can. Right now I'm not sure how the parser even works.

Says "Incorrect Setup!" on startup, but seem to work fine.

Every time I open a project in Atom, I get the following error message popping up then closing:

Incorrect setup!
Either PHP or Composer is not correctly set up and as a result PHP integrator will not work. Please visit the settings screen to correct this error. If you are not specifying an absolute path for PHP or Composer, make sure they are in your PATH.

What's strange is the plugin seems to work properly despite this error message, I've been using it since before I started getting this message.

On a side note, this message appears on all my projects, not just the ones using PHP and Composer. Perhaps this plugin could detect if a project is using Composer, and only run for those projects.

Ability to work with projects builded w/o composer

Can it work without autoload scripts? It would be cool to have an ability to integrate with CMS and others.

I wanna to work with CakePHP 2, Bitrix, Joomla, etc.
Now it works really great with Laravel 5!

Indexing loading bar behaving oddly, more oddly then usual.

The indexing loading bar always behaved somewhat oddly, in that if you create a new Untitled document that is unrelated to a project (the default when opening Atom unless a project was open when Atom was quit), it would show the loading icon forever.

single

Nothing major as it's not there for saved files, just a little odd.

But today I go to use this plugin with my Composer project I've been working on off-and-on, after a bit of a break so I'm not sure when this would have started, I see the loading bar twice, and one actually looks different from the other.

double

Eventually, the one on the left disappears, and shortly there after the one on the right disappears also. I'm not sure if it's running twice, or just a cosmetic issue, but thought it was worth noting.

File containing multiple classes doesn't index correctly

It appears if a file containing multiple classes is indexed, only the first class is acknowledged.
e.g
TestClass.php:

<?php

class TestClass {
    public function foo() {}
}

class TestClass_Controller {
    public function bar() {}
}

TestClass_Controller is ignored in this case!

Also, when using autocomplete, $this remains as TestClass, even when in the TestClass_Controller class scope.

Revise variable type determination with nested blocks and scopes.

PHP is a scripting language, as such it is sometimes hard to determine what the exact type is of a variable, as the scope of variables extends outside if-statements, e.g.:

if (something) {
    $test = new Foo();
} elseif (something else) {
    $test = new Bar();
}

// Should $test be listed here or not? If yes, what type should it have?

Currently this is a best effort; $test will be listed and its type will be inferred as being Bar as that's the last match it can find. However, perhaps it's better if we confine the matching explicitly to a block; for example, using instanceof:

$test = new Foo();

if ($test instanceof Bar) {
    $test-> // Autocompletion for Bar, which is fine.
}

$test-> // Autocompletion for Bar??

In this case we should probably be showing autocompletion for Foo instead, as outside the if-statement all bets on the type of $test are off. In the top example, you should not be doing anything outside the if statements on $test that aren't method calls or properties that are available for both Foo and Bar, in which case they should be sharing an interface:

if (something) {
    $test = new Foo();
} elseif (something else) {
    $test = new Bar();
}

// $test should be shown, but it should be having no type, i.e. getVariableType should
// be skipping nested blocks entirely.
/** @var InterfaceUsedByFooAndBar $test */
if (something) {
    $test = new Foo();
} elseif (something else) {
    $test = new Bar();
}

// $test should be shown and give autocompletion for InterfaceUsedByFooAndBar.
// function myFunction(InterfaceUsedByFooAndBar $test)

if (something) {
    $test = new Foo();
} elseif (something else) {
    $test = new Bar();
}

// $test should be shown and give autocompletion for InterfaceUsedByFooAndBar.

As a result of this, this will also happen:

$test = new SomethingElse();

if (something) {
    $test = new Foo();
} elseif (something else) {
    $test = new Bar();
}

// $test should be shown and give autocompletion for SomethingElse.

Important notes for development:

  • Specs will need to be updated to cover all these test cases.
  • getVariableType has to receive its own alternative implementation (or a parameter) of getFunctionScopeListAt that will skip all nested blocks, not just closures. It must exclude matching statements with instanceof and catch blocks that the buffer position being passed is not located inside of.

Return the startLine for properties and constants.

Currently, startLine is returned for neither properties nor constants, as they aren't fetchable through Reflection. Instead, php-integrator-navigation searches for these items using regular expressions in CoffeeScript. This should not be necessary, the PHP side should be doing the search using regular expressions if at all necessary, as the 'client' side should not have to care where the data comes from. If, in the future, PHP decides to return this information through Reflection, we can then just rewrite it on the PHP side without modifying the other packages.

Unchecked $_SERVER causes problems with indexing files.

I don't believe this is an autocomplete bug, since autocomplete relies on the base for the data. When you open a project and open a new or existing file, the autocomplete has no information on any of the project classes. There's no initial index of all classes. You have to open each individual class file let it index it before you can use the class.

Skip variables in the wrong scope.

getAllVariables as well as getVariableType should skip scopes that aren't relevant, for example:

$y = new Foo();

function foo()
{
    $x = 5;
    $y = new Bar();
    $z = 3;

    $callback = function () use ($z) {
        // $x and $y should not be visible here, $z should be visible.
    };

    return null;
}

// I shouldn't see $x in autocompletion here as it is in another scope.
// $y should not resolve to an instance of Bar, but of Foo.

Currently, it includes all variables that occur somewhere between the start of the function or method and the buffer position.

getOuterFunctionStart could be rewritten to return information about all ranges that contain information relevant to the current function, i.e. for the above example with the buffer position after return null, it would return a range from function foo up until use ($z) { and another range from }; to after return null. This way the ranges that don't apply can be easily skipped by iterating over the ranges that do apply in the caller. Also: getOuterFunctionStart needs refactoring as it's currently fetching the entire buffer text whilst it could just use lineTextForBufferRow instead.

Uncaught spawnSync C:\Bitnami\wampstack-7.0.0-0\php\php.exe ENOENT

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.3.3
System: Microsoft Windows 10 Home
Thrown From: php-integrator-base package, v0.4.4

Stack Trace

Uncaught spawnSync C:\Bitnami\wampstack-7.0.0-0\php\php.exe ENOENT

At /C:/Users/MichaelA/.atom/packages/php-integrator-base/lib/Proxy.coffee:77

undefined

Commands

     -0:20.2.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:19.6.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:15.8.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:05.5.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "fileEncoding": "iso88591",
    "projectHome": "F:\\_MY-WEBAPPS",
    "themes": [
      "one-light-ui",
      "atom-dark-syntax"
    ],
    "disabledPackages": [
      "open-on-github"
    ]
  },
  "php-integrator-base": {
    "phpCommand": "C:\\Bitnami\\wampstack-7.0.0-0\\php\\php.exe"
  }
}

Installed Packages

# User
aligner-php, v1.0.0
angular-jonpapa-snippets, v0.7.0
angular2-snippets, v0.3.0
angularjs, v0.3.3
angularjs-boilerplate-snippets, v0.3.1
angularjs-snippets, v0.10.18
angularjs-styleguide-snippets, v0.7.3
angularjs-styleguide-snippets-es6, v1.0.3
angularjs-styleguide-webpack-snippets, v1.0.1
atom-autocomplete-php, v0.18.4
atom-beautify, v0.28.20
atom-bootstrap4, v1.4.0
atom-html-preview, v0.1.13
atom-ternjs, v0.12.2
auto-detect-indentation, v0.4.2
autoclose-html, v0.19.0
autocomplete-angular-material, v0.4.0
autocomplete-html-entities, v0.1.0
autocomplete-php, v0.3.7
cdn-libs, v0.0.6
color-picker, v2.0.14
highlight-selected, v0.11.1
jquery-snippets, v11.0.0
language-coffee-script-angular, v2.2.0
linter, v1.11.3
linter-bootlint, v1.0.0
linter-js-standard, v3.2.1
minimap, v4.19.0
php-analyser, v0.2.0
php-cs-fixer, v2.5.2
php-integrator-base, v0.4.4
php-integrator-tooltips, v0.3.0
pigments, v0.19.5

# Dev
No dev packages

'SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: constants.name'

Indexing fails for me in a Symfony2 project, it seems that there are some issues related to indexing PHP's builtin constants.

I traced the issue to lines 967 - 979 in php/src/Indexer.php, commenting these lines results in calling toString() null.

Error ouput

PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: constants.name' in /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91
Stack trace:
#0 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(91): PDOStatement->execute(Array)
#1 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(993): Doctrine\DBAL\Driver\PDOStatement->execute(Array)
#2 /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(696): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO con...', Array, Array)
#3 /home/tocjent/.atom/packages/php-integrator-base/php/src/IndexDatabase.php(591): Doctrine\DBAL\Connection->insert('constants', Array)
#4 /home/tocjent/.atom/packages/php-integrator-base/php/src/Indexer.php(990): PhpIntegrator\Index in /home/tocjent/.atom/packages/php-integrator-base/php/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 53

Error output after commenting lines 967 - 979

PHP Notice:  Undefined property: PhpParser\Node\Stmt\Class_::$namespacedName in /home/tocjent/.atom/packages/php-integrator-base/php/src/Indexer/DependencyFetchingVisitor.php on line 36
PHP Fatal error:  Call to a member function toString() on null in /home/tocjent/.atom/packages/php-integrator-base/php/src/Indexer/DependencyFetchingVisitor.php on line 36

Non existing classmap script and additional scripts to load

I tried to load my stubs.php file, but it doesn't work.
https://github.com/Gert-dev/php-integrator-autocomplete-plus/issues/8

After playing with the script path it seems buggy?

I entered a not existing script path and all looks fine. No error message or "file not found" message.
Relative path (based on the project directory opened in Atom, stubs.php is also inside the project) I get an "Indexing failed!" message without any debugging information.

So how could I check if the correct file is loaded? Why there is no "file not found" message?

Investigate switching to ReflectionDocBlock.

As the title indicates, investigate switching to ReflectionDocBlock also used by phpDocumentor. This removes the need for our custom DocParser that is not entirely compliant and will also ensure that we are compliant with all the corner cases. Finally, it is likely that this project will follow the upcoming PSR-5 when it is released, which is even more interesting for compliance.

Everything we need seems to be supported, with the exception of one item [1].

[1] phpDocumentor/ReflectionDocBlock#69

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Closures don't always have their type properly deduced.

(This issue applies to master only, as 0.3.0 hasn't been released yet.)

Works:

$func = function (array $value) {
    return $value;
};

$func-> // Type properly deduced.

Fails:

$func = function (array $value) {
    $value['a'] = $this->method($value['a']);
};

$func-> // Type not properly deduced.

Uncaught (in promise) on autocomplete

I'm getting an error that only shows up in the Javascript error console (Atom doesn't throw and error and allow me to submit a bug report). I've included a screenshot of what I'm seeing in the console. I know there isn't much information in it, so let me know what else I can do to help you troubleshoot this problem.

screenshot 2016-01-11 22 17 04

Thanks!

Only clear the cache if indexing succeeds.

Hopefully this will allow us to fall back on the cache for autocompletion when there is a syntax error (instead of stopping autocompletion and all other functionality from working altogether).

Try to be more informative about errors.

It would be neat if the indexer was more informative about errors, i.e.:

  • Displaying the file that could not be indexed on save (if possible, also the line and exact error returned, we might need to turn on error reporting and E_ALL in the spawned subprocesses for this).
  • Putting an indication in the status bar that the index is currently in a 'broken' state because the code contains errors.

Commit d6e9efa adds a visual indicator in the status bar when indexing is failing.

Type isn't properly deduced for new instances in corner cases.

Works (not valid PHP, but to indicate the search stops correctly on the equals sign):

$array = [
     'test' = (new Foo())-> // No autocompletion (php-integrator-autocomplete-plus).
];

Fails:

$array = [
     'test' => (new Foo())-> // No autocompletion (php-integrator-autocomplete-plus).
];

Should also add a spec for this corner case.

Indexing failed all of a sudden...

Hello!

I was using php integrator in my project last night normally, and today I upgraded to the last version and it's not indexing correctly anymore.

I have checked the settings and the composer and php commands are correct. I tested with the global composer and with a composer.phar located in my project's root directory.

My project is based on Laravel 5.1, which follows PSR-4 standards.

What could be causing this issue?

Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.