       lsp-before-save-edits nil
       lsp-enable-eldoc nil)
 
-(add-hook 'c-mode-hook #'lsp-cquery-enable)
-(add-hook 'c++-mode-hook #'lsp-cquery-enable)
+(defun ccls//enable ()
+  (condition-case nil
+      (lsp-ccls-enable)
+    (user-error nil)))
+
+(add-hook 'c-mode--hook #'ccls//enable)
+(add-hook 'c++-mode-hook #'ccls//enable)
+(add-hook 'objc-mode-hook #'ccls//enable)
 
 ;; broken:
 ;; (require 'lsp-imenu)

(add-to-list 'projectile-globally-ignored-files ".DS_Store")
(add-to-list 'projectile-globally-ignored-directories ".build")
(add-to-list 'projectile-globally-ignored-directories "build")
(add-to-list 'projectile-globally-ignored-directories ".cquery_cached_index")

(bind-key "M-g" '(lambda ()
                   (interactive)

(add-to-list 'cff-source-regexps '("\\.m$" . (lambda (base) (concat base ".m"))))
(add-to-list 'cff-source-regexps '("\\.mm$" . (lambda (base) (concat base ".mm"))))

(require 'ccls)
(setq ccls-executable (expand-file-name "~/ccls/Release/ccls"))
(setq ccls-extra-init-params '(:index (:comments 2) :completion (:detailedLabel t) :cacheFormat "msgpack"))
(setq ccls-sem-highlight-method nil)

;; (require 'lsp-clangd)
(setq lsp-highlight-symbol-at-point nil
      lsp-enable-indentation nil
      lsp-enable-codeaction nil
