mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[code-completion] Disable diagnostics in @functionBuilder bodies
When performing code-completion inside the body of a @functionBuilder closure/function, set the flag to suppress diagnostics. This works around a big performance problem in some complex bodies that do not typecheck, which is typical during code-completion. A real-world example with SwitfUI went from ~50 seconds to 0.5. We do not disable diagnostics in general because the diagnostic paths provide falback types that are useful to code-completion. rdar://52356229
This commit is contained in:
@@ -103,6 +103,13 @@ public:
|
||||
rangeContainsTokenLoc(Enclosing, Inner.End);
|
||||
}
|
||||
|
||||
/// Returns true if range \p R contains the code-completion location, if any.
|
||||
bool rangeContainsCodeCompletionLoc(SourceRange R) const {
|
||||
return CodeCompletionBufferID
|
||||
? rangeContainsTokenLoc(R, getCodeCompletionLoc())
|
||||
: false;
|
||||
}
|
||||
|
||||
/// Returns the buffer ID for the specified *valid* location.
|
||||
///
|
||||
/// Because a valid source location always corresponds to a source buffer,
|
||||
|
||||
Reference in New Issue
Block a user