johncsnyder / SwiftKitten

Swift autocompleter for Sublime Text, via the adorable SourceKitten framework
MIT License
139 stars 18 forks source link

Autocomplete not working, but different issue than #2 #3

Open saagarjha opened 8 years ago

saagarjha commented 8 years ago

Like issue #2, autocomplete doesn't work for me, except the errors I'm getting are different. Here are the logs:

First, when loading: WARNING:root:failed to import yajl2_cffi backend for ijson. reverting to pure python backend. (even after following directions to build)

After every keypress, I get:

Traceback (most recent call last):
  File "/Users/saagarjha/Library/Application Support/Sublime Text 3/Packages/SwiftKitten/SwiftKitten.py", line 160, in handle_timeout
    self.handle_timeout(view)
  File "/Users/saagarjha/Library/Application Support/Sublime Text 3/Packages/SwiftKitten/SwiftKitten.py", line 112, in handle_timeout
    self.on_idle(view)
  File "/Users/saagarjha/Library/Application Support/Sublime Text 3/Packages/SwiftKitten/SwiftKitten.py", line 118, in on_idle
    structure_info = self._get_structure_info(view)
  File "/Users/saagarjha/Library/Application Support/Sublime Text 3/Packages/SwiftKitten/SwiftKitten.py", line 281, in _get_structure_info
    cmd = self.get_structure_info_cmd(view, text)
  File "/Users/saagarjha/Library/Application Support/Sublime Text 3/Packages/SwiftKitten/SwiftKitten.py", line 269, in get_structure_info_cmd
    "sourcekitten_binary", "sourcekitten")
  File "/Users/saagarjha/Library/Application Support/Sublime Text 3/Packages/SwiftKitten/SwiftKitten.py", line 244, in get_settings
    return project_data.get(key, settings.get(key, default))
AttributeError: 'NoneType' object has no attribute 'get'
johncsnyder commented 8 years ago

When you open Sublime with no project file, then project_data returns None. I'll add a fix for this.

saagarjha commented 8 years ago

Would project_data = view.window().project_data() or {} be a good enough fix?

TheCoordinator commented 8 years ago

Also getting the same issue on Build 3114.

gordio commented 7 years ago

Getting the same issue on ST3 Build 3126. No project, learn swift with single file and cli.