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

find_use expand_fqcn and goto_definition_scope don't work #76

Open
thatdoorsajar opened this issue May 22, 2016 · 58 comments
Open

find_use expand_fqcn and goto_definition_scope don't work #76

thatdoorsajar opened this issue May 22, 2016 · 58 comments

Comments

@thatdoorsajar
Copy link

I have closed sublime deleted index, opened sublime and run the GoTo Project Symbols which has reindexed sublime successfully. find_use expand_fqcn and goto_definition_scope are still not working on any assigned key combo or through running the commands from the Command Palette.

import_namespace and insert_php_constructor_property work as expected so the package is working.

find_use and expand_fqcn don't have any output in the console or bottom bar when they are run.

goto_definition_scope has no output in the console but it does say "Unable to find {ClassName}" in the bottom bar when run.

I was successfully running this package on a different machine but this new one no luck! Any suggestions?

@elboletaire
Copy link

Same here, using latest dev build (which right now is 3113)

@jleger98
Copy link

Ditto. Same issue, using ST3 v3114 and latest from PC.

@hughsaffar
Copy link

Did anyone found a workaround?

@thatdoorsajar
Copy link
Author

@hughsaffar not for me atm

@iamanders
Copy link

Same problem here, with build 3113

@iamanders
Copy link

iamanders commented Jun 7, 2016

I did some digging around in the code. Seems like the row below is always returning an empty array, even when hardcoded a symbol that exists in my project.

files = window.lookup_symbol_in_index(symbol)

https://github.com/erichard/SublimePHPCompanion/blob/master/php_companion/utils.py#L18

Is this a Sublime bug maybe? This is above my Sublime skills, otherwise I would do a PR.

EDIT:
Maybe related to this?
sublimehq/Packages#410

@erichard
Copy link
Owner

erichard commented Jun 9, 2016

Sorry guys For not replying here. I just don't see what I can do as I can't reproduce the problem on my machine.

As @iamanders say, it could be a Sublime bug with the index engine. Hopefully the next build will fix this.

@leandromatos
Copy link

It's too bad work without this feature, it has saved me a good time.

@iamanders
Copy link

Just upgraded to the last beta build (3118) and the problem remains.

@erichard
Copy link
Owner

erichard commented Jul 3, 2016

Maybe an issue is referenced in sublime core issue tracker. Please take a look at https://github.com/SublimeTextIssues/Core

@elboletaire
Copy link

It works for me now, using 3118 under both Windows and Linux :\

@iamanders
Copy link

Thats weird, works for me too now! Same version (3118) as my last comment. Don't think I have made any config changes, or installed/removed any plugins since then. Really happy that it's working now.

@elboletaire
Copy link

Same here, it was not working yesterday. It works today... really weird.

@thatdoorsajar
Copy link
Author

thatdoorsajar commented Jul 4, 2016

This seemed to be an issue with Sublime Text core. Now working in Sublime Text Dev Build 3118 - https://www.sublimetext.com/3dev

@leandromatos
Copy link

Still not working here ...

@jleger98
Copy link

jleger98 commented Jul 6, 2016

did not work for me as well. I'm on a MBP.

@leandromatos
Copy link

leandromatos commented Jul 7, 2016

I disabled all plugins and does not work!

Is there a way to force a reindex of the Sublime files?

@elboletaire
Copy link

This seemed to be an issue with Sublime Text core. Now working in Sublime Text Dev Build 3118 - https://www.sublimetext.com/3dev

I don't think so if there weren't sublime text update. With build 3118 was NOT working, and a few days later it was working.

And as some users indicate, it's not working for them.

@erichard
Copy link
Owner

@leandromatos The only way I know to force a reindex

  1. Close ST
  2. Delete existing index ($HOME/.config/sublime-text-3/Index)
  3. Open a directory or a project
  4. The search console must say recreating index at some point
  5. The status bar show the indexation process (a growing percentage)

Please make sure you don't have any settings that prevent the indexation like index_files or index_exclude_patterns.

@leandromatos
Copy link

leandromatos commented Jul 26, 2016

