mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-26 21:55:21 +03:00
swiftformat VimR
This commit is contained in:
parent
8a99ff5e23
commit
3bfe2ccdd6
@ -193,7 +193,7 @@ final class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
|
||||
nvimBinaryTitle.autoPinEdge(.top, to: .bottom, of: useInteractiveZshInfo, withOffset: 18)
|
||||
nvimBinaryTitle.autoPinEdge(.left, to: .left, of: useLiveResize, withOffset: 5)
|
||||
//nvimBinaryTitle.autoAlignAxis(.baseline, toSameAxisOf: nvimBinaryField)
|
||||
// nvimBinaryTitle.autoAlignAxis(.baseline, toSameAxisOf: nvimBinaryField)
|
||||
|
||||
nvimBinaryField.autoPinEdge(.top, to: .bottom, of: useInteractiveZshInfo, withOffset: 18)
|
||||
nvimBinaryField.autoPinEdge(.left, to: .right, of: nvimBinaryTitle, withOffset: 5)
|
||||
@ -204,7 +204,6 @@ final class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
object: nvimBinaryField,
|
||||
queue: nil
|
||||
) { [weak self] _ in self?.nvimBinaryFieldAction() }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class UpdaterDelegate: NSObject, SPUUpdaterDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@NSApplicationMain
|
||||
@main
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
|
||||
struct OpenConfig {
|
||||
var urls: [URL]
|
||||
|
@ -325,7 +325,7 @@ final class AppearancePref: PrefPane, NSComboBoxDelegate, NSControlTextEditingDe
|
||||
private func updateViews() {
|
||||
sharedFontPanel.setPanelFont(self.font, isMultiple: false)
|
||||
self.fontPanelButton.title = self.font.displayName
|
||||
.map { "\($0) \(font.pointSize)" } ?? "Show fonts..."
|
||||
.map { "\($0) \(self.font.pointSize)" } ?? "Show fonts..."
|
||||
self.linespacingField.stringValue = String(format: "%.2f", self.linespacing)
|
||||
self.characterspacingField.stringValue = String(format: "%.2f", self.characterspacing)
|
||||
self.ligatureCheckbox.boolState = self.usesLigatures
|
||||
|
@ -382,12 +382,12 @@ extension FileOutlineView {
|
||||
|
||||
self.emit(UuidAction(uuid: self.uuid, action: .open(url: node.url, mode: .verticalSplit)))
|
||||
}
|
||||
|
||||
@IBAction func newFile(_: Any?){
|
||||
|
||||
@IBAction func newFile(_: Any?) {
|
||||
guard let node = self.node(from: self.clickedItem) else { return }
|
||||
|
||||
|
||||
guard node.url.hasDirectoryPath else { return }
|
||||
|
||||
|
||||
let panel = NSSavePanel()
|
||||
panel.directoryURL = node.url
|
||||
panel.nameFieldLabel = "Filename"
|
||||
@ -414,16 +414,16 @@ extension FileOutlineView {
|
||||
showAlert()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
self.emit(UuidAction(uuid: self.uuid, action: .open(url: url, mode: .newTab)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@IBAction func deleteFile(_: Any?) {
|
||||
guard let node = self.node(from: self.clickedItem) else { return }
|
||||
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
|
||||
let showAlert: () -> Void = {
|
||||
let alert = NSAlert()
|
||||
alert.addButton(withTitle: "OK")
|
||||
@ -432,14 +432,14 @@ extension FileOutlineView {
|
||||
|
||||
alert.runModal()
|
||||
}
|
||||
|
||||
do{
|
||||
|
||||
do {
|
||||
try fileManager.trashItem(at: node.url, resultingItemURL: nil)
|
||||
} catch {
|
||||
showAlert()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
self.emit(UuidAction(uuid: self.uuid, action: .refresh))
|
||||
}
|
||||
|
||||
@ -522,8 +522,8 @@ extension FileOutlineView {
|
||||
guard let clickedNode = self.node(from: self.clickedItem) else { return true }
|
||||
|
||||
var isValid: Bool
|
||||
|
||||
switch(item.action) {
|
||||
|
||||
switch item.action {
|
||||
case #selector(self.setAsWorkingDirectory(_:)):
|
||||
isValid = clickedNode.url.hasDirectoryPath
|
||||
case #selector(self.newFile(_:)):
|
||||
|
@ -106,9 +106,9 @@ final class FuzzySearchService {
|
||||
let start = Swift.min(chunkIndex * coreDataBatchSize, count)
|
||||
fetchReq.fetchOffset = start
|
||||
do {
|
||||
self.scoreFiles(
|
||||
try self.scoreFiles(
|
||||
matcher: matcher,
|
||||
files: try context.fetch(fetchReq),
|
||||
files: context.fetch(fetchReq),
|
||||
callback: callback
|
||||
)
|
||||
} catch {
|
||||
|
@ -174,9 +174,11 @@ final class GeneralPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
|
||||
let customMarkdownProcessorTitle = self.titleTextField(title: "Custom Markdown Processor:")
|
||||
let customMarkdownProcessorField = self.customMarkdownProcessorField
|
||||
NotificationCenter.default.addObserver(forName: NSControl.textDidEndEditingNotification,
|
||||
object: customMarkdownProcessorField,
|
||||
queue: nil) { [unowned self] _ in
|
||||
NotificationCenter.default.addObserver(
|
||||
forName: NSControl.textDidEndEditingNotification,
|
||||
object: customMarkdownProcessorField,
|
||||
queue: nil
|
||||
) { [unowned self] _ in
|
||||
self.customMarkdownProcessorAction()
|
||||
}
|
||||
|
||||
@ -331,13 +333,25 @@ final class GeneralPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
cliToolInfo.autoPinEdge(toSuperviewEdge: .right, withInset: 18, relation: .greaterThanOrEqual)
|
||||
cliToolInfo.autoPinEdge(.left, to: .right, of: cliToolTitle, withOffset: 5)
|
||||
|
||||
customMarkdownProcessorTitle.autoAlignAxis(.baseline, toSameAxisOf: customMarkdownProcessorField)
|
||||
customMarkdownProcessorTitle.autoAlignAxis(
|
||||
.baseline,
|
||||
toSameAxisOf: customMarkdownProcessorField
|
||||
)
|
||||
customMarkdownProcessorTitle.autoPinEdge(.right, to: .right, of: openUntitledWindowTitle)
|
||||
customMarkdownProcessorTitle.autoPinEdge(toSuperviewEdge: .left, withInset: 18, relation: .greaterThanOrEqual)
|
||||
customMarkdownProcessorTitle.autoPinEdge(
|
||||
toSuperviewEdge: .left,
|
||||
withInset: 18,
|
||||
relation: .greaterThanOrEqual
|
||||
)
|
||||
|
||||
customMarkdownProcessorField.autoPinEdge(.top, to: .bottom, of: cliToolInfo, withOffset: 18)
|
||||
customMarkdownProcessorField.autoPinEdge(toSuperviewEdge: .right, withInset: 18)
|
||||
customMarkdownProcessorField.autoPinEdge(.left, to: .right, of: customMarkdownProcessorTitle, withOffset: 5)
|
||||
customMarkdownProcessorField.autoPinEdge(
|
||||
.left,
|
||||
to: .right,
|
||||
of: customMarkdownProcessorTitle,
|
||||
withOffset: 5
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ extension MainWindow {
|
||||
)
|
||||
)
|
||||
}, onError: {
|
||||
err in self.log.trace("oops couldn't set theme")
|
||||
_ in self.log.trace("oops couldn't set theme")
|
||||
})
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
@ -156,8 +156,10 @@ extension MainWindow {
|
||||
(
|
||||
colorName: colorName,
|
||||
observable: self.neoVimView.api
|
||||
.getHl(ns_id: 0,
|
||||
opts: ["name": MessagePackValue(colorName)])
|
||||
.getHl(
|
||||
ns_id: 0,
|
||||
opts: ["name": MessagePackValue(colorName)]
|
||||
)
|
||||
.asObservable()
|
||||
)
|
||||
})
|
||||
|
@ -33,7 +33,7 @@ final class MainWindow: NSObject,
|
||||
|
||||
var activateAsciiImInInsertMode: Bool {
|
||||
get { self.neoVimView.activateAsciiImInNormalMode }
|
||||
set { self.neoVimView.activateAsciiImInNormalMode = newValue }
|
||||
self.set { self.neoVimView.activateAsciiImInNormalMode = newValue }
|
||||
}
|
||||
|
||||
weak var shortcutService: ShortcutService?
|
||||
@ -260,7 +260,7 @@ final class MainWindow: NSObject,
|
||||
private var usesTheme = true
|
||||
private var lastThemeMark = Token()
|
||||
|
||||
internal let log = OSLog(
|
||||
let log = OSLog(
|
||||
subsystem: Defs.loggerSubsystem,
|
||||
category: Defs.LoggerCategory.ui
|
||||
)
|
||||
|
@ -106,7 +106,11 @@ final class MarkdownPreviewMiddleware {
|
||||
category: Defs.LoggerCategory.middleware
|
||||
)
|
||||
|
||||
private func render(_ bufferUrl: URL, to htmlUrl: URL, customMarkdownProcessor cmp: String?) throws {
|
||||
private func render(
|
||||
_ bufferUrl: URL,
|
||||
to htmlUrl: URL,
|
||||
customMarkdownProcessor cmp: String?
|
||||
) throws {
|
||||
let body: String
|
||||
if let cmp, cmp != "" {
|
||||
let content = try Data(contentsOf: bufferUrl)
|
||||
|
@ -226,10 +226,10 @@ struct AppearanceState: Codable {
|
||||
}
|
||||
|
||||
self
|
||||
.linespacing = (try container.decodeIfPresent(Double.self, forKey: .editorLinespacing) ?? 1.0)
|
||||
.linespacing = try (container.decodeIfPresent(Double.self, forKey: .editorLinespacing) ?? 1.0)
|
||||
self
|
||||
.characterspacing = (
|
||||
try container
|
||||
.characterspacing = try (
|
||||
container
|
||||
.decodeIfPresent(Double.self, forKey: .editorCharacterspacing) ?? 1.0
|
||||
)
|
||||
self.usesLigatures = try container
|
||||
@ -263,9 +263,11 @@ struct AppearanceState: Codable {
|
||||
|
||||
extension MainWindow {
|
||||
struct State: Codable {
|
||||
static let `default` = State(isAllToolsVisible: true,
|
||||
isToolButtonsVisible: true,
|
||||
nvimBinary: "")
|
||||
static let `default` = State(
|
||||
isAllToolsVisible: true,
|
||||
isToolButtonsVisible: true,
|
||||
nvimBinary: ""
|
||||
)
|
||||
|
||||
static let defaultTools: [MainWindow.Tools: WorkspaceToolState] = [
|
||||
.fileBrowser: WorkspaceToolState(location: .left, dimension: 200, open: true),
|
||||
@ -329,7 +331,6 @@ extension MainWindow {
|
||||
var isLeftOptionMeta = false
|
||||
var isRightOptionMeta = false
|
||||
|
||||
|
||||
// to be cleaned
|
||||
var urlsToOpen = [URL: OpenMode]()
|
||||
var currentBufferToSet: NvimView.Buffer?
|
||||
@ -380,7 +381,8 @@ extension MainWindow {
|
||||
forKey: .useInteractiveZsh,
|
||||
default: State.default.useInteractiveZsh
|
||||
)
|
||||
self.nvimBinary = try container.decodeIfPresent(String.self, forKey: .nvimBinary) ?? State.default.nvimBinary
|
||||
self.nvimBinary = try container.decodeIfPresent(String.self, forKey: .nvimBinary) ?? State
|
||||
.default.nvimBinary
|
||||
self.useLiveResize = try container.decode(
|
||||
forKey: .useLiveResize,
|
||||
default: State.default.useLiveResize
|
||||
|
Loading…
Reference in New Issue
Block a user