SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

Error gathering command completions #271

Closed OdatNurd closed 4 years ago

OdatNurd commented 4 years ago

Description

Using Sublime build 4057, PackageDev generates a traceback error while generating the list of commands for use in the autocomplete panel while editing a plugin, which results in no commands being present. The same issue does not present itself when entering the command in a key binding.

Steps to reproduce

  1. Use Tools > Developer > New Plugin... from the menu and save the stub plugin
  2. Add a self.view.run_command("") line to the body of the command
  3. Trigger the AC panel in the string argument to run_command() (if it doesn't automatically trigger while entering the line)

When the autocomplete triggers, the traceback below is generated, which results in the AC panel containing only words from the buffer.

Traceback (most recent call last):
  File "/tmp/bob/sublime_text_4057/Lib/python33/sublime_plugin.py", line 893, in on_query_completions
    norm_res(callback(v, prefix, locations))
  File "/tmp/bob/sublime_text_4057/Lib/python33/sublime_plugin.py", line 129, in profiler
    return event_handler(*args)
  File "/tmp/bob/sublime_text_4057/Data/Installed Packages/PackageDev.sublime-package/plugins_/command_completions/__init__.py", line 165, in on_query_completions
    for c in get_builtin_commands(command_type)
  File "/tmp/bob/sublime_text_4057/Data/Installed Packages/PackageDev.sublime-package/plugins_/command_completions/__init__.py", line 165, in <genexpr>
    for c in get_builtin_commands(command_type)
  File "/tmp/bob/sublime_text_4057/Data/Installed Packages/PackageDev.sublime-package/plugins_/command_completions/__init__.py", line 115, in _create_builtin_completion
    .format(c=c, stype=meta[c].get("command_type", " ")[:1].upper()))
TypeError: tuple indices must be integers, not str

This seems to be the case from builds 4050 through to 4057, as tested in a portable copy containing only Package Control and PackageDev.

As an additional note, in key bindings this problem does not seem to occur, although it doesn't show commands from any of the default packages (e.g. exec). I would imagine that this is a result of the shipped packages running in the 3.8 plugin host by default though.

FichteFoll commented 4 years ago

I have trouble reproducing this issue. So much that I don't see any completions provided by PD, nor an exception or log message in the console. I don't know what's going on yet, but something is definitely broken.