Skip to content

Commit

Permalink
Strip out target file for diagnostics.
Browse files Browse the repository at this point in the history
This causes an issue for the semantic diagnostic phase.

Remove this flag on the server to simplify the client.
  • Loading branch information
jerrymarino committed May 28, 2017
1 parent dd6fce8 commit b1b5016
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion SwiftCompleter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,18 @@ SwiftCompleter::SwiftCompleter(LogLevel logLevel)
SwiftCompleter::~SwiftCompleter() {
}

// Transform completion flags into diagnostic flags
auto DiagnosticFlagsFromFlags(std::string filename, std::vector<std::string> flags) {
std::vector<std::string> outputFlags;
for (auto &f : flags) {
if (f == filename) {
continue;
}
outputFlags.push_back(f);
}
return outputFlags;
}

const std::string SwiftCompleter::CandidatesForLocationInFile(
const std::string &filename, int line, int column,
const std::vector<UnsavedFile> &unsavedFiles,
Expand All @@ -465,7 +477,7 @@ SwiftCompleter::DiagnosticsForFile(const std::string &filename,
CompletionContext ctx;
ctx.sourceFilename = filename;
ctx.unsavedFiles = unsavedFiles;
ctx.flags = flags;
ctx.flags = DiagnosticFlagsFromFlags(filename, flags);
ctx.line = 0;
ctx.column = 0;

Expand Down

0 comments on commit b1b5016

Please sign in to comment.