aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-10 10:33:29 +0100
committerGitHub <[email protected]>2020-07-10 10:33:29 +0100
commit5fa8f8e3761363098c80e11842682dffcee171d8 (patch)
tree4a099f7cc7ea3c42f89d79268d905a5f81f237a3 /crates
parentdc9596358ac2fa14a46773bad158603ba5a769e0 (diff)
parent17ff67dd7e874ad7cff5251684fb242c4a4e3200 (diff)
Merge #5286
5286: Only take first 500 syntax errors r=jonas-schievink a=yihuang Too many syntax errors make some editor/ide slow, fix #3434. Co-authored-by: yihuang <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/diagnostics.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index e69e9b4ec..71fd45e5d 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -35,7 +35,8 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
35 let parse = db.parse(file_id); 35 let parse = db.parse(file_id);
36 let mut res = Vec::new(); 36 let mut res = Vec::new();
37 37
38 res.extend(parse.errors().iter().map(|err| Diagnostic { 38 // [#34344] Only take first 500 errors to prevent slowing down editor/ide, the number 500 is chosen arbitrarily.
39 res.extend(parse.errors().iter().take(500).map(|err| Diagnostic {
39 range: err.range(), 40 range: err.range(),
40 message: format!("Syntax Error: {}", err), 41 message: format!("Syntax Error: {}", err),
41 severity: Severity::Error, 42 severity: Severity::Error,