Dan2552/SublimeTextSwiftAutocomplete

[Support] Help getting documentation to work on Linux

lf-araujo opened this issue · 4 comments

Thank you for this extension.

I am trying to use it in Linux, and clearly did not get something right.

Swiftkitten is installed and has been added to the $PATH, however the extension is not helping with completions or definitions. How can I help debug this?

I am running this in Ubuntu 17.10.

Best,

@lf-araujo Any luck figuring it out ❓ 😸

Unfortunately no, sourcekitten is only working on an older version of ubuntu, there is no support for archlinux at this moment.

Found a solution, here: jpsim/SourceKitten#524 @sus007

I had to move from Arch to Ubuntu with the hope for better support. Indeed sourcekitten is much easy to install, but I cannot make the documentation bit work under Linux. Am I under the wrong assumption that this package does not support documentation on Linux?

If I use sourcekitten doc inside a project directory, the software gives me the message: Running xcodebuild and nothing more, however when run with the --single-file flag it seems to work well except for some warning message at the beginning:

└─λ sourcekitten  doc --single-file main.swift 
sourcekit: [1:getCursorInfo: 0.0000] failed to create an ASTInvocation: error when parsing the compiler arguments{
  "\/home\/luis\/Dropbox\/Documentos\/Coding\/Swift\/SwiftGtk-example\/Sources\/main.swift" : {
    "key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
    "key.length" : 977,
    "key.offset" : 0,
    "key.substructure" : [
      {
        "key.accessibility" : "source.lang.swift.accessibility.internal",
        "key.kind" : "source.lang.swift.decl.var.global",
        "key.length" : 63,
        "key.name" : "app",
        "key.namelength" : 3,
        "key.nameoffset" : 21,
        "key.offset" : 17
      }
    ]
  }
}

Now when I open the project folder in Sublime completion seems to work well, but documentation for functions does not appear. In the console I get:

Traceback (most recent call last):
  File "/snap/sublime-text/26/opt/sublime_text/sublime_plugin.py", line 672, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/subl.py", line 17, in on_query_completions
    suggestions = subl_source_kitten.complete_with_haste(offset, file, project_directory, text)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/subl_source_kitten.py", line 35, in complete_with_haste
    return results["full"]
KeyError: 'full'
Exception in thread Thread-126:
Traceback (most recent call last):
  File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/subl_source_kitten.py", line 23, in <lambda>
    full = lambda : operator.setitem(results, "full", complete(offset, file, project_directory, text))
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/subl_source_kitten.py", line 51, in complete
    collection = source_kitten.complete(offset, file, project_directory, text)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 29, in complete
    return _execute(cmd, _json_parse)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 102, in _execute
    return _execute_cached("§§§".join(cmd), result_handler)
  File "./python3.3/functools.py", line 275, in wrapper
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 110, in _execute_cached
    result = result_handler(p.stdout)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 114, in _json_parse
    results = json.loads(str(stdout.read(), 'utf8'))
  File "./python3.3/json/__init__.py", line 316, in loads
  File "./python3.3/json/decoder.py", line 351, in decode
  File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded

Exception in thread Thread-127:
Traceback (most recent call last):
  File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/subl_source_kitten.py", line 24, in <lambda>
    stripped = lambda : operator.setitem(results, "stripped", complete(offset, file, project_directory, stripped_text))
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/subl_source_kitten.py", line 51, in complete
    collection = source_kitten.complete(offset, file, project_directory, text)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 29, in complete
    return _execute(cmd, _json_parse)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 102, in _execute
    return _execute_cached("§§§".join(cmd), result_handler)
  File "./python3.3/functools.py", line 275, in wrapper
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 110, in _execute_cached
    result = result_handler(p.stdout)
  File "/home/luis/.config/sublime-text-3/Installed Packages/Swift Autocomplete.sublime-package/src/source_kitten.py", line 114, in _json_parse
    results = json.loads(str(stdout.read(), 'utf8'))
  File "./python3.3/json/__init__.py", line 316, in loads
  File "./python3.3/json/decoder.py", line 351, in decode
  File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded

My system:

OS: Ubuntu 18.04.1 LTS x86_64 
Host: TM1604 XMAKB3M0P0304 
Kernel: 4.15.0-33-generic 
Uptime: 3 hours, 58 mins 
Packages: 2088 
Shell: bash 4.4.19 
Resolution: 1600x900 
DE: Budgie 
WM: Mutter(Budgie) 
Theme: Pocillo-slim [GTK2/3] 
Icons: Pocillo [GTK2/3] 
Terminal: tilix 
CPU: Intel i5-7200U (4) @ 2.500GHz 
 GPU: NVIDIA NVIDIA Corporation Device 1d12 
GPU: Intel HD Graphics 620 
Memory: 2467MiB / 7886MiB 

  • What am I doing wrong? Does documentation works on Linux?