wiki:WebKitEmacsTips

Version 1 (modified by Philippe Normand, 4 years ago) (diff)

--

Enabling LSP mode

If you're using spacemacs, enable the c-c++ layer in dotspacemacs-configuration-layers:

dotspacemacs-configuration-layers
   '(
       (c-c++ :variables
            c-c++-backend 'lsp-ccls
            c-c++-lsp-enable-semantic-highlight 'rainbow)
       ...
)

And then in dotspacemacs/user-config:

  (dir-locals-set-class-variables
     'webkit-instance
     '((nil . ((c-basic-offset . 4)
               (indent-tabs-mode . nil)
               (fill-column . 100)
               (ccls-executable . "webkit-ccls")
               (projectile-project-name . "WebKit")
               (lsp-enable-file-watchers . nil)
               (lsp-ui-peek-find-references nil (list :folders (vector (projectile-project-root))))
               ))
       (prog-mode (ccls-initialization-options . (:compilationDatabaseDirectory "/app/webkit/WebKitBuild/Release"
                                                  :cache (:directory ".ccls-cache")
                                                  ;;:clang (:extraArgs ("%h -x c++-header"))
                                                  ))
  )))
(dir-locals-set-directory-class
     "/home/phil/WebKit/" 'webkit-instance)

DO NOT CHANGE /app/webkit/WebKitBuild in compilationDatabaseDirectory because it refers to the standard Flatpak SDK sandbox path.

Then add a new executable script in your PATH, called webkit-ccls with the following contents (YMMV):

#!/bin/sh
set -eu
cd $HOME/WebKit/
Tools/Scripts/webkit-flatpak -c ccls "$@"