Fix a bunch of bugs in argument handling and address some TODOs

This commit is contained in:
Jacob Dufault 2017-10-18 01:24:52 -07:00
parent 0e7c8bdf05
commit a155f5b686
4 changed files with 798 additions and 515 deletions

View File

@ -292,8 +292,16 @@ void EnsureDocumentParsed(ClangCompleteManager* manager,
return;
std::vector<std::string> args = session->file.args;
// Show comment docstrings.
args.push_back("-fparse-all-comments");
// -fspell-checking enables FixIts for, ie, misspelled types.
if (!AnyStartsWith(args, "-fno-spell-checking") &&
!AnyStartsWith(args, "-fspell-checking")) {
args.push_back("-fspell-checking");
}
std::vector<CXUnsavedFile> unsaved = session->working_files->AsUnsavedFiles();
LOG_S(INFO) << "Creating completion session with arguments "

File diff suppressed because it is too large Load Diff

View File

@ -56,6 +56,13 @@ bool AnyStartsWith(const std::vector<std::string>& values,
[&start](const std::string& value) { return StartsWith(value, start); });
}
bool StartsWithAny(const std::string& value,
const std::vector<std::string>& startings) {
return std::any_of(
std::begin(startings), std::end(startings),
[&value](const std::string& starting) { return StartsWith(value, starting); });
}
bool EndsWithAny(const std::string& value,
const std::vector<std::string>& endings) {
return std::any_of(

View File

@ -25,6 +25,8 @@ bool StartsWith(const std::string& value, const std::string& start);
bool EndsWith(const std::string& value, const std::string& ending);
bool AnyStartsWith(const std::vector<std::string>& values,
const std::string& start);
bool StartsWithAny(const std::string& value,
const std::vector<std::string>& startings);
bool EndsWithAny(const std::string& value,
const std::vector<std::string>& endings);