Does this work with Spacemacs ?
plm75 opened this issue · 5 comments
I have sourceKitten installed and working.
I have sourceKittenDaemon installed and working.
I have dotspacemacs-additional-packages '(company-sourcekit)
in the layers
section of my .spacemacs
I have (add-to-list 'company-backends 'company-sourcekit)
in the user-config
section of .spacemacs
When I open a swift file inside a project, company-mode is enabled, but I do not get auto-completion.
However, I get messages like this printed out below the mode-line when I type some code in the file: Wrote /var/folders/nb/0zpznrt...../T/sourcekitten15197grb
and when I cat
that file, I get a copy of the file I'm currently editing.
Did I miss some configuration or is this just not working with spacemacs ?
@plm75 most likely unrelated to the using of spacemacs, I assume you have company-mode
installed, whats the output of the *sourcekit-output*
buffer?
@nathankot : I have a empty array ?
Hmm so the issue is that sourcekit isn't able to find any completions for you, couple of questions:
- Are you working inside a Xcode project? Currently doesn't support things outside of Xcode
- Are you using a workspace? Currently workspaces aren't supported
- What is your
xcodebuild -version
? - What are you trying to complete? See this for supported completion scenarios: https://github.com/nathankot/company-sourcekit/blob/fa537304a0a6f90944d797ce58bc067603b6f987/company-sourcekit.el#L86-L129
@nathankot
Thanks for you help.
- Yes I'm working inside an Xcode project
- Yes, you are right, I was using a workspace
- Xcode 7.3.1, Build 7D1014
re second point: after creating a new blank test project in Xcode and opening a swift file (AppDelegate), the source kit-output buffer does not exist. If I start typing, nothing happens.
I need to execute: company-sourcekit to kick-start it: a sourcekit-output buffer is created and populated with what appears to be completion tokens. In my AppDelegate file, no completions show up automatically, I need to execute :company-sourcekit to have completion suggestions.
For example:
- If I type:
self.
nothing appears automatically. I need to doESC :company-sourcekit
for completion list to show up.
Looks like it may be it more a company-mode configuration problem on my side rather than an issue with source kitten ? Sorry if this is the case.
Just in case, if there are any spacemacs users out there that successfully configured auto-completion with source-kitten, my .spacemacs
file contains:
dotspacemacs-additional-packages '(company-sourcekit vimish-fold evil-vimish-fold)
and
`(defun dotspacemacs/user-config ()
(add-hook 'evil-insert-state-exit-hook 'delete-trailing-whitespace)
(add-hook 'hack-local-variables-hook (lambda () (setq truncate-lines t)))
(global-company-mode)
(evil-vimish-fold-mode 1)
(display-time-mode 1)
(add-to-list 'company-backends 'company-sourcekit)
(global-set-key (kbd "C-j") 'evil-window-down)
(global-set-key (kbd "C-k") 'evil-window-up)
(global-set-key (kbd "C-h") 'evil-window-left)
(global-set-key (kbd "C-l") 'evil-window-right)
(spacemacs/set-leader-keys "W" 'evil-write-all)
(global-set-key [wheel-right] 'scroll-left)
(global-set-key [wheel-left] 'scroll-right))`