| 1 | |
| 2 | == Enabling LSP mode |
| 3 | |
| 4 | If you're using spacemacs, enable the c-c++ layer in `dotspacemacs-configuration-layers`: |
| 5 | |
| 6 | {{{ |
| 7 | dotspacemacs-configuration-layers |
| 8 | '( |
| 9 | (c-c++ :variables |
| 10 | c-c++-backend 'lsp-ccls |
| 11 | c-c++-lsp-enable-semantic-highlight 'rainbow) |
| 12 | ... |
| 13 | ) |
| 14 | }}} |
| 15 | |
| 16 | And then in `dotspacemacs/user-config`: |
| 17 | |
| 18 | {{{ |
| 19 | (dir-locals-set-class-variables |
| 20 | 'webkit-instance |
| 21 | '((nil . ((c-basic-offset . 4) |
| 22 | (indent-tabs-mode . nil) |
| 23 | (fill-column . 100) |
| 24 | (ccls-executable . "webkit-ccls") |
| 25 | (projectile-project-name . "WebKit") |
| 26 | (lsp-enable-file-watchers . nil) |
| 27 | (lsp-ui-peek-find-references nil (list :folders (vector (projectile-project-root)))) |
| 28 | )) |
| 29 | (prog-mode (ccls-initialization-options . (:compilationDatabaseDirectory "/app/webkit/WebKitBuild/Release" |
| 30 | :cache (:directory ".ccls-cache") |
| 31 | ;;:clang (:extraArgs ("%h -x c++-header")) |
| 32 | )) |
| 33 | ))) |
| 34 | (dir-locals-set-directory-class |
| 35 | "/home/phil/WebKit/" 'webkit-instance) |
| 36 | }}} |
| 37 | |
| 38 | '''DO NOT CHANGE''' `/app/webkit/WebKitBuild` in `compilationDatabaseDirectory` because it refers to the standard Flatpak SDK sandbox path. |
| 39 | |
| 40 | Then add a new executable script in your PATH, called `webkit-ccls` with the following contents (YMMV): |
| 41 | |
| 42 | {{{ |
| 43 | #!/bin/sh |
| 44 | set -eu |
| 45 | cd $HOME/WebKit/ |
| 46 | Tools/Scripts/webkit-flatpak -c ccls "$@" |
| 47 | }}} |