mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 00:34:26 +03:00
Migrate OpenQuicklyWindow.State
This commit is contained in:
parent
e3958b4802
commit
61132519e5
@ -79,21 +79,40 @@ struct AppState: SerializableState {
|
||||
|
||||
extension OpenQuicklyWindow {
|
||||
|
||||
struct State: SerializableState {
|
||||
struct State: Codable, SerializableState {
|
||||
|
||||
static let `default` = State()
|
||||
static let defaultIgnorePatterns = Set(["*/.git", "*.o", "*.d", "*.dia"].map(FileItemIgnorePattern.init))
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
|
||||
case ignorePatterns
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
if let patternsAsString = try container.decodeIfPresent(String.self, forKey: .ignorePatterns) {
|
||||
self.ignorePatterns = FileItemIgnorePattern.from(string: patternsAsString)
|
||||
} else {
|
||||
self.ignorePatterns = State.defaultIgnorePatterns
|
||||
}
|
||||
}
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(FileItemIgnorePattern.toString(self.ignorePatterns), forKey: .ignorePatterns)
|
||||
}
|
||||
|
||||
let root = FileItem(URL(fileURLWithPath: "/", isDirectory: true))
|
||||
|
||||
var flatFileItems = Observable<[FileItem]>.empty()
|
||||
var cwd = FileUtils.userHomeUrl
|
||||
var ignorePatterns = Set(["*/.git", "*.o", "*.d", "*.dia"].map(FileItemIgnorePattern.init))
|
||||
var ignorePatterns = State.defaultIgnorePatterns
|
||||
var ignoreToken = Token()
|
||||
|
||||
var open = false
|
||||
|
||||
init() {
|
||||
|
||||
}
|
||||
|
||||
init?(dict: [String: Any]) {
|
||||
|
Loading…
Reference in New Issue
Block a user