ccls
ccls copied to clipboard
Moving the cursor in large files very slow
Observed behavior
Recently, I used doom-emacs and ccls to develop llvm-project. But when I open large files like(lld/ELF/Driver.cpp), the speed of moving the cursor became very slow.
Expected behavior
I dream that moving the cursor become more fluently in large files
Steps to reproduce
this is my ccls config:
(use-package! ccls
:when (featurep! +lsp)
:unless (featurep! :tools lsp +eglot)
:hook (lsp-lens-mode . ccls-code-lens-mode)
:init
(after! projectile
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
(add-to-list 'projectile-project-root-files-bottom-up ".ccls-root"))
;; (add-to-list 'projectile-project-root-files-top-down-recurring "compile_commands.json")
;; Avoid using `:after' because it ties the :config below to when `lsp-mode'
;; loads, rather than `ccls' loads.
(after! lsp-mode (require 'ccls))
:config
(set-evil-initial-state! 'ccls-tree-mode 'emacs)
;; Disable `ccls-sem-highlight-method' if `lsp-enable-semantic-highlighting'
;; is nil. Otherwise, it appears ccls bypasses it.
;;(setq-hook! 'lsp-configure-hook
;; ccls-sem-highlight-method (if lsp-enable-semantic-highlighting
;; ccls-sem-highlight-method))
(setq ccls-sem-highlight-method 'font-lock)
;; alternatively, (setq ccls-sem-highlight-method 'overlay)
;; For rainbow semantic highlighting
(ccls-use-default-rainbow-sem-highlight)
(when (or IS-MAC IS-LINUX)
(setq ccls-initialization-options
`(:index (:trackDependency 1
:threads ,(max 1 (/ (doom-system-cpus) 2))))))
(when IS-MAC
(setq ccls-initialization-options
(append ccls-initialization-options
`(:clang ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
"-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
"-isystem/usr/local/include"]
:resourceDir (cdr (doom-call-process "clang" "-print-resource-dir"))))))))
System information
- ccls version (
git describe --tags --long): I built ccls from source, in master branch. last commit happened on Sep 23, 2021 - clang version: clang version 12.0.0 (https://github.com/llvm/llvm-project/ b978a93635b584db380274d7c8963c73989944a1)
- OS: ubuntu 20.04
- Editor: doom emacs
- Language client (and version): emacs-lsp
I think this is an Emacs problem. I find that lsp-ui-doc is quite slow and (setq lsp-ui-doc-enable nil) helps...
Same problem here, please try this file https://github.com/redis/redis/blob/unstable/src/module.c , it's very very slow 👀 @MaskRay
我也碰到相同问题,查明是font-lock导致的卡顿。clangd没有出现这个问题,可能是它的语法高亮功能没有ccls做的好,对字体渲染少。 M-x global-font-lock-mode 关闭font-lock mode可以流畅浏览大文件,但是同时丢失了语法高亮功能。 希望有个两全其美的方法。@MaskRay
I think this has to do with lsp-mode. See: https://github.com/emacs-lsp/lsp-mode/issues/3219
I turned lens off and it worked.