reddit / emacs

how to set up company-mode to it analysis headers from subdirectories?

CalligrapherTime6039 · 2022-04-28 16:36
I'm trying to setup emacs company-mode. When I put all sources in the root of project, company-mode displays completion variants. But when I use sources from subdirs nothing happens. My .emacs [here](https://pastebin.com/TtBm8TzQ). My directory tree: Project root: C:\\test2\\ Project lib: C:\\test2\\CMSIS Help me, please
nolomg18 · 2022-04-28 20:04
Well, very poor information to guess, but I’ll try. Sumarizing, it depends on your company backend. For example if you use lsp, some language servers needs more information abour your project to give you a better experience. Clangd and ccls, needs to know where your headers are to give you full completions. You need a “compile_commands.json” file in your project root to inform to the server about. This file also contains your compiler flags to tell the server your desired level of warnings, etc. You can get this file easily if your usin cmake, for example. There is another project called “bear” which generate this file from a crude makefile, if your using make as a build tool. Some other servers, like tsserver for javascript will need .tsconfig file with some required information. Almost every language server works in this way. I hope this gives you a starting point ;)
CalligrapherTime6039 · 2022-04-28 20:30
Thanks a lot! I go to read about a "compile\_commands.json" file