tigersoldier / company-lsp

Company completion backend for lsp-mode
GNU General Public License v3.0
251 stars 26 forks source link

Company shows misleading completions when no newline is below #101

Closed goranmoomin closed 5 years ago

goranmoomin commented 5 years ago

lsp-company displays misleading completions when no newline is below.

When I type in C++ code:

#include <ios| <-- point here

The completions display _Nonnull (keyword), _Null_unspecified (keyword), etc.... while if there is a newline in the bottom

#include <ios| <-- point here

The completions display ios> (File), iosfwd> (File), iostream> (File), etc...

Additionally, the erroneous completions are also displayed after finishing the header:

#include <iostream>| <-- point here

with the same completions, which makes pressing enter/return insert _Nonnull in the location of the point. (and the next line becomes indented... I can't understand that behavior 😞 )

tigersoldier commented 5 years ago

This is a server issue. What C++ language server are you using? ccls, cquery, or clangd?

cc @MaskRay in case it's a ccls issue.

goranmoomin commented 5 years ago

@tigersoldier it’s clangd 😞

Sent with GitHawk

tigersoldier commented 5 years ago

Just tried clangd, this is also happening to me. It's clearly clangd doesn't handle #include correctly. I've considered setting company-lsp-filter-candidates to t for clangd but company-lsp currently doesn't implement flex matching, which means typing back won't match push_back, which clangd offers with server-side filtering.

Please report a bug on clangd side.