我在使用doom的时候,遇到个情况:
我有下面这个demo的project,里面有很多个subproject,
demo
├── .projectile
├── .git
├── compile_commands.json
├── delivery
│ └── .git
│ └── ...........
├── funit
│ └── .git
│ └── ...........
├── iface
│ ├── .git
│ ├── adaptor.cpp
│ └── ...........
我打开adaptor.cpp,projectile的root path是没问题的,不过lsp的root path就会指定到iface目录。
> LSP :: Guessed project root is /demo/iface
> LSP :: Connected to [ccls:21383/starting].
我尝试在demo目录下建一个.ccls-root,但是也没有用。应该怎么办?
把 lsp-mode 的 auto guess root 设置为 nil 试试
我设置过lsp-auto-guess-root
,好像没有用,而且我看lsp-mode.el里面写的
(defcustom lsp-auto-guess-root nil
"Automatically guess the project root using projectile/project.
Do *not* use this setting unless you are familiar with `lsp-mode'
internals and you are sure that all of your projects are
following `projectile'/`project.el' conventions."
:group 'lsp-mode
:type 'boolean)
这个应该默认就是nil
。
呃,整明白了,我把lsp-auto-guess-root
设置成t
,就会按照projectile
的配置来猜测root path了。