-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
libclang.py generator failed #57
Comments
That's logical, because before #56 it tried to use pure regex, but since v1.15.0 it is using clang. To be honest, it's not up to me whether your local environment for C++ works or not, so you'd better ask in an IRC chat or anywhere else, but I'm willing to help you out as far as I can. I'm not a C++ dev, but have knowledge about it to some extend. To start with, you're using a dev version and I won't test against versions that are not alpha, beta, dev etc. The latest version that NeoVim provides is v4.3. I upgraded the docker versions for Vim to v8.1.2300 and for NeoVim to 4.3 and tests are working as expected.
Mhm, that's weird as well, because if the output is anything else then json it will log the errors. Is this from 1 comment generation? It's weird as well that is says You can do some |
I have the same problem with some functions, where the return type includes the
The problem seems to be that when clang “sees” You can try it by yourself with the following code:
(Sorry if my English is a little bit broken :) ) |
@jbqxo I understand your problem. Is it possible for the Another question is: should this be fixed from my side or this something that you should fix locally? It uses clang and clang requires valid syntax in order to parse it correctly, so I guess this isn't something I can fix from my side. I can parse |
Yes, it works fine if these parameters do not contain structures, enumerations etc. which were not defined, nor declared in the current file:
To be honest, I do not see anything that I can do from my side. Only to type in all the declarations necessary for the function before it:
But this is tedious for functions that will take several of these arguments. The problem is that the syntax is valid. This is just an assumption, but during compilation compiler has all the knowledge needed for the preprocessor to set things up. I don’t think you can simply consider
Note that function arguments have been ignored. There is no way to “ask” clang to look for headers in given directories? |
Mhm, maybe I did something that is not that good. In the libclang.py file I am grabbing the contents of the current vim buffer, then I make a temporarily file (which on MacOS will result in something like If that is the case, then I will adjust the functionality so that it won't create a temporarily file outside of the project. I will then create a temporarily file in the same folder where your current buffer is located at (which would make more sense to me already now that I'm writing this). |
@jbqxo I do confirm that the above thing I mentioned it fixing it. If I run your code with the current master branch code, it gives me this (same as you mentioned): Input: // Suppose this header contains the following code:
// typedef enum {Foo} FooEnum;
#include "fooheader.h"
FooEnum foofunc(int x, int y); output: // Suppose this header contains the following code:
// typedef enum {Foo} FooEnum;
#include "fooheader.h"
/**
* @brief [TODO:description]
*
* @return [TODO:description]
*/
FooEnum foofunc(int x, int y); and if I adjust libclang.py create the temporary file in the same directory as the vim buffer, I do get: // Suppose this header contains the following code:
// typedef enum {Foo} FooEnum;
#include "fooheader.h"
/**
* @brief [TODO:description]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @return [TODO:description]
*/
FooEnum foofunc(int x, int y); I will push this to master immediately, since this already proved the me that this should be fixed. |
@jbqxo Can you pull locally to the latest version and test it out? This seems like a good fix. |
Can confirm that it helped on provided example, but on the project I'm working on now, it gives the same errors (but only 2) and irrelevant results.
Output:
I have no idea why. But about your solution:
With these flags, the compiler will also look for unknown headers in these paths. The function And thank you for your time and patience :) |
About the last part of my previous message.
Then it works for this code:
This will usually be compiled with:
|
I do get different results. I added the
I should say this to you ;) |
Sorry, seems like a problem with my system (ArchLinux, glibc, clang 9.0.0, nvim 0.4.3). |
Okay. I will close this issue for now. If you experience new problems, feel free to make a new issue. |
And about the indexing problem: Together with plugins like Localvimrc, this will be a good and easy workaround without much hassle. |
That is indeed a useful option. I'll work on it right away. |
@jbqxo Merged it into master. You can use |
im unable to generate docs for enums. its hard to follow what the solution is. Should this still be open? From comments above, It seems like this was closed because it works on @mlyapin Mac but still doesnt work on his linux. (or my linux, (perhaps all linux?)) |
Describe the bug
When using doge on C++ comments, message about libclang.py failed. I have
libclang.so
in a symlink as described in the README.md file, and am able to use it in python, as shown below. Using neovim version 0.5.0 with python support. The comment generation worked fine before #56On a generation, the following is opened in a buffer:
Settings
Out of
vim --version
The text was updated successfully, but these errors were encountered: