Comments (7)
Actually the default-directory
is used by call-process
(as a result of dynamic scoping). I added this line in a patch. If I leave that out, and if default-directory
is nil
, as in some buffers not associated with files, it will just break.
I discussed this problem with the author of Irony that it won't work without a .clang_complete
. It's actually really hard to determine the file type and associated info (C++ std and options). And it would not be so user-friendly to assume. So I'd rather leave that part out.
from company-irony-c-headers.
Hmm... I understood the importance of default-directory
. But without .clang_complete
company-irony
load default include path (you can dump clang++ -E -x c++ - -v < /dev/null
) and current directory, and with .clang_complete
load additional path too. So I think company-irony-c-headers
can also do like company-irony
. How about the below code?
@@ -85,13 +85,13 @@
(defun company-irony-c-headers-reload-compiler-output ()
"Call compiler to get search paths."
(interactive)
- (when (and company-irony-c-headers--compiler-executable
- (company-irony-c-headers--working-dir))
+ (when company-irony-c-headers--compiler-executable
(setq
company-irony-c-headers--compiler-output
(let ((uco (company-irony-c-headers--user-compiler-options))
(dco (company-irony-c-headers--default-compiler-options))
- (default-directory (company-irony-c-headers--working-dir)))
+ (default-directory (or (company-irony-c-headers--working-dir)
+ default-directory)))
(with-temp-buffer
(apply 'call-process
company-irony-c-headers--compiler-executable nil t nil
from company-irony-c-headers.
I'm not quite familiar with Irony's behavior when no .clang_complete
is present. Could you point me to the part that deals with it? If Irony is doing that, I suppose we could do that too.
from company-irony-c-headers.
Sorry for my late reply because my work was busy, and thank you for your modification.
Although the description may not be necessary, I try to explain irony's behavior.
Feature Highlights of irony emacs package is sending command to irony-server which uses libclang and getting the result of it. So in such cases what kind of clang compiler options irony-server receives is important. I checked the difference of command between existence/absence of .clang_complete. If it exists, -working-directory <the path of its existence>
and -I<additional include path written in it>
is added to the command without it. default-directory
is related with -working-directory
option. Try to clang --help
command on terminal then you can find the description below
-working-directory <value> Resolve file paths relative to the specified directory
This mean if relative paths exists in the clang compiler options, resolve file paths relative to the specified directory. Thus I was sure this change(before my comment) was going to work out.
Sorry for my bad English. Thank you.
from company-irony-c-headers.
Thanks for the explanation. I pushed a commit and please check if it's working as expected. I tested on my own machine and it works, but the completion is not very comprehensive since no flags is provided. But anyways it just works.
The problem, however, is when I wanted to complete some STL methods. I can autocomplete #include <vector>
, so I think Irony is able to find the vector library at all. But when I want to autocomplete method invocation on any vector, it doesn't give me the options. I suppose it's some behavior with Irony. I talked with the author of Irony on this. But we haven't reached any conclusion yet. After all, since no flags is provided, it's all undefined behavior.
from company-irony-c-headers.
At least in my environment (Ubuntu 14.04 LTS + emacs 24.5), such problem doesn't occur. But in my another environment (Windows7 + msys2 + NTemacs 24.5), the problem which irony cannot load default include path (you can dump clang++ -E -x c++ - -v < /dev/null
) occurs and this problem has been reported Sarcasm/irony-mode#132. So in such environment, the problem you reported may occur. I cannot reported OS X environment because I don't have apple products.
from company-irony-c-headers.
Thanks for the feedback. I use Linux and Mac. So I don't really bother to support Windows. If it works, then great. If it doesn't, I don't know how to test it as well :)
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
- 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
- Paths from -I command line don't seem to be searched? HOT 8
- 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.