Check LinterSettings::preview for version-related syntax errors (#16429)

This commit is contained in:
Brent Westbrook 2025-02-28 03:58:22 -05:00 committed by GitHub
parent 4a23756024
commit 3d72138740
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -205,6 +205,12 @@ impl Workspace {
let source_code = locator.to_source_code();
let unsupported_syntax_errors = if self.settings.linter.preview.is_enabled() {
parsed.unsupported_syntax_errors()
} else {
&[]
};
let messages: Vec<ExpandedMessage> = diagnostics
.into_iter()
.map(|diagnostic| {
@ -242,7 +248,7 @@ impl Workspace {
fix: None,
}
}))
.chain(parsed.unsupported_syntax_errors().iter().map(|error| {
.chain(unsupported_syntax_errors.iter().map(|error| {
let start_location = source_code.source_location(error.range.start());
let end_location = source_code.source_location(error.range.end());