Skip to content
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

textDocument/hover: no documentation from system include paths #373

Closed
saladpanda opened this issue Apr 10, 2019 · 2 comments
Closed

textDocument/hover: no documentation from system include paths #373

saladpanda opened this issue Apr 10, 2019 · 2 comments

Comments

@saladpanda
Copy link

Observed behavior

on textDocument/hover ccls does not provide documentation for functions from system include paths.
Documentation is only provided for local includes.

Expected behavior

ccls should provide documentation for all symbols on textDocument/hover.

Steps to reproduce

Minimal example:

// a.h

#include "b.h"
#include <stdio.h>

void test() {
    foobar(5);
    printf("Hello world");
}
// b.h

/* This is helpful documentation
 *
 * param i: ignored
 * returns: nothing
 */
void foobar(int i) {
    return;
}

in a.h trigger a hover on foobar and then on printf. This is the strace log (annotated):

# Triggering hover on foobar. Answer contains documentation.
[pid 26942] read(0, "Content-Length: 160\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"textDocument/hover\",\"params\":{\"position\":{\"character\":5,\"line\":6},\"textDocument\":{\"uri\":\"file:///tmp/ccls-test-project/a.h\"}},\"id\":2}", 4096) = 183
[pid 26942] read(0,  <unfinished ...>
[pid 26943] write(1, "Content-Length: 239\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":2,\"result\":{\"contents\":[\"This is helpful documentation\\n\\nparam i: ignored\\nreturns: nothing\",{\"language\":\"c\",\"value\":\"void foobar(int i)\"}],\"range\":{\"start\":{\"line\":6,\"character\":4},\"end\":{\"line\":6,\"character\":10}}}}", 262) = 262

# Triggering hover on printf. Just signature returned, no documentation.
[pid 26942] <... read resumed>"Content-Length: 160\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"textDocument/hover\",\"params\":{\"position\":{\"character\":5,\"line\":7},\"textDocument\":{\"uri\":\"file:///tmp/ccls-test-project/a.h\"}},\"id\":3}", 4096) = 183
[pid 26942] read(0,  <unfinished ...>
[pid 26943] write(1, "Content-Length: 206\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":3,\"result\":{\"contents\":[{\"language\":\"c\",\"value\":\"extern int printf(const char *__restrict __format, ...)\"}],\"range\":{\"start\":{\"line\":7,\"character\":4},\"end\":{\"line\":7,\"character\":10}}}}", 229) = 229

/usr/include/stdio.h does contain documentation:

...
/* Write formatted output to stdout.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int printf (const char *__restrict __format, ...);
...

System information

relevant .vimrc excerpt:

let g:LanguageClient_serverCommands = {
    \ 'cpp': ['/bin/ccls',
    \ '--log-file=/tmp/ccls.log',
    \ '--init={"cache": {"directory": "$HOME/.cache/ccls"}}'],
\ }
@MaskRay MaskRay added the clang clang bugs/enhancement label Apr 11, 2019
@MaskRay
Copy link
Owner

MaskRay commented Apr 12, 2019

Nice report!

--init={"cache": {"directory": "$HOME/.cache/ccls"}}'

Note ccls doesn't expand shell-style $. You are relying on the language client to do that for you.

@MaskRay MaskRay removed the clang clang bugs/enhancement label Apr 12, 2019
@saladpanda
Copy link
Author

I'm afraid this does not fix the issue as I'm still not getting documentation for printf.

The problem seems to not be related to system headers.
I tried copying /usr/include/stdio.h into my test directory as mystdio.h and changed the include in a.h to #include "mystdio.h".
Still not getting the doc-comment for printf.

MaskRay added a commit that referenced this issue Apr 17, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue May 13, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 24, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 25, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Oct 25, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Nov 10, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Nov 10, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Nov 10, 2019
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Apr 22, 2020
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Apr 22, 2020
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
MaskRay added a commit that referenced this issue Apr 22, 2020
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine.

And improve comment handling in textDocument/hover

Fix #373
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants