Code Monkey home page Code Monkey logo

Comments (20)

x0nix avatar x0nix commented on June 23, 2024 5

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.

Gregory-K avatar Gregory-K commented on June 23, 2024 2

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

ef6750f

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.

Gregory-K avatar Gregory-K commented on June 23, 2024 2

@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.

Gregory-K avatar Gregory-K commented on June 23, 2024 2

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.

DamnWidget avatar DamnWidget commented on June 23, 2024 2

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.

Havdiak avatar Havdiak commented on June 23, 2024 1

Time to time control + option + g opens new empty tab instead of searching definition

from anaconda.

Gregory-K avatar Gregory-K commented on June 23, 2024 1

Something similar happens with "Find Usages",
command palette drop down list with the results prefixed with "main"

from anaconda.

Gregory-K avatar Gregory-K commented on June 23, 2024 1

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.

jrzaurin avatar jrzaurin commented on June 23, 2024

Just in case it helps, manually downgrading to Anaconda 2.2.3 fixed the issue

from anaconda.

gimmi avatar gimmi commented on June 23, 2024

Same problem for me

from anaconda.

mikez avatar mikez commented on June 23, 2024

I'm experiencing the same thing too.

from anaconda.

DamnWidget avatar DamnWidget commented on June 23, 2024

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.

mikez avatar mikez commented on June 23, 2024

@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.

mikez avatar mikez commented on June 23, 2024

@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.

mikez avatar mikez commented on June 23, 2024

@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.

jrzaurin avatar jrzaurin commented on June 23, 2024

So, the problem described in #924 (comment) keeps persisting.

Anyone has found a solution to this? Thanks!

from anaconda.

mikez avatar mikez commented on June 23, 2024

@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.

jrzaurin avatar jrzaurin commented on June 23, 2024

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.

mikez avatar mikez commented on June 23, 2024

@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.

jrzaurin avatar jrzaurin commented on June 23, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.