dumb-jump
dumb-jump copied to clipboard
PHP : won't jump to definition in other file if misleading pattern found locally
Hi,
Thanks for this nice package !
I've tried to jump to the definition of 'Symfony\Bundle\FrameworkBundle\Controller\Controller' or 'Symfony\Component\HttpFoundation\Request' from the following file, but it will only loop inside the similar strings inside the file. On the other hand, jumping to Security works quite well.
<?php
namespace AppBundle\Controller;
use AppBundle\Event\AppEvents;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
* Annuaire controller.
*
* @Route("annuaire")
*/
class AnnuaireController extends Controller
{
/**
* @Route("/", name="annuaire")
*/
public function indexAction(Request $request)
{
$form = $this->get('form.factory')->create(FicheFilterType::class);
return $this->render('annuaire/index.html.twig', [
'form' => $form->createView(),
]);
}
/**
* @Route("/resultats", name="annuaire_resultats")
*/
public function searchAction(Request $request)
{
$form = $this->get('form.factory')->create(FicheFilterType::class);
$paginator = $this->get('knp_paginator');
$qb = $this->get('doctrine.orm.entity_manager')
->getRepository('AppBundle:Fiche')
->createQueryBuilder('f');
....
}
}
Thanks for this nice package !
You're welcome. Happy to hear you like it!
but it will only loop inside the similar strings inside the file
Thanks for the report. I am guessing this is just the aggressive mode not working in your case. Please try setting dumb-jump-aggressive
to nil
like this (setq dumb-jump-aggressive nil)
.
Ok, indeed, thanks :)
Just by curiosity, do you think it would be thinkable to take namespace declarations into consideration for the suggestions ? (that would be a huge benefit for the 'Controller' example)
Ok, indeed, thanks :)
No problem.
Just by curiosity, do you think it would be thinkable to take namespace declarations into consideration for the suggestions ? (that would be a huge benefit for the 'Controller' example)
dumb-jump isn't currently setup in a way that would make that easy, but it's definitely possible it would just require chainable rules (and regular expressions). I've thought a bit about this while making dumb-jump -- and it probably is the next logical step at improving dumb-jump -- but I haven't had the time to come up with a good generic system and it would certainly be another big step away from keeping it "dumb".
That said, I'll update this issue if/when I get more time to consider this, but happy to discuss implementation ideas or accept PRs.
I'm affraid I won't be able to help you much but I'd happily help with tests if needed :)
Maybe you know about it , but I just saw ede-php-autoload today , and although I still have some issues with it, it has the same convenience as dumb-jump as to avoid setting up code indexing strategies (given you have composer managing the autoloader). Maybe it can give some ideas ?