From 64580decabe4e7b03a502ed225d5743c20df9c42 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Wed, 19 Jul 2017 00:20:19 -0700 Subject: [PATCH] Push cursor position to end when updating delayed diagnostics --- src/clang_complete.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/clang_complete.cc b/src/clang_complete.cc index 34d04f39..534d82b7 100644 --- a/src/clang_complete.cc +++ b/src/clang_complete.cc @@ -363,6 +363,13 @@ void CompletionDiagnosticsDelayedRefreshMain(ClangCompleteManager* completion_ma if (has_completion_since_sleeping) continue; + // Push completion request to the end of the line. clang may report errors + // if completing in the middle of the line. Not a perfect hueristic, but + // probably good enough. + // TODO: Consider scanning for a semicolon if this doesn't work well in + // practice. + location.position.character = 10000; + // Make completion request to get refreshed diagnostics. auto request = MakeUnique(); request->location = location;