Nealium / django-plus.vim

:guitar: Improvements to the handling of Django related files in Vim
MIT License
0 stars 0 forks source link

Fix Template Search Lag #1

Open Nealium opened 1 year ago

Nealium commented 1 year ago

Vim's pydo/py3do functions run the template finder function 3020 times, freezing up vim for ~10 seconds.
py / py3 commands only run it once and freeze vim for < ~1 second
Note: This is problem is only for the initial search, but 10 seconds is a long wait.

Specs:

Illustrating the Issue

add Func to django-plus.vim/bin/template_finder.py
def record_start():
    from datetime import datetime
    logger = open('/path/to/my/plugins/django-plus.vim/start_times.txt', 'a')
    logger.write('{0}\n'.format(datetime.now()))
    logger.close()

def djangoplus_find_templates(cwd, app_paths, cmdline=False):
    record_start()

    # do the normal stuff
  1. Goto a view's reverse function
  2. ci' or ci"
  3. Type something
  4. Check file

Already fixed with 421aff7e494e6563d4f5ee3ffe67f974c051c336

As the original repo is very cold and I don't want to spam pull requests