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

Changes to header not registering in cpp file #41

Closed
lane-s opened this issue Apr 13, 2019 · 3 comments
Closed

Changes to header not registering in cpp file #41

lane-s opened this issue Apr 13, 2019 · 3 comments

Comments

@lane-s
Copy link

lane-s commented Apr 13, 2019

If I have a header file and a cpp file open at the same time and add a function prototype to the header, I would expect to be able to write the function implementation in the cpp buffer without any errors.

However, usually I get the message that the function I'm implementing is not defined. Sometimes saving both files seems to trigger everything to refresh, but otherwise the only way I know how to fix it is by restarting the lsp workspace.

Any idea what's causing this? I'm not sure if it's a problem with emacs-ccls or lsp-mode in general, but I figured I'd ask here first. Thanks

@MaskRay
Copy link
Member

MaskRay commented Apr 14, 2019

// a.cc
#include "a.h"
int main() { foo(); }
// a.h
// empty

There is "use of undeclared identifier 'foo'" error message published by textDocument/publishDiagnostics. Then, if you put void foo(); into a.h and make an edit in a.cc, the edit causes the client (lsp-mode) to send a textDocument/didChange notification to the ccls server. ccls will thereby send an empty textDocument/publishDiagnostics to indicate the error has been fixed.

Sometimes there may be lingering diagnostics, but that is probably lsp-ui-flycheck (or flycheck) or flymake's problem.

@MaskRay MaskRay closed this as completed Apr 14, 2019
@lane-s
Copy link
Author

lane-s commented Apr 16, 2019

Thank you. Now that I know what to look for in the logs, it seems the empty publishDiagnostics message is being sent, so the problem is with lsp-ui.

@MaskRay
Copy link
Member

MaskRay commented Apr 16, 2019

If you use lsp-ui-flycheck, see emacs-lsp/lsp-ui#214

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