Comments (20)
quickfix that fixed that for me - change this line:
https://github.com/DamnWidget/anaconda/blob/master/anaconda_server/commands/goto.py#L36
from: (i.full_name, i.module_path, i.line, i.column + 1)
to: (i.full_name, str(i.module_path), i.line, i.column + 1)
from anaconda.
x0nix's 'quickfix' only hacks/paves the way to "Goto Definition" of an imported library (at the import
statement location, like mikez mentioned above). Thanks to x0nix for their suggestion.
A quick diff between v2.3.0 and v2.2.3 shows that the problem couldn't reside in those two files alone, goto.py
and find_usages.py
(not sure, Anaconda's code base is too big for me to grasp it in a glimpse). The shift to ST4-only, and Python 3.8 for ST plugins, introduced many changes in multiple locations.
Then, there is
A. the release notes,
https://github.com/DamnWidget/anaconda/releases/tag/v2.3.0
Fixes
- Goto Definition
- Goto Assignment
B. the fix: fix anaconda to work with Python 3.10
commit
and
C. issue #921
So far I have the plugin working again with the latest version of Jedi and Python 3.10.1 in an Artix Linux box, that means, auto completion, docs, function signatures and goto, are working again.
...
I will make a new release as soon as I can, btw, I am not caring if older versions of Python gets broken by the update, ...
| |
Short pause to express my total respect to DamnWidget's decision and gratitude for all the past years of their hard work.
|>
So, do the v2.3.0 "Goto" commands work only with Python >= v3.10 ?
I don't know, I currently deal only with v3.7 =< Python =< v3.9 .
Summary of my quick and draft tests
Windows/Linux + ST4 + Anaconda-plugin v2.3.0 => 'linting' v3.7 =< Python =< v3.9 code-base
None of the v2.3.0 Goto Definition
, Goto Assignment
, and Find Usages
commands work, at all, or as they should be.
I think a project-developer/project-previous-contributor should step in (code familiarity) or we'll have to wait for someone (including us subscribed to this issue) who has the time or the "talent" ("talent" as in less time/effort). Till then, v2.2.3 is the way backwards for anyone that wants the functionality above (described commands) or just a reassurance that all things work as before (including known quirks and bugs).
from anaconda.
@mikez the situation is a little perplexed.
ST4 provides and 'runs' Python 3.8 for its plugins/plugin-system and will continue to do so till the next major version upgrade, ST5.
What DamnWidget is aiming for (at least what I understood by a quick glance at the relevant issues/announcements) is for Anaconda to support the "linting" of Python 3.10 code base.
e.g. Anaconda runs in ST4's provided Python 3.8 and provides "linting" for code written in/for Python 3.10
That said, I haven't tried to test it, as all my code for now targets =< Python 3.9.
It's not difficult though, but it requires time to create a virtual env Python 3.10 and test it. (pyenv
could be of help)
from anaconda.
Just an update.
I tried today a Python 3.10 virtual env and ST4 + Anaconda v2.3.0.
Goto Definition
, Goto Assignment
, and Find Usages
commands persist on not working.
I'm attaching some logs and notes.
Linux ST4 Console
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
ERROR:root:String required
ERROR:root:Traceback (most recent call last):
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/jsonclient.py", line 104, in process_message
ERROR:root: callback(data)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/callback.py", line 73, in __call__
ERROR:root: return self._fire_callback(*args, **kwargs)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/callback.py", line 219, in _fire_callback
ERROR:root: return callback and callback(*args, **kwargs)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/commands/find_usages.py", line 51, in on_success
ERROR:root: ExplorerPanel(self.view, usages).show([], True)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/explore_panel.py", line 71, in show
ERROR:root: self.view.window().show_quick_panel(
ERROR:root: File "/opt/sublime_text/Lib/python38/sublime.py", line 776, in show_quick_panel
ERROR:root: sublime_api.window_show_quick_panel(
ERROR:root:TypeError: String required
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
ERROR:root:String required
ERROR:root:Traceback (most recent call last):
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/jsonclient.py", line 104, in process_message
ERROR:root: callback(data)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/callback.py", line 73, in __call__
ERROR:root: return self._fire_callback(*args, **kwargs)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/callback.py", line 219, in _fire_callback
ERROR:root: return callback and callback(*args, **kwargs)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/commands/find_usages.py", line 51, in on_success
ERROR:root: ExplorerPanel(self.view, usages).show([], True)
ERROR:root: File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/explore_panel.py", line 71, in show
ERROR:root: self.view.window().show_quick_panel(
ERROR:root: File "/opt/sublime_text/Lib/python38/sublime.py", line 776, in show_quick_panel
ERROR:root: sublime_api.window_show_quick_panel(
ERROR:root:TypeError: String required
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
Unable to open /home/USER/Desktop/Projects/PYTHON-PROJECT/None
Traceback (most recent call last):
File "/opt/sublime_text/Lib/python38/sublime_plugin.py", line 571, in init
on_activated(view_id)
File "/opt/sublime_text/Lib/python38/sublime_plugin.py", line 960, in on_activated
run_view_callbacks('on_activated', view_id)
File "/opt/sublime_text/Lib/python38/sublime_plugin.py", line 728, in run_view_callbacks
callback(v, *args)
File "/opt/sublime_text/Lib/python38/sublime_plugin.py", line 152, in profiler
return event_handler(*args)
File "/home/USER/.config/sublime-text/Packages/Anaconda/listeners/linting.py", line 124, in on_activated
self.run_linter(view)
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/linting/sublime.py", line 381, in run_linter
Worker().execute(Callback(on_success=parse_results), **data)
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/workers/market.py", line 108, in execute
_start_worker(worker, callback, **data)
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/workers/market.py", line 75, in _start_worker
wk.start()
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/workers/local_worker.py", line 56, in start
super(LocalWorker, self).start()
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/workers/worker.py", line 81, in start
self.client = AsynClient(int(port), host=host)
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/jsonclient.py", line 42, in __init__
EventHandler.__init__(
File "/home/USER/.config/sublime-text/Packages/Anaconda/anaconda_lib/ioloop.py", line 110, in __init__
self.sock.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused
Windows ST4 JSON DEBUG server
When validate_imports
is enabled
Received method: lint, handler: python_linter
<class 'handlers.python_lint_handler.PythonLintHandler'> handler retrieved from registry
ERROR:root:__init__() takes from 1 to 2 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given
DEBUG:root:['Traceback (most recent call last):', ' File "Subl_4\\Data\\Packages\\Anaconda\\anaconda_server\\commands\\import_validator.py", line 30, in run', "
'errors': [] if v.is_valid() else self._convert(v),", ' File "Subl_4\\Data\\Packages\\Anaconda\\anaconda_lib\\import_validator.py", line 28, in is_valid', '
error, valid = self._validate_import(line, lineno)', ' File "Subl_4\\Data\\Packages\\Anaconda\\anaconda_lib\\import_validator.py", line 51, in _validate_import', '
s = Script(self.source, lineno, offset, self.filename, project=jedi_project)', 'TypeError: __init__() takes from 1 to 2 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given']{'success': True, 'errors': [{'underline_range': True, 'level': 'W', 'lineno': 1324, 'offset': 0, 'message': '[w] pep 8 (%s): %s', 'raw_error': '[W] PEP 8 (E402): module level import not at top of file'}, {'underline_range': True, 'level': 'W', 'lineno': 1325, 'offset': 0, 'message': '[w] pep 8 (%s): %s', 'raw_error': '[W] PEP 8 (E402): module level import not at top of file'}], 'uid': 'ec391f30f65948e296d21c568bb00b65', 'vid': 12}
About push back to ST3: b'{"success": true, "errors": [{"underline_range": true, "level": "W", "lineno": 1324, "offset": 0, "message": "[w] pep 8 (%s): %s", "raw_error": "[W] PEP 8 (E402): module level import not at top of file"}, {"underline_range": true, "level": "W", "lineno": 1325, "offset": 0, "message": "[w] pep 8 (%s): %s", "raw_error": "[W] PEP 8 (E402): module level import not at top of file"}], "uid": "ec391f30f65948e296d21c568bb00b65", "vid": 12}\r\n'
INFO:root:About push back to ST3: b'{"success": true, "errors": [{"underline_range": true, "level": "W", "lineno": 1324, "offset": 0, "message": "[w] pep 8 (%s): %s", "raw_error": "[W] PEP 8 (E402): module level import not at top of file"}, {"underline_range": true, "level": "W", "lineno": 1325, "offset": 0, "message": "[w] pep 8 (%s): %s", "raw_error": "[W] PEP 8 (E402): module level import not at top of file"}], "uid": "ec391f30f65948e296d21c568bb00b65", "vid": 12}\r\n'
Further
Goto Definition
, Goto Assignment
, and Find Usages
return a 'None' path
on_sucess
.
Just try a print(path)
at Anaconda/commands/goto.py
def on_success(self, data):
"""Called when a result comes from the query
"""
if not data.get('result'):
# fallback to ST3 builtin Goto Definition
return self.view.window().run_command('goto_definition')
symbols = []
for result in data['result']:
path = self._infere_context_data(result[1])
print(path) # DEBUG: why no path
from anaconda.
Hi there,
I added some alternatives to this plugin a while ago, they can be found in this section of the README file.
I am not sure how well they really work, I don't really use ST since circa 2014 so I really couldn't say but they look good to me.
Being honest, I didn't archived this repository yet because I still have hopes that someone (or someones) would step up and take care of the project but the possibility seems less probable each day.
Good luck everyone!
from anaconda.
Time to time control + option + g opens new empty tab instead of searching definition
from anaconda.
Something similar happens with "Find Usages",
command palette drop down list with the results prefixed with "main"
from anaconda.
Or if anyone knows an Alternative to Amaconda, please let me know.
@jrzaurin I don't know what your needs, constraints, and workflow are, but you can always downgrade to Anaconda v2.2.3 or try the other LSP alternatives mentioned here https://github.com/DamnWidget/anaconda#alternatives .
from anaconda.
Just in case it helps, manually downgrading to Anaconda 2.2.3 fixed the issue
from anaconda.
Same problem for me
from anaconda.
I'm experiencing the same thing too.
from anaconda.
I will not have time to look into this for a while, I am very busy with other projects right now, if someone steps up to look into this it would be great.
from anaconda.
@DamnWidget Thanks for the heads-up. :)
Note, I also experience this issue when jumping within the same file. It seems in that case, it's not thePosixPath is not JSON serializable
error, but rather the position returns None
instead of the filepath, thus leading to a blank tab when calling sublime.active_window().open_file(self.position, flags)
in Jumper
:
{"success": true, "result": [["__main__.hello", null, 7, 5]], "uid": "df29c0a94da3408e93b1204c9aa7ac74"}
from anaconda.
@x0nix :) Thank you! This fixes "go to" involving import
statements for me.
However, navigating within the same file, I still get a blank tab as described here: #924 (comment) — maybe that's another issue.
from anaconda.
@Gregory-K Thanks for the digging and write-up!
Does upgrading to Python 3.10 resolve this?
If so, as Sublime plugins as of now run at most on 3.8 (see documentation here), I wonder what workaround @DamnWidget had in mind.
from anaconda.
So, the problem described in #924 (comment) keeps persisting.
Anyone has found a solution to this? Thanks!
from anaconda.
@jrzaurin I'm not aware of a fix yet. It seems @DamnWidget (the maintainer) is prioritizing other projects per #924 (comment) and requested someone look into it.
from anaconda.
hey @mikez
Yean I read it. The truth is that this to me is a major drawback 😔.
Oh well, maybe I will give VScode a go and hope they fix this soon (I do love Sublime 🙂). Or if anyone knows an Alternative to Amaconda, please let me know.
from anaconda.
@jrzaurin I feel you. I think you may try posting here: https://forum.sublimetext.com/c/ideas-and-feature-requests ... and explain the importance of it. That is, to have Sublime natively support a more powerful "show definition", including imported libraries akin to VSCode.
Big thank you to @DamnWidget who has been running this project since 2013. I totally understand if he has less energy and resources for it today.
from anaconda.
@Gregory-K I did try, since I actually wrote this comment #924 (comment). However I found the behaviour rather random in the sense that, sometimes worked, sometimes did not🤷🏻♂️
from anaconda.
Related Issues (20)
- fstring marked as invalid syntax
- [IMPORTANT] Giving a little push to the plugin HOT 2
- [WorkAround] New version of the plugin does not work on ST3
- Auto-brackets after autocompleting functions
- Split View shows help popup on the other column / pane
- Goto Definition open a blank tab HOT 2
- White boxes surrounding all my text during python file editing. HOT 1
- problem with executing python.exe within anaconda HOT 2
- [ bug report] After uninstalling anaconda, Windows cmd will become unavailable
- It not worked for me ... Thank you
- [WorkAround] Manually installing anaconda on ST3 HOT 5
- typing.NamedTuple completion not supported
- CondaSSLError: Encountered an SSL error. Most likely a certificate verification issue. Exception: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2548)
- Use WSL Python as anaconda interpreter in Windows 11 ST4?
- Anaconda ignores PYTHONPATH var
- fk me HOT 1
- Tootips and Autocomplete not working HOT 3
- Anaconda worker doesn't start due to asyncore and asynchat missing HOT 1
- Goto Symbol in Project (ctrl+shift+r) and methods in classes.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anaconda.