]> granicus.if.org Git - clang/commitdiff
Add a code-completion context for "natural language" completions, so
authorDouglas Gregor <dgregor@apple.com>
Wed, 25 Aug 2010 17:10:00 +0000 (17:10 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 25 Aug 2010 17:10:00 +0000 (17:10 +0000)
that ASTUnit knows not to try to provide completions there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112057 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/CodeCompleteConsumer.h
lib/Sema/SemaCodeComplete.cpp

index 3bb9df34bc923ef9fa92c3c6ebcc2af67d1d5681..13d16e357d01f0be0eee8d141d0636843a1c0bb8 100644 (file)
@@ -181,7 +181,13 @@ public:
     /// (without any arguments, in the case of a function-like macro).
     CCC_MacroNameUse,
     /// \brief Code completion occurred within a preprocessor expression.
-    CCC_PreprocessorExpression
+    CCC_PreprocessorExpression,
+    /// \brief Code completion occurred in a context where natural language is
+    /// expected, e.g., a comment or string literal.
+    ///
+    /// This context usually implies that no completions should be added,
+    /// unless they come from an appropriate natural-language dictionary.
+    CCC_NaturalLanguage
   };
 
 private:
index 3aa3e6df8cf25029e40f9b5bf4616587c60cfcdc..6d91b465de2b4690aafc5689339b8b305c022df5 100644 (file)
@@ -4874,9 +4874,8 @@ void Sema::CodeCompletePreprocessorMacroArgument(Scope *S,
 }
 
 void Sema::CodeCompleteNaturalLanguage() {
-  // FIXME: Use a dedicated completion context for this!
   HandleCodeCompleteResults(this, CodeCompleter,
-                            CodeCompletionContext::CCC_Other,
+                            CodeCompletionContext::CCC_NaturalLanguage,
                             0, 0);
 }