DamnWidget / anaconda

Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker Vagrant and Docker support for Sublime Text 3 using Jedi, PyFlakes, pep8, MyPy, PyLint, pep257 and McCabe that will never freeze your Sublime Text 3
http://damnwidget.github.io/anaconda/
GNU General Public License v3.0
2.21k stars 260 forks source link

Completions out of order: detected properties show after unrelated tokens #898

Open dbazile opened 3 years ago

dbazile commented 3 years ago

Not sure if this is ST4 or Anaconda doing this but the completions for detected properties are being shown below completely unrelated tokens that ST itself sees:

image

Expected Behaviour

Anaconda-detected object properties should appear at the top of the completions list.

Actual Behaviour

Most (sometimes all) detected object properties are sorted after unrelated/undetected tokens in completion list.

Steps to Reproduce

Given this snippet:

import logging

def main():

    print('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do '
          'eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut '
          'enim ad minim veniam, quis nostrud exercitation ullamco laboris '
          'nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor '
          'in reprehenderit in voluptate velit esse cillum dolore eu '
          'fugiat nulla pariatur. Excepteur sint occaecat cupidatat non '
          'proident, sunt in culpa qui officia deserunt mollit anim id est '
          'laborum.')

    x = []

# This function will provide a number of unrelated tokens to Sublime's
# completions to demonstrate the issue here.
def configure_logging(verbose):
    """
    :type verbose: int
    """

    logging.basicConfig(
        datefmt='%H:%M:%S',
        format='%(asctime)s %(levelname)-14s [%(funcName)15s] %(message)s' if verbose else '%(levelname)-14s - %(message)s',
    )

    logging.addLevelName(9, '\033[35mTRACE\033[0m')
    logging.addLevelName(logging.DEBUG, '\033[34mDEBUG\033[0m')
    logging.addLevelName(logging.INFO,  '\033[32mINFO\033[0m')
    logging.addLevelName(logging.WARN,  '\033[33mWARN\033[0m')
    logging.addLevelName(logging.ERROR, '\033[31mERROR\033[0m')
    logging.Logger.trace = lambda self, msg, *args, **kwargs: self._log(9, msg, args, **kwargs)
    logging.Logger.warn = logging.Logger.warning

...add a line in main() below to append something to x. The list methods will show way down below a bunch of unrelated tokens.

ST3, Anaconda and OS versions

ST4: 4107 Anaconda: 2.2.0 OS: Fedora 34

Anaconda's JsonServer Logs

 09:31  ~/.local/share/anaconda/logs/anaconda-4  $ tail -f anaconda_jsonserver.log 
2021-06-08 09:31:29,863: DEBUG   : bind: address=/home/david/.local/share/anaconda/run/anaconda-4/anaconda.sock
2021-06-08 09:31:29,863: DEBUG   : listen: backlog=5
2021-06-08 09:31:29,863: INFO    : Anaconda Server started in /home/david/.local/share/anaconda/run/anaconda-4/anaconda.sock for PID 70006 with cache dir /home/david/.cache/jedi/anaconda-4
2021-06-08 09:31:29,907: INFO    : Incoming connection from ''
2021-06-08 09:31:29,907: INFO    : Incoming connection from ''
2021-06-08 09:31:29,917: INFO    : client requests: lint
2021-06-08 09:31:29,970: INFO    : client requests: lint
2021-06-08 09:31:48,383: INFO    : client requests: lint
2021-06-08 09:31:48,660: INFO    : client requests: lint
2021-06-08 09:31:49,193: INFO    : client requests: lint
2021-06-08 09:31:51,132: INFO    : client requests: lint
2021-06-08 09:31:52,886: INFO    : client requests: lint
2021-06-08 09:31:55,800: INFO    : client requests: doc
2021-06-08 09:31:55,961: INFO    : client requests: doc
2021-06-08 09:31:55,962: DEBUG   : diff parser start
2021-06-08 09:31:55,962: DEBUG   : line_lengths old: 36; new: 37
2021-06-08 09:31:55,962: DEBUG   : -> code[equal] old[1:15] new[1:15]
2021-06-08 09:31:55,962: DEBUG   : copy old[1:15] new[1:15]
2021-06-08 09:31:55,962: DEBUG   : -> code[insert] old[16:15] new[16:16]
2021-06-08 09:31:55,963: DEBUG   : parse_part from 16 to 19 (to 19 in part parser)
2021-06-08 09:31:55,963: DEBUG   : -> code[equal] old[16:36] new[17:37]
2021-06-08 09:31:55,965: DEBUG   : parse_part from 20 to 36 (to 36 in part parser)
2021-06-08 09:31:55,965: DEBUG   : diff parser end
2021-06-08 09:31:56,498: INFO    : client requests: lint
2021-06-08 09:31:57,526: INFO    : client requests: doc
2021-06-08 09:31:57,527: DEBUG   : diff parser start
2021-06-08 09:31:57,527: DEBUG   : line_lengths old: 37; new: 37
2021-06-08 09:31:57,527: DEBUG   : -> code[equal] old[1:16] new[1:16]
2021-06-08 09:31:57,528: DEBUG   : copy old[1:15] new[1:15]
2021-06-08 09:31:57,528: DEBUG   : parse_part from 16 to 19 (to 19 in part parser)
2021-06-08 09:31:57,529: DEBUG   : -> code[replace] old[17:17] new[17:17]
2021-06-08 09:31:57,529: DEBUG   : -> code[equal] old[18:37] new[18:37]
2021-06-08 09:31:57,532: DEBUG   : parse_part from 20 to 36 (to 36 in part parser)
2021-06-08 09:31:57,532: DEBUG   : diff parser end
2021-06-08 09:31:57,616: DEBUG   : pickle loaded: /home/david/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/third_party/typeshed/stdlib/2and3/builtins.pyi
2021-06-08 09:31:57,649: DEBUG   : pickle loaded: /usr/lib64/python3.9/typing.py
2021-06-08 09:31:57,657: DEBUG   : pickle loaded: /home/david/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/third_party/typeshed/stdlib/3/typing.pyi
2021-06-08 09:31:57,667: DEBUG   : pickle loaded: /home/david/.config/sublime-text/Packages/Anaconda/anaconda_lib/jedi/third_party/typeshed/stdlib/3/sys.pyi
2021-06-08 09:31:57,686: INFO    : client requests: autocomplete
2021-06-08 09:31:57,735: INFO    : client requests: doc
2021-06-08 09:31:57,736: DEBUG   : diff parser start
2021-06-08 09:31:57,736: DEBUG   : line_lengths old: 37; new: 37
2021-06-08 09:31:57,736: DEBUG   : -> code[equal] old[1:16] new[1:16]
2021-06-08 09:31:57,736: DEBUG   : copy old[1:17] new[1:15]
2021-06-08 09:31:57,737: DEBUG   : parse_part from 16 to 19 (to 19 in part parser)
2021-06-08 09:31:57,737: DEBUG   : -> code[replace] old[17:17] new[17:17]
2021-06-08 09:31:57,737: DEBUG   : -> code[equal] old[18:37] new[18:37]
2021-06-08 09:31:57,739: DEBUG   : parse_part from 20 to 36 (to 36 in part parser)
2021-06-08 09:31:57,740: DEBUG   : diff parser end
2021-06-08 09:31:58,506: INFO    : client requests: lint
danilovmy commented 3 years ago

i wrote about it on ST4 forum. Anaconda dont works normally right now with ST4.