Autocomplete Swift Save Abandoned

Autocompletion for Swift in NeoVim with deoplete.

Project README

autocomplete-swift

License Release

Autocompletion for Swift in NeoVim with deoplete.

completion-gif

Announcement

  • The support for completion on SPM-based project is added.
  • Autocompletion-swift droped support for Vim and completion with omni-function. Please use this plugin in NeoVim with deoplete.nvim.

Installation

Autocomplete-swift uses SourceKitten as its back-end. SourceKitten can be installed with Homebrew. This plugin also requires PyYaml.

Please execute the following commands:

$ brew install sourcekitten
$ pip install pyyaml

To install autocomplete-swift, it is recommended to use plugin manager such as dein.vim. In the case of dein.vim, please add the following codes into init.vim and configure them:

call dein#add('Shougo/deoplete.nvim')
call dein#add('mitsuse/autocomplete-swift')

This plugin also supports jumping to placeholders in arguments of method. The following configuration is required:

" Jump to the first placeholder by typing `<C-k>`.
autocmd FileType swift imap <buffer> <C-k> <Plug>(autocomplete_swift_jump_to_placeholder)

If you use neosnippet, you should enable key-mappings of neosnippets instead of using the above code. Autocomplete-swift gets along with neosnippet by converting placeholders into its ones.

swift filetype

If your vim setup doesn't set *.swift file's filetype to swift you need to put this line in your config:

autocmd BufNewFile,BufRead *.swift set filetype=swift

Features

Completion

Autocomplete-swift supports types of completion as follow:

  • Type name
  • Type/Instance member
  • Function/method/initializer parameter
  • Top-level function/constant/variable
  • Keyword such as protocol, extension etc.
  • Method definition

Placeholder

This plugin supports jumping to placeholders in arguments of method. Please read Installation.

Custom Toolchain

The custom toolchain is available for completion. For example, if you want to use Swift 4.2, call autocomplete_swift#use_toolchain('Swift_4_2') or autocomplete_swift#use_custom_toolchain('com.apple.dt.toolchain.Swift_4_2').

Support for Swift Package Manager (SPM)

When you are editing a file managed with SPM, autocomplete-swift enables SPM-based completion. It means that you can obtain candidates which come from dependencies (other files or libraries).

Xcode Project Support

The previous version supported completion with framework/SDK experimentally, but the feature is removed because the completion server has fatal bugs.

TODO

  • Make configurable. For example, autocomplete-swift will get max_candiates for deoplete from a variable.

In the GIF on the beginning, I use snippets for Swift contained in neosnippet-snippets in addition to autocomplete-swift.

License

Please read LICENSE.

Open Source Agenda is not affiliated with "Autocomplete Swift" Project. README Source: mitsuse/autocomplete-swift
Stars
91
Open Issues
0
Last Commit
5 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating