Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabCompletion is wierd #309

Open
neronmoon opened this issue Jun 2, 2016 · 3 comments
Open

TabCompletion is wierd #309

neronmoon opened this issue Jun 2, 2016 · 3 comments

Comments

@neronmoon
Copy link

I'm trying to use psysh with Codeception. Here some code of my module.

<?php
$shellConfig = new Configuration([
    'requireSemicolons' => false,
    'historySize' => 100,
    'defaultIncludes' => [
        __DIR__ . '/../../_bootstrap.php',
    ],
]);

$shellConfig->addTabCompletionMatchers([
    new \Psy\TabCompletion\Matcher\VariablesMatcher(),
    new \Psy\TabCompletion\Matcher\ClassNamesMatcher(),
    new \Psy\TabCompletion\Matcher\ConstantsMatcher(),
    new \Psy\TabCompletion\Matcher\FunctionsMatcher(),
    new \Psy\TabCompletion\Matcher\ObjectMethodsMatcher(),
    new \Psy\TabCompletion\Matcher\ObjectAttributesMatcher(),
    new \Psy\TabCompletion\Matcher\KeywordsMatcher(),
    new \Psy\TabCompletion\Matcher\ClassAttributesMatcher(),
    new \Psy\TabCompletion\Matcher\ClassMethodsMatcher(),
]);
$shell = new Shell($shellConfig);
$shell->setScopeVariables(['I' => new AcceptanceTester()] + $context);
$shell->run();

Everything is fine, but tab completion goes very strange. When i type $I->[tab][tab] it shows one count of completions, but after some manipulations it's becomes OK. Example on img

screen shot 2016-06-02 at 16 32 12

@theofidry
Copy link
Contributor

See #292 and #167.

@neronmoon neronmoon changed the title TabCompletion wierd TabCompletion is wierd Jun 2, 2016
@flip111
Copy link

flip111 commented Aug 10, 2016

After defining a function

» psysh                                                                                  [13:52:55]
Psy Shell v0.7.2 (PHP 7.0.8-0ubuntu0.16.04.2 — cli) by Justin Hileman
>>> function signalToHierarchy($signal) {
...   $bracket = strpos($signal, '[');
...   if ($bracket === false) {
...     $first = $signal;
...     $second = false;
...   } else {
...     $first = substr($signal, 0, $bracket);
...     $second = substr($signal, $bracket, -1);
...   }
...   
...   var_dump($first, $second);
... }
=> null

When i type sig it tab-completes to signaltohierarchy, this seems odd because of:

  1. function name to lower case
  2. add extra space on the end

then when i press tab once more it just prints signaltohierarchy another time. So i end up with signaltohierarchy signaltohierarchy

this is weird too

@bobthecow
Copy link
Owner

bobthecow commented Sep 5, 2017

function name to lower case

This is just PHP ¯\_(ツ)_/¯

>>> function fooBarBaz(){}
>>> get_defined_functions()['user']
=> [
     "composerrequired5d4e921bd47fcc9f760ee0015dd744a",
     "composer\autoload\includefile",
     "mb_ord",
     "mb_chr",
     "mb_scrub",
     "curry",
     "xcallable",
     "resolve",
     "dump",
     "psy\sh",
     "psy\debug",
     "psy\info",
     "psy\bin",
     "foobarbaz",
   ]

add extra space on the end

This (and the double completion) should be fixed soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants