mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Fix syntax validator
This commit is contained in:
parent
6715f67b7f
commit
e4d40bb29d
@ -12,6 +12,7 @@
|
||||
### Fixes
|
||||
|
||||
- Fix an issue that the application could not open a document containing a specific pattern of letters.
|
||||
- Fix an issue that the validation error message in the syntax editor did not change even when errors were found.
|
||||
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@ struct SyntaxValidationView: View {
|
||||
let validator: SyntaxValidator
|
||||
|
||||
@State private var errors: [SyntaxValidator.Error] = []
|
||||
@State private var selection: Int?
|
||||
|
||||
|
||||
// MARK: View
|
||||
@ -38,7 +39,7 @@ struct SyntaxValidationView: View {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
MessageView(count: self.errors.count)
|
||||
List(Array(self.errors.enumerated()), id: \.offset) { (_, error) in
|
||||
List(Array(self.errors.enumerated()), id: \.offset, selection: $selection) { (_, error) in
|
||||
ErrorView(error: error)
|
||||
}
|
||||
}
|
||||
@ -56,7 +57,7 @@ struct SyntaxValidationView: View {
|
||||
|
||||
private struct MessageView: View {
|
||||
|
||||
@State var count: Int
|
||||
var count: Int
|
||||
|
||||
|
||||
var body: some View {
|
||||
@ -105,7 +106,6 @@ struct SyntaxValidationView: View {
|
||||
.controlSize(.small)
|
||||
}
|
||||
}
|
||||
.foregroundColor(.label)
|
||||
.textSelection(.enabled)
|
||||
} icon: {
|
||||
Image(systemName: "exclamationmark.triangle")
|
||||
@ -132,3 +132,8 @@ struct SyntaxValidationView: View {
|
||||
return SyntaxValidationView(validator: .init(syntax: syntax))
|
||||
.frame(width: 400)
|
||||
}
|
||||
|
||||
#Preview("No Error") {
|
||||
SyntaxValidationView(validator: .init(syntax: [:]))
|
||||
.frame(width: 400)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user