Installation
rudedogg opened this issue · 7 comments
Hey,
I have sourcekitten
installed via homebrew, and running sourcekitten
in a shell works.
I'm getting this in the Sublime Console though:
reloading plugin SourceKittenSubl.subl
plugins loaded
Package Control: Skipping automatic upgrade, last run at 2017-01-09 11:59:13, next run at 2017-01-09 12:59:13 or after
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 591, in on_query_completions
res = callback.on_query_completions(v, prefix, locations)
File "/Users/rudedogg/Library/Application Support/Sublime Text 3/Packages/SourceKittenSubl/subl.py", line 18, in on_query_completions
suggestions = subl_source_kitten.complete(offset, file, project_directory, text)
File "/Users/rudedogg/Library/Application Support/Sublime Text 3/Packages/SourceKittenSubl/dependencies/../src/subl_source_kitten.py", line 16, in complete
collection = source_kitten.complete(offset, file, project_directory, text)
File "/Users/rudedogg/Library/Application Support/Sublime Text 3/Packages/SourceKittenSubl/dependencies/../src/source_kitten.py", line 25, in complete
return _execute(cmd, _json_parse)
File "/Users/rudedogg/Library/Application Support/Sublime Text 3/Packages/SourceKittenSubl/dependencies/../src/source_kitten.py", line 86, in _execute
return _execute_cached("§§§".join(cmd), result_handler)
File "./python3.3/functools.py", line 275, in wrapper
File "/Users/rudedogg/Library/Application Support/Sublime Text 3/Packages/SourceKittenSubl/dependencies/../src/source_kitten.py", line 92, in _execute_cached
with Popen(cmd, stdout=PIPE, stderr=PIPE) as p:
File "./python3.3/subprocess.py", line 819, in __init__
File "./python3.3/subprocess.py", line 1448, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'sourcekitten'
Did I go wrong somewhere?
Did a little searching and found this: http://stackoverflow.com/questions/18855932/file-not-found-error-when-running-local-binary-with-popen
Changing line 18 of source_kitten.py
to "/usr/local/bin/sourcekitten"
did the trick.
Sorry for not responding sooner, I thought I had emails enabled for notifications.
I wonder why I don't get this issue... Is /usr/local/bin
in your shell $PATH variable (run echo $PATH
to check)? And do you launch Sublime Text from command line?
@Dan2552 No problem! Awesome package - it is the most promising Swift completion I've found. I'm looking forward to the improvements you have in the issue queue!
Is /usr/local/bin in your shell $PATH variable
Yes I have /usr/local/bin
in the echo $PATH
output.
And do you launch Sublime Text from command line?
No, I just use the dock. I tried it from the command line just to check - and get the FileNotFoundError: [Errno 2] No such file or directory: 'sourcekitten'
error.
Looking at the subprocess docs using Shell=True
would be a workaround and make use of my '$PATH'. But it looks like there are security issues - not sure if they're worth worrying about? Using the default homebrew path and adding a setting for using a different/custom path seems like a safe/clean option.
@rudedogg You mean changing this:
calculated_offset = _calculate_source_kitten_compatible_offset(offset, text)
to this?
calculated_offset = "/usr/local/bin/sourcekitten"
@dielsonsales the line numbers have probably changed a bit
Give this a go:
https://github.com/Dan2552/SourceKittenSubl/blob/master/src/source_kitten.py#L23
- "sourcekitten",
+ "/usr/local/bin/sourcekitten",
Thanks! It's working now.