Comments (8)
Turns out it does work as long as I run:
company-irony-c-headers-reload-compiler-output
for every file I open.
Am I doing something wrong? Should I be adding an open buffer hook to call the above for every file?
from company-irony-c-headers.
This should happen automatically. Could you print company-irony-c-headers--compiler-output
before and after the call and see if there is a difference in the parsed compiler options?
from company-irony-c-headers.
I have same problem. Before company-irony-c-headers--compiler-output
is nil however after i run company-irony-c-headers-reload-compiler-output
the value of it becomes
(("/home/fpenguin23/pbrt/v3/src/ext/openexr/IlmBase/Imath" "/home/fpenguin23/pbrt/v3/src/ext/openexr/IlmBase/Half" "/home/fpenguin23/pbrt/v3/src/ext/openexr/IlmBase/Iex" "/home/fpenguin23/pbrt/v3/src/ext/openexr/OpenEXR/IlmImf" "/home/fpenguin23/pbrt/v3/src/src/ext/openexr/IlmBase/config" "/home/fpenguin23/pbrt/v3/src/src/ext/openexr/OpenEXR/config" "/home/fpenguin23/pbrt/v3/src" "/home/fpenguin23/pbrt/v3/src/core" "/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0" "/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/x86_64-unknown-linux-gnu" "/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/backward" "/usr/local/include" "/usr/bin/../lib/clang/3.7.1/include" "/usr/include")
("/home/fpenguin23/pbrt/v3/src/ext/openexr/IlmBase/Imath" "/home/fpenguin23/pbrt/v3/src/ext/openexr/IlmBase/Half" "/home/fpenguin23/pbrt/v3/src/ext/openexr/IlmBase/Iex" "/home/fpenguin23/pbrt/v3/src/ext/openexr/OpenEXR/IlmImf" "/home/fpenguin23/pbrt/v3/src/src/ext/openexr/IlmBase/config" "/home/fpenguin23/pbrt/v3/src/src/ext/openexr/OpenEXR/config" "/home/fpenguin23/pbrt/v3/src" "/home/fpenguin23/pbrt/v3/src/core" "/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0" "/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/x86_64-unknown-linux-gnu" "/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/backward" "/usr/local/include" "/usr/bin/../lib/clang/3.7.1/include" "/usr/include"))
I think this value is correct.
Do you have any idea?
from company-irony-c-headers.
@frostedpenguin This behavior is correct. If you look at this function, every time compiler-output
is nil
, reload
is called. So when you are doing auto completion, it fetches the include paths, and then would call this function if the search path is nil
.
from company-irony-c-headers.
@frostedpenguin Is your project path included in the output strings? What does your project structure look like?
from company-irony-c-headers.
@hotpxl hmmm i see. I think it should work but I don't know why it's not working.
I was reading this code https://github.com/mmp/pbrt-v3. I generate compile_commands.json using Cmake so i guess the path is included in output strings. Because whenever I applied M-x company-irony-c-headers-reload-compiler-output
manually, company-irony-c-headers parse my project headers really nicely
from company-irony-c-headers.
@hotpxl I figured out the problem
It was hook problem of Company-mode
(use-package irony
:ensure t
:init
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options))
this is my irony-mode setup and
(use-package company
:ensure t
:init
(add-hook 'prog-mode-hook 'company-mode)
:config
(setq company-idle-delay 0.02)
(setq company-minimum-prefix-length 1)
(setq company-show-numbers t)
(setq company-selection-wrap-around t)
(setq company-transformers '(company-sort-by-occurrence company-sort-by-backend-importance))
(setq company-tooltip-limit 20)
(setq company-dabbrev-downcase nil)
(setq company-dabbrev-ignore-case t)
(setq company-dabbrev-code-ignore-case t)
(setq company-dabbrev-code-everywhere t)
)
and this was my original Company-mode setup. I thought c and c++ mode hook is part of prog-mode-hook but it's different.. so I have changed it to
(use-package company
:ensure t
:init
(add-hook 'prog-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'company-mode)
(add-hook 'c++-mode-hook 'company-mode)
:config
(setq company-idle-delay 0.02)
(setq company-minimum-prefix-length 1)
(setq company-show-numbers t)
(setq company-selection-wrap-around t)
(setq company-transformers '(company-sort-by-occurrence company-sort-by-backend-importance))
(setq company-tooltip-limit 20)
(setq company-dabbrev-downcase nil)
(setq company-dabbrev-ignore-case t)
(setq company-dabbrev-code-ignore-case t)
(setq company-dabbrev-code-everywhere t)
)
and it works great.
Thanks @hotpxl
from company-irony-c-headers.
Glad you figured it out. :)
from company-irony-c-headers.
Related Issues (14)
- Should auto-trigger completion on directories HOT 3
- post-completion shouldn't insert the end character if already present HOT 3
- Completion not working if without .clang_complete file in working directory. HOT 7
- Compiler options such as -MMD confuse header path reload HOT 2
- Incorrect working directory on reload compiler output HOT 1
- Dosen't completes system headers HOT 7
- Adding user path in addition to system paths HOT 3
- Please release company-irony-c-headers on MELPA stable HOT 3
- Add extra include paths/work together with company-c-headers? HOT 8
- Sorting order is confusing sometimes HOT 8
- Why do I need this next to company-irony? HOT 3
- Autocomplete keeps first # HOT 2
- How to use custom include path as libraries path? HOT 8
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 company-irony-c-headers.