Giter Site home page Giter Site logo

Comments (8)

wberrier avatar wberrier commented on June 28, 2024

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.

hotpxl avatar hotpxl commented on June 28, 2024

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.

lazysquid avatar lazysquid commented on June 28, 2024

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.

hotpxl avatar hotpxl commented on June 28, 2024

@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.

hotpxl avatar hotpxl commented on June 28, 2024

@frostedpenguin Is your project path included in the output strings? What does your project structure look like?

from company-irony-c-headers.

lazysquid avatar lazysquid commented on June 28, 2024

@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.

lazysquid avatar lazysquid commented on June 28, 2024

@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.

hotpxl avatar hotpxl commented on June 28, 2024

Glad you figured it out. :)

from company-irony-c-headers.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.