jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.58k stars 151 forks source link

.dumbjump: Outside path adds unnecessary context-free search results #401

Open cweiske opened 3 years ago

cweiske commented 3 years ago

Prerequisites

When searching, dumb-jump first searches with context, and then tries without context if the context-search yielded no results.

Example: .php file, "<?php new Contact()" , cursor on "Contact"

  1. Context is "class", first search is for "class Contact"
  2. If no result is found, only "Contact" is searched.

The second search will yield much more results than the context-sensitive first search, because the search terms are much more unspecific.

Problem

When the .dumpjump file contains an include for an external path like +../external/, then too many results are shown because the external directory is searched context-less, even if the project path has context-sensitive results.

Example

  1. Context is class, first search in project directory is for "class Contact". A result is found.
  2. Context-free search in project directory is skipped because 1. had results
  3. Context is class, first search in ../external/ directory is for "class Contact. No results found
  4. Context-less search in ../external/ directory for "Contact". Dozends of results found
  5. dumb-jump shows a result popup with the combined results of the project directory and external directory results, containing dozens of entries

Desired solution

It would be better if the search order would be different:

  1. Context search in project directory
  2. Context search in external directory
  3. If something has been found, stop here and show results
  4. Context-free search in project directory
  5. Context-free search in external directory
  6. Show results

This happens with dumb-jump 97b0dfb and 0fad329 and emacs 26.3 on Ubuntu Linux 20.4

cweiske commented 2 years ago

@jacktasia is there some way I can pay you to fix this?

jacktasia commented 2 years ago

@jacktasia is there some way I can pay you to fix this?

Nope, but PRs are welcome. I believe there are services out there that allow you to add bounties for requests on open source projects. There may be someone out that will do it if you can/will not either.