@erichard A sublime-text-3 folder not exists in ~/.config =(

@leandromatos
Copy link

@erichard The index directory path is ~/Library/Application Support/Sublime Text 3/Index.

But, I removed the directory and the error continued: Unable to find ClassName.

@jleger98
Copy link

Followed the steps, got a recreated index message, but still no go when i hit my keybinding for "find_use"

{ "keys": ["f10"], "command": "find_use" },

Using Dev version 3119 of SL3

I am not however getting the error leandromatos is getting.

In the console I am seeing:
Unable to open /Users/joel/Library/Application Support/Sublime Text 3/Packages/Default/Default (OSX).sublime-keymap

looking in that directory, there is no Default folder. Seems like that might be an issue?
Not sure how to re-create.

@jleger98
Copy link

ok, actually found that default (OSX).sublime-keymap in the User folder, created a default folder and copied it over. now I no longer get that error, but still "find_use" does not work.

@Gimcrack
Copy link

I had the same issue even after installing 3119. I removed the PHPCompanion package and reinstalled and the problem went away.

@leandromatos
Copy link

@Gimcrack I tried this, but doesn't work!

@bgatellier
Copy link

This problem appears today, I have no idea why.

Tried to add a {} in the User settings of the package (which was even not created in my case), and everything is now working again as expected.

I remembered that I've already have seen this workaround for another package, but I am not able to remember which one or where did I find the solution.

Hope this could help someone :)

@nickclasener
Copy link

nickclasener commented Sep 25, 2016

What did it for me was removing vendor from "folder_exclude_patterns":["vendor",]

@erichard
Copy link
Owner

@bobby-drk You need to have your cursor on the Geo word for this feature to work. Sublime index classes, functions and variables and treat them as symbols. So you have to hover the right symbol :)

@bobby-drk
Copy link

@erichard

That's what I'm saying. Having my cursor on the word Geo does nothing. The only time anything gets imported is if I have my cursor over the method name.

@thatdoorsajar
Copy link
Author

Now using the newest release build of Sublime Text 3 (3126) with complete uninstall of 3114 and reinstall 3126 with reinstall of PhpCompanion and the problem as I outlined in initial issue is exactly the same. I have tried all suggestions in this thread with no success even to the level @bobby-drk outlined. Can provide more info if needed.

@elboletaire
Copy link

For me there are sometimes which does not work. Nothing seems to take effect and the day after everything works as expected. Really annoying..

@jdrzejb
Copy link

jdrzejb commented Oct 31, 2016

Here's what worked for me:

  1. Quit Sublime Text
  2. Make a backup of ~/Library/Application Support/Sublime Text 3/Packages/User
  3. Remove everything from ~/Library/Application Support/Sublime Text 3
  4. Start Sublime Text
  5. Install Package Control
  6. Remove ~/Library/Application Support/Sublime Text 3/Packages/User
  7. Restore ~/Library/Application Support/Sublime Text 3/Packages/User from backup
  8. Wait till all packages install again
  9. Restart Sublime Text

It took me about 10 minutes and all settings were saved

@jleger98
Copy link

jleger98 commented Oct 31, 2016

This worked for me! I had to re-map my hot key for the find_use command - which I may have removed previously - but this worked like a charm. Using build 3126.
Thanks @jdrzejb

@stephenoldham
Copy link

@jdrzejb Worked for me too. Just had to wait for the sublime to reindex and I was away :)

Using build 3126.

@erichard
Copy link
Owner

Can you all try the @jdrzejb workaround above. Seems we are about could close that awful issue 🙏

@leandromatos
Copy link

leandromatos commented Nov 24, 2016

Worked for me too (in two computers) 🎉 #witchcraft hahaha

@joshwhatk
Copy link

joshwhatk commented Jan 3, 2017

Hmmm... I was having the same issue and simply set up a config file (PHP Companion.sublime-settings) and that got it working... ¯\_(ツ)_/¯

@erichard
Copy link
Owner

So is it fixed ? I hope so 😄

Is anyone still having problem ?

@benjivm
Copy link

benjivm commented Jan 25, 2017

@erichard I think this might be a caching issue, per @nickclasener's suggestion, at least his method is what got it working again for me on two different workstations. So it's not that PHP Companion ever stops working or is malfunctioning, just that it's taking forever to cache everything on medium-large projects since the vendors folder can get massive.

@thatdoorsajar
Copy link
Author

Package is now working for me. @jdrzejb workaround didn't solve the problem. I'm working on Windows machine and can't be sure that I followed exactly. What did work this time however, is a complete uninstall and reinstall of sublime text.

If everyone is happy I can close the issue?

@XanManZA
Copy link

XanManZA commented Jan 31, 2017

Want to chime in here with a solution for Windows users:

  1. Make a backup of your Sublime Settings and Key Bindings
  2. Close Sublime Text 3
  3. Navigate to C:\Users\{YourUserHere}\AppData\Roaming\Sublime Text
  4. Delete the folder "Installed Packages"
  5. Open Sublime Text 3 again
  6. Wait for re-indexing

