import_namespace_command doesn't work in sublime text build 4121
thantzin-soe opened this issue · comments
Yeah. Me too. not only for version 4121 and above versions too
I'm able to reproduce the error but it does not appear all the time. And when the error pop, the command still works. Seems to be related to saving. The only way I've found to get the error all the time is to trigger the command when a file has recently be saved. Very strange.
I will check the sublime changelog to see if anything has change.
What's weird is that if you put cursor on class you want to import and trigger find use command, the namespace gets imported.
Any updates on this issue? I'm having the same problem with this package installing it to sublimetext 4 build 4126.
No update at the moment. I'm not able to reproduce the error. My previous comment is in fact a different error message.
Maybe it is a platform specific issue. Which OS do you all use ?
No update at the moment. I'm not able to reproduce the error. My previous comment is in fact a different error message.
Maybe it is a platform specific issue. Which OS do you all use ?
I'm using mac os montery 12.2.1
I am using mac os big sur 11.6.5 and Ubuntu 20.04
I think I got a case where you can reproduce the error.
Consider following project structure:
❯ tree
.
├── composer.json
├── src
│ ├── Bar.php
│ └── SubFolder
│ └── Foo.php
└── vendor
├── autoload.php
└── composer
├── ClassLoader.php
├── LICENSE
├── autoload_classmap.php
├── autoload_namespaces.php
├── autoload_psr4.php
├── autoload_real.php
└── autoload_static.php
composer.json
:
{
"name": "wotek/php-companion-issue",
"autoload": {
"psr-4": {
"Namespace\\": "src/"
}
},
"require": {}
}
If you run import namespace command while editing Foo.php
it works just fine.
However for Bar.php
it doesn't work - looks like it has problem with root level project files?
its broken for all projects without composer.json in root folder, i made fix for this issue in sublime3 #135 but as i see somthing changed in folder structure. Probably this path must be fixed. Folder "/home/eugn/.config/sublime-text/Packages/PHP Companion" doesn`t exist, coping composer.json to this path fixed import_namespace command. I will try to solve this on weekend.
Traceback (most recent call last):
File "/snap/sublime-text/112/opt/sublime_text/Lib/python33/sublime_plugin.py", line 1494, in run_
return self.run(edit)
File "/home/eugn/.config/sublime-text/Installed Packages/PHP Companion.sublime-package/php_companion/commands/import_namespace_command.py", line 22, in run
File "/home/eugn/.config/sublime-text/Installed Packages/PHP Companion.sublime-package/php_companion/utils.py", line 84, in get_namespace
File "/home/eugn/.config/sublime-text/Installed Packages/PHP Companion.sublime-package/php_companion/utils.py", line 81, in get_composer
FileNotFoundError: [Errno 2] No such file or directory: '/home/eugn/.config/sublime-text/Packages/PHP Companion/composer.json'
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any update on this?