ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

TypeError: can only concatenate list (not "str") to list #70

Closed fhemberger closed 9 years ago

fhemberger commented 9 years ago

I just freshly installed tern with the following settings:

"tern_argument_completion": true,
"tern_argument_hints": true,
"tern_argument_hints_type": "tooltip",
"tern_arguments": "--no-port-file",

In the SublimeText console, I get the following error (also after removing those keys from the config again):

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 296, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "/Users/frederic/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 49, in on_selection_modified_async
    on_selection_modified(view)
  File "/Users/frederic/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 29, in on_selection_modified
    if pfile is not None: show_argument_hints(pfile, view)
  File "/Users/frederic/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 453, in show_argument_hints
    data = run_command(view, {"type": "type", "preferFunction": True}, call_start, silent=True)
  File "/Users/frederic/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 282, in run_command
    port, port_is_old = server_port(pfile.project)
  File "/Users/frederic/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 154, in server_port
    started = start_server(project)
  File "/Users/frederic/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 166, in start_server
    proc = subprocess.Popen(tern_command + tern_arguments, cwd=project.dir, env=env,
TypeError: can only concatenate list (not "str") to list

SublimeText 3 Build 3084 io.js 1.6.2

marijnh commented 9 years ago
"tern_arguments": "--no-port-file",

This should be "tern_arguments": ["--no-port-file"]

marijnh commented 9 years ago

Attached patch makes the plugin automatically convert your argument to a list in such a situation.

fhemberger commented 9 years ago

Awesome, thank you!