klaaspieter / coc-sourcekit

Swift language server extension using sourcekit-lsp for coc.nvim.
MIT License
73 stars 9 forks source link

How to use this extension #4

Closed Zeta611 closed 4 years ago

Zeta611 commented 4 years ago

Hi, I've installed Swift Development Snapshot Toolchain and set Xcode to use it. However, when I open a Swift file in Neovim, coc-sourcekit doesn't start. :CocCommand workspace.showOutput doesn't show the language server as an option.

xcrun --toolchain swift --find sourcekit-lsp correctly shows: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-02-21-a.xctoolchain/usr/bin/sourcekit-lsp

Zeta611 commented 4 years ago

It seems to work (renaming, references, etc. don't work) after I installed keith/swift.vim. Is it an expected behavior?

klaaspieter commented 4 years ago

I have https://github.com/keith/swift.vim installed through vim-polyglot so it isn't entirely impossible. I've done some testing and it looks like without swift.vim installed vim does not know about the swift filetype. If you don't want swift.vim installed you could try manually setting the file type to swift (:setf swift)? If that solves it for you than you should be able to use your auto command to set the correct file type: autocmd BufNewFile,BufRead *.swift set filetype=swift.

I suspect once you've set the correct file type CocCommand workspace.showOutput will give you some more information.

klaaspieter commented 4 years ago

I updated the README with this information (https://github.com/klaaspieter/coc-sourcekit/commit/5585ae63c528f6020dde5c7e74ba394f32a02f16).

Zeta611 commented 4 years ago

Thank you for verifying! I actually need swift.vim installed, so I’m happy with my setup.