Comments (6)
Still waiting for melpa/melpa#5405
Before it is merged, you may use:
;; https://github.com/MaskRay/Config/blob/master/home/.config/doom/modules/private/my-cc/config.el
(use-package! ccls
:load-path "~/Dev/Emacs/emacs-ccls"
:init (add-hook 'c-mode-common-hook #'+ccls//enable)
:config
;; overlay is slow
;; Use https://github.com/emacs-mirror/emacs/commits/feature/noverlay
(setq ccls-sem-highlight-method 'font-lock)
(ccls-use-default-rainbow-sem-highlight)
(setq ccls-extra-init-params
'(:completion (:detailedLabel t) :xref (:container t)
:diagnostics (:frequencyMs 5000)))
(require 'projectile)
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
(evil-set-initial-state 'ccls-tree-mode 'emacs)
(set! :company-backend '(c-mode c++-mode) '(company-lsp))
)
from emacs-ccls.
As you said, in order to use ccls
, I have to download ccls
to my .emacs.d
, and load it manually. By the way, it seems set!
is a customized macro, because I could not find any information about it. It seems what (set! :company-backend '(c-mode c++-mode) '(company-lsp))
means is when major mode are c-mode or c++-mode, setting company-backend
to company-lsp
. Thus I change it to :
;;; backends for lsp-mode
(use-package company-lsp
:ensure t
:defer t
:init (progn
(add-hook 'lsp-mode-hook (lambda ()
(add-to-list 'company-backends 'company-lsp)))
))
This statement adds company-lsp
to company-backends
when lsp-mode is enabled. Personally, I prefer
(with-eval-after-load 'projectile
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
)
rather than
require 'projectile)
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
In the end, (add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
should change to (add-to-list 'projectile-globally-ignored-directories "*.ccls-cache")
,or it only ignores top level directory.
from emacs-ccls.
As you said, in order to use ccls, I have to download ccls to my .emacs.d, and load it manually.
Yeah not very convenient for now..
(set! :company-backend '(c-mode c++-mode) '(company-lsp))
This a macro defined in doom-emacs (the Emacs distribution I use) https://github.com/hlissner/doom-emacs/blob/develop/core/core-lib.el#L238
It sets the buffer-local variable company-backends
to (company-lsp)
somehow.
(with-eval-after-load 'projectile
Thanks for your advice. Updated my config
should change to (add-to-list 'projectile-globally-ignored-directories "*.ccls-cache")
.ccls-cache
should be sufficient.
- When a
c-mode
c++-mode
file is opened - The mode hook kicks in and initializes emacs-ccls
- emacs-ccls uses ccls-project-root-matchers to locate the project root
- lsp-mode spawns ccls (server) and and sends the
initialize
request to the ccls process, withrootUri
(project root) in the parameter. - The ccls server takes
rootUri
as the project root and creates.ccls-cache
under it.
.ccls-cache
will not appear in other directories so I do not bother using *.ccls-cache
.
For larger C/C++ projects with subprojects, .ccls-root
should be put in the parent project directory. I may not have explained it well, clarification (it is publicly editable) welcomed :)
from emacs-ccls.
Sorry for missing the FAQ, because I haven't set .ccls-root
in the root project, so ccls
just generates .ccls-cache
for each subproject. Even though I am not familiar with ccls/emacs-ccls
, I think your explanation is clear enough.
from emacs-ccls.
The PR has been merged.
from emacs-ccls.
Congrats!
from emacs-ccls.
Related Issues (20)
- c++17, std::optional HOT 1
- Header files not found with emacs-ccls, but works fine at vscode. HOT 1
- imenu: show static member variable instead of function
- Help wanted with configuration: C++ headers not found HOT 1
- conditional highlights doesn't work HOT 2
- Is there a way to manually suspend/resume ccls indexing?
- ccls stuck in "starting"
- Cannot find the references via ccls.xref HOT 2
- Open all hierachy tree at once
- Customize initialization options in S-exp has no effect HOT 1
- Multi-root project setup HOT 2
- Compilation warnings (as of 29.3)
- Use lsp-protocol.el HOT 6
- (void-function lsp:ccls-semantic-highlight-symbol-ranges). HOT 11
- use eval-and-compile instead of eval-when-compile HOT 1
- Function definition lsp:ccls-call-children is void HOT 3
- imenu not showing symbol types HOT 3
- Help with .ccls file config: Header file correctly parsed but "file not found" error appears.
- can not jump to std definition
- How to prevent buffers *ccls-tree call/inheritance hierarchy to use same window than buffer Treemacs ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-ccls.