Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCLS not reading project root .ccls file #872

Open
Moggel12 opened this issue Mar 10, 2022 · 7 comments
Open

CCLS not reading project root .ccls file #872

Moggel12 opened this issue Mar 10, 2022 · 7 comments

Comments

@Moggel12
Copy link

Moggel12 commented Mar 10, 2022

Observed behavior

In my C++ project structure I have an inc directory as well as a src directory. Whenever I (in src/*.cpp ) try to include files that reside in the inc directory I get a "file not found error" from ccls.

My .ccls file is setup very basic for now:

clang++
%cpp -std=c++17
-Iinc
-fsanitize=leak
-fsanitize=address
-fsanitize=undefined

Further, using C++17 extensions will also give warnings, even though cpp files should be parsed with -std=c++17.

Im sorry if this is not a bug, but I have not found any documentation stating why the setup above should not work.

Expected behavior

My custom headers, inc/*.hpp, should be included.

Steps to reproduce

Create a C++ project with a src and inc folder. Put a header file in the inc directory and a cpp file in the src directory. Then use the .ccls file mentioned earlier.

System information

  • ccls version (git describe --tags --long): 0.20210330-5 (installed via pacman)
  • clang version: 13.0.1
  • OS: Arch linux
  • Editor: vim
  • Language client (and version): coc.nvim
@philippludwig
Copy link

Same problem here, running clang 13.0.1 with nvim 0.6.1 on Gentoo; this issue started recently.

@Moggel12
Copy link
Author

Same problem here, running clang 13.0.1 with nvim 0.6.1 on Gentoo; this issue started recently.

Did you also install via a package manager? Or did you compile directly from the git repo?

@philippludwig
Copy link

I tried both, sadly it does not make a difference. Also I tried downgrading to clang 13.0.0, this did not help either.

@philippludwig
Copy link

After recompiling ccls manually from the repository, everything works fine. So at least for Gentoo it seems to be a packaging issue.

@JDuchniewicz
Copy link

Seconding that, I had to rebuild ccls from source on Arch Linux. Version 13.0.1.

@fkerle
Copy link

fkerle commented Feb 1, 2024

@Moggel12 did you have a look in the ccls-log and check what it thinks the workspace folder: ... was?

depending on your language client, it may choose the workspace directory on a number of factors (special files, settings, ...)
you may need to set this appropriately.

AFAIK for coc: rootPatterns neoclide/coc.nvim#341 (comment)

(I use languageclient-neovim, there it's let g:LanguageClient_rootMarkers = ['.ccls-root', '.languageclient-root'])

@fkerle
Copy link

fkerle commented Feb 1, 2024

@MaskRay i've struggling with the workspace directory location myself, as it is not mentions in the documentation for the .ccls file. It would be a time saver, if you included some hint about this in the wiki?

.ccls file is read from the workspace directory. This is set by the language client in your IDE!
coc.vim: rootPatterns
LanguageClient-neovim: g:LanguageClient_rootMarkers
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants