mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Ignore ill-formatted file mapping in syntax definition (fix #1625)
This commit is contained in:
parent
c1dea1aac5
commit
6f2b88afd8
@ -13,6 +13,7 @@
|
||||
### Fixes
|
||||
|
||||
- Fix syntax highlighting for simple words.
|
||||
- Fix an issue on CotEditor 4.8.0 that custom syntaxes could be ignored when it contains ill-formed file mapping definitions.
|
||||
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ extension Syntax: Codable {
|
||||
|
||||
private struct KeyString: Codable {
|
||||
|
||||
var keyString: String
|
||||
var keyString: String?
|
||||
}
|
||||
|
||||
|
||||
@ -78,11 +78,11 @@ extension Syntax: Codable {
|
||||
|
||||
self.commentDelimiters = try values.decodeIfPresent(Comment.self, forKey: .commentDelimiters) ?? .init()
|
||||
self.outlines = try values.decodeIfPresent([Outline].self, forKey: .outlines) ?? []
|
||||
self.completions = try values.decodeIfPresent([KeyString].self, forKey: .completions)?.map(\.keyString) ?? []
|
||||
self.completions = try values.decodeIfPresent([KeyString].self, forKey: .completions)?.compactMap(\.keyString) ?? []
|
||||
|
||||
self.filenames = try values.decodeIfPresent([KeyString].self, forKey: .filenames)?.map(\.keyString) ?? []
|
||||
self.extensions = try values.decodeIfPresent([KeyString].self, forKey: .extensions)?.map(\.keyString) ?? []
|
||||
self.interpreters = try values.decodeIfPresent([KeyString].self, forKey: .interpreters)?.map(\.keyString) ?? []
|
||||
self.filenames = try values.decodeIfPresent([KeyString].self, forKey: .filenames)?.compactMap(\.keyString) ?? []
|
||||
self.extensions = try values.decodeIfPresent([KeyString].self, forKey: .extensions)?.compactMap(\.keyString) ?? []
|
||||
self.interpreters = try values.decodeIfPresent([KeyString].self, forKey: .interpreters)?.compactMap(\.keyString) ?? []
|
||||
|
||||
self.metadata = try values.decodeIfPresent(Metadata.self, forKey: .metadata) ?? .init()
|
||||
}
|
||||
|
@ -65,9 +65,9 @@ public struct SyntaxMap: Equatable, Codable {
|
||||
let syntaxName = url.deletingPathExtension().lastPathComponent
|
||||
|
||||
map[syntaxName] = SyntaxMap(
|
||||
extensions: syntax.extensions?.map(\.keyString) ?? [],
|
||||
filenames: syntax.filenames?.map(\.keyString) ?? [],
|
||||
interpreters: syntax.interpreters?.map(\.keyString) ?? []
|
||||
extensions: syntax.extensions?.compactMap(\.keyString) ?? [],
|
||||
filenames: syntax.filenames?.compactMap(\.keyString) ?? [],
|
||||
interpreters: syntax.interpreters?.compactMap(\.keyString) ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ private struct Syntax: Codable {
|
||||
|
||||
struct KeyString: Codable {
|
||||
|
||||
var keyString: String
|
||||
var keyString: String?
|
||||
}
|
||||
|
||||
var extensions: [KeyString]?
|
||||
|
Loading…
Reference in New Issue
Block a user