Swift YouCompleteMe Core for semantic completion and diagnostics
C++ Python CMake
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Swift YouCompleteMe Core

![Swift on YouCompleteMe Video](http://i.imgur.com/EXEKC1B.gif)

Building prerequisites

PythonLibs 2.7, Boost.System, Boost.Python, Boost.Filesystem.


This source must be a subdirectory of Swift's source code tree, copied inside the tools directory, beside the swift-ide-test directory. It then must be listed in the CMakeLists.txt of the tools directory, just like the other subdirectories already listed.

It should then be built and installed with the Swift project as usual, the sole extra requirement is that RTTI must be enabled (reason: Boost.Python requires RTTI, and source code relying on RTTI can't link with RTTI-disabled code easily).

This is my Swift build line, which is based on the Swift buildbot_linux preset:

python2 swift/utils/build-script --no-assertions --no-swift-stdlib-assertions \
                                 --llbuild --foundation --lldb \
                                 --release -- --swift-enable-ast-verifier=0 \
                                 --install-swift --install-llbuild --install-foundation \
                                 --install-lldb \
                                 --install-destdir=/ --install-prefix=/opt/swift \
'--swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;sdk-overlay;editor-integration;tools;license' \
                                 --build-swift-static-stdlib=1 --skip-test-lldb=1 \
                                 --extra-cmake-options='-DLLVM_ENABLE_RTTI:BOOL=TRUE' \

This is just building the basics (swift, llbuild, lldb and foundation) since other projects have been giving errors while building on ArchLinux.

I've built from master and installed to /opt/swift.

The swift executable must be available from $PATH for the library to work.


After building, with the swift command available from $PATH, swift_ycm_core.so should lie in the Swift's lib installation directory.

This library may then be used coupled with oblitum's YouCompleteMe fork, since it already supports this very experimental project and other features. swift_ycm_core.so should be symlinked or copied inside YouCompleteMe/third_party/ycmd directory, lying beside the ycm_core.so library.

Extra import (-I) and framework (-F) search flags may be passed to the compiler in a customised .ycm_extra_conf.py, like in this example: https://gist.github.com/oblitum/6dc710bdc7bb8df3726b4c008e7247a4. This is showcased in the above animation, where the main file is importing a Solids module.


You may also try to drop one of the releases I produce for ArchLinux. These are the dependencies reported by readelf -d swift_ycm_core.so:

Shared library: [libpthread.so.0]
Shared library: [libdl.so.2]
Shared library: [libpython2.7.so.1.0]
Shared library: [libboost_python.so.1.60.0]
Shared library: [libboost_filesystem.so.1.60.0]
Shared library: [libboost_system.so.1.60.0]
Shared library: [libuuid.so.1]
Shared library: [librt.so.1]
Shared library: [libncursesw.so.6]
Shared library: [libz.so.1]
Shared library: [libm.so.6]
Shared library: [libstdc++.so.6]
Shared library: [libgcc_s.so.1]
Shared library: [libc.so.6]
Shared library: [ld-linux-x86-64.so.2]




  • swift-ide-test shows lack of support for generic (generics, inout, dicts, arrays) by-param hints (patterns barely work on first arg). This is not symmetric with non-generic by-param hints always providing Decls with TypeSpecific relation. Fix it upstream?

    One can still use preview window and check params from initial code completion result for the function/method if it hasn't been erased.

  • Variadic args are being checked by string comparison of patterns that start with "Any...", and when there're named params following it, hints for 2nd, 3nd args come at 2nd and 3nd arg locus, regardless of being allowed to insert any amount of args initially.

  • YCM's order of sign placement in gutter, e.g., in:

    var x = ""

    Information icon is placed first than error, so it seems a warning. This has been reported in YouCompleteMe #2141. Sorting has been used to try avoiding this issue.