Skip to content

Commit b1b5016

Browse files
committed
Strip out target file for diagnostics.
This causes an issue for the semantic diagnostic phase. Remove this flag on the server to simplify the client.
1 parent dd6fce8 commit b1b5016

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

SwiftCompleter.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,18 @@ SwiftCompleter::SwiftCompleter(LogLevel logLevel)
440440
SwiftCompleter::~SwiftCompleter() {
441441
}
442442

443+
// Transform completion flags into diagnostic flags
444+
auto DiagnosticFlagsFromFlags(std::string filename, std::vector<std::string> flags) {
445+
std::vector<std::string> outputFlags;
446+
for (auto &f : flags) {
447+
if (f == filename) {
448+
continue;
449+
}
450+
outputFlags.push_back(f);
451+
}
452+
return outputFlags;
453+
}
454+
443455
const std::string SwiftCompleter::CandidatesForLocationInFile(
444456
const std::string &filename, int line, int column,
445457
const std::vector<UnsavedFile> &unsavedFiles,
@@ -465,7 +477,7 @@ SwiftCompleter::DiagnosticsForFile(const std::string &filename,
465477
CompletionContext ctx;
466478
ctx.sourceFilename = filename;
467479
ctx.unsavedFiles = unsavedFiles;
468-
ctx.flags = flags;
480+
ctx.flags = DiagnosticFlagsFromFlags(filename, flags);
469481
ctx.line = 0;
470482
ctx.column = 0;
471483

0 commit comments

Comments
 (0)