I've waited a few hours and tried again with success so crossing my fingers this is a semi-permanent solution

@elboletaire
Copy link

@XanManZA your "solution" makes sublime text unresponsive. And @jdrzejb solution didn't worked for me 😢

@MicroDroid
Copy link

Hmm, I really wonder what was on my mind when I disabled indexing in my Sublime Text config 👀

@keevitaja
Copy link

keevitaja commented Sep 19, 2017

I am experiencing this on stable 3143.

I think it started after i upgraded, but i was working on a legacy php and javascript for last days. So i cannot know for sure.

I also deleted the sublime folder and tried with a clean st3 + php companion. Still the same.

But find namespace is working.

And this is what i get in console when doing find_use

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 818, in run_
    return self.run(edit)
  File "php_companion.commands.find_use_command in /home/user/.config/sublime-text-3/Installed Packages/PHP Companion.sublime-package", line 17, in run
  File "php_companion.utils in /home/user/.config/sublime-text-3/Installed Packages/PHP Companion.sublime-package", line 40, in find_symbol
  File "php_companion.utils in /home/user/.config/sublime-text-3/Installed Packages/PHP Companion.sublime-package", line 49, in find_in_global_namespace
  File "./python3.3/subprocess.py", line 576, in check_output
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1448, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'php'

edit: i downgraded to my old installation, and still the same issue... any help would be so cool!

RESOLVED:

So this is a case for Mulder and Scully but i solved it.

In my sublime-text-3/Packages/User/ folder i had a file PHP Companion.sublime-settings

{
    "allow_use_from_global_namespace" : true
}

After i deleted it find_use started working. Also setting the key to false, solves to problem.

@ninjaparade
Copy link

I just ran into this issue on stable 3143 and @keevitaja solution worked for me.

@erichard
Copy link
Owner

@keevitaja This setting make a call to the php cli. Seems that you don't have php installed on your system.

@keevitaja
Copy link

keevitaja commented Jan 13, 2018

correct, i use docker to develop php apps

@sandervanhooft
Copy link

Not sure if it helps, but I've added this line to my php companion user settings and it started working again:

{
    "allow_use_from_global_namespace" : true
}

@lumnn
Copy link

lumnn commented Apr 18, 2018

The find_use was working fine for me for a while, and then it suddenly stopped. Didn't change any config files recently as well as I can't remember any package updates. Certainly there was no SublimeText update (using 3143).

Reinstalling package didn't help.

my config file was only containing:

{
    "allow_use_from_global_namespace" : true
}

Changing this value to false, or removing whole config file didn't help either.
Removing SublimeText index files from ~/.config/sublime-text-3/Index didn't help

Removing SublimeCodeIntel files from ~/.codeintel didn't help (i thought they may be related somehow)

Restarted computer as I thought it may help. It didn't.

Lastly I've checked the Help > Indexing status, as I removed earlier index files. Waited for it to finish and tried find_use again. It worked.

@diegocaprioli
Copy link

I'm on build 3176. Nothing I do seems to work. Not a single key binding works.

@arjanjenny
Copy link

I have the same, tried literally all suggestions, from index to config files to reinstalling fully. the command gets fired by my keybind, but no errors and nothing happening.

@godbout
Copy link

godbout commented Nov 18, 2018

find_use doesn't work for me on some cases, usually on cases where my classes are right under my root app folder. Works in other cases (kinda).

@lumnn
Copy link

lumnn commented Aug 22, 2019

I seem to found a way to fix that. It doesn't look like problem is in PHP Companion package but Sublime / system setup?

I got this problem again, commands stopped working. After some inspection of PHP Companion code I realised that underlying sublime API command window.lookup_symbol_in_index doesn't work as expected - returns empty array, while it should return location files containing symbol.

Initially I removed sublime index files as I thought they got corrupt or something - no luck. But I noticed sublime fails to recreate index. I realised that I have Elasticsearch and webpack in watch mode runing at the time which were preventing sublime from indexing files. I've stopped them, index was recreated and find_use started working again!

So I believe the solution may be along this lines

  • increase fs.inotify.max_user_watches
  • stop "watching" programs

@poncianodiego
Copy link

Same issue :(

@KomboOthniel
Copy link

RESOLU/ RESOLVED

1-Quitter Sublime Text 3.

2-Effacer la Sublime Text 3 du dossier d'Index
1-Dans OS X, supprimer le contenu de ~/Library/Application Support/Sublime Text 3/Index
2-Dans Windows, supprimez le contenu de la AppData\Local\Sublime Text 3\Index\

3-Ouvrir ST3 et votre projet et attendre l'indexation

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