using ycm completion in emacs
play

Using YCM completion in Emacs Jeff Trull 15 July 2015 Getting - PowerPoint PPT Presentation

Using YCM completion in Emacs Jeff Trull 15 July 2015 Getting Started with YCM for C and C++ YouCompleteMe Download and build YCMD (a YouCompleteMe fork) Jeff Trull https://github.com/Valloric/ycmd#building Install the ycmd and company-ycmd


  1. Using YCM completion in Emacs Jeff Trull 15 July 2015

  2. Getting Started with YCM for C and C++ YouCompleteMe Download and build YCMD (a YouCompleteMe fork) Jeff Trull https://github.com/Valloric/ycmd#building Install the ycmd and company-ycmd packages Set things up in your init file: ( eval-after-load " company-ycmd-autoloads " ’(progn ( company-ycmd-setup ))) ( eval-after-load " ycmd-autoloads " ’(progn ( set-variable ’ycmd-server-command ’("python")) ( add-to-list ’ycmd-server-command ( expand-file-name "~/ oss/emacs/ycmd/ycmd") t ) ( set-variable ’ycmd-global-config ( expand-file-name "~/ oss/emacs/ ycmd/cpp/ycm /. ycm_extra_conf . py")) (add-hook ’c++- mode-hook (lambda () (ycmd-mode) ( company-mode )))))

  3. Test Code Fun with namespaces YouCompleteMe Jeff Trull namespace Outer { struct Foo { int x, y; typedef double float_t; }; namespace Inner { struct Bar { size_t p, q; typedef char byte_t; }; } using namespace Inner; // promote Bar into Outer }

  4. Test Code Inheritance+Templates YouCompleteMe struct Base { Jeff Trull std :: string _str; }; template <typename T> struct Baz : Base , std :: enable_shared_from_this <Baz <T>> { typedef std :: vector <T> sequence_t ; // the *names* of methods on this object are independent of T sequence_t sequence_; std :: size_t string_length () const { // see if it knows about inherited _str whose type is independent of T return _str.length (); } // see if it knows about inherited (and CRTP ’ed) shared_from_this () };

  5. Results YouCompleteMe Jeff Trull CLion seems to get everything YCM struggles with dependent types within templates YCM suggests some inappropriate completions

  6. Other good stuff YouCompleteMe Jeff Trull YCM supports Go and Python YCM supports Flycheck The emacs-ycm author made a couple of blog posts about writing company-mode backends that are interesting http://sixty-north.com/blog/ writing-the-simplest-emacs-company-mode-backend There is a company-clang mode but I haven’t tried it

Recommend


More recommend