before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
return menu } func helpMenu(_ menu: NSMenu) -> NSMenu { menu.insertItem(withTitle: "Jump To Definition", action: nil, keyEquivalent: "", at: 1) menu.insertItem(withTitle: "Show Code Actions", ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
} func helpMenu(_ menu: NSMenu) -> NSMenu { menu.insertItem(withTitle: "Jump To Definition", action: nil, keyEquivalent: "", at: 0) menu.insertItem(withTitle: "Show Code Actions", action: nil, ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
action: nil, keyEquivalent: "", at: 1) menu.insertItem(withTitle: "Show Code Actions", action: nil, keyEquivalent: "", at: 2) menu.insertItem(withTitle: "Show...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
keyEquivalent: "", at: 0) menu.insertItem(withTitle: "Show Code Actions", action: nil, keyEquivalent: "", at: 1) menu.insertItem(withTitle: "Show Quick Help", ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
action: nil, keyEquivalent: "", at: 2) menu.insertItem(withTitle: "Show Quick Help", action: nil, keyEquivalent: "", at: 3) menu.insertItem(.separator(), at: ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
keyEquivalent: "", at: 1) menu.insertItem(withTitle: "Show Quick Help", action: nil, keyEquivalent: "", at: 2) menu.insertItem(.separator(), at: 3) return menu } fu...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
return menu } func codeMenu(_ menu: NSMenu) -> NSMenu { menu.insertItem(withTitle: "Refactor", action: nil, keyEquivalent: "", at: 5) menu.insertItem(withTitle: "Find", action: nil, ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
} func codeMenu(_ menu: NSMenu) -> NSMenu { menu.insertItem(withTitle: "Refactor", action: nil, keyEquivalent: "", at: 4) menu.insertItem(withTitle: "Find", action: nil, key...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
menu.insertItem(withTitle: "Refactor", action: nil, keyEquivalent: "", at: 5) menu.insertItem(withTitle: "Find", action: nil, keyEquivalent: "", at: 6) ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
action: nil, keyEquivalent: "", at: 4) menu.insertItem(withTitle: "Find", action: nil, keyEquivalent: "", at: 5) menu.insertItem(withTitle: "Navigate", ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
menu.insertItem(withTitle: "Find", action: nil, keyEquivalent: "", at: 6) menu.insertItem(withTitle: "Navigate", action: nil, keyEquivalent: "", at: 7) ...
Please make it localized. add `.localized()` and add it to `Localizable.strings`
action: nil, keyEquivalent: "", at: 5) menu.insertItem(withTitle: "Navigate", action: nil, keyEquivalent: "", at: 6) menu.insertItem(.separator(), at: 7) ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.357
suggestion
81
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
return menu } func gitMenu(_ menu: NSMenu) -> NSMenu { menu.insertItem(withTitle: "Show Last Change For Line", action: nil, keyEquivalent: "", at: 9) menu.insertItem(withTitle: "Create Code Snippet...", ...
How does this work/perform on non-english systems? is it maybe better to not use the `super.menu(for: event)` to remove this. This means that we must make a custom `cut`, `copy`, `paste`.
return menu } func gitMenu(_ menu: NSMenu) -> NSMenu { menu.insertItem(withTitle: "Show Last Change For Line", action: nil, keyEquivalent: "", at: 8) menu.insertItem(withTitle: "Create Code Snippet...", ...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.571
refactor
189
51
51
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
} if let transformationsItem = menu.item(withTitle: "Transformations") { menu.removeItem(transformationsItem) } if let speechItem = menu.item(withTitle: "Speech") { menu.removeItem(speechItem) } if let shareItem = menu.item(withTitle: "Share") {...
How does this work/perform on non-english systems? is it maybe better to not use the `super.menu(for: event)` to remove this. This means that we must make a custom `cut`, `copy`, `paste`.
// // CodeEditorTextView.swift // CodeEdit // // Created by Marco Carnevali on 19/03/22. // import Cocoa import SwiftUI public class CodeEditorTextView: NSTextView { @AppStorage(EditorTabWidth.storageKey) private var tabWidth: Int = EditorTabWidth.default init( textContainer container: NSTextC...
@@ -89,4 +89,156 @@ public class CodeEditorTextView: NSTextView { replacementRange: selectedRange() ) } + + /// input a backslash (\\) + @IBAction func inputBackSlash(_ sender: Any?) { + super.insertText( + "\\", + replacementRange: selectedRange() + ...
CodeEditModules/Modules/CodeFile/src/TextView/CodeEditorTextView.swift
26
Swift
0.571
refactor
189
51
207
false
Custom Context Menu for Code Editor
334
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
nanashili
class OutlineTableViewCell: NSTableCellView { var label: NSTextField! var icon: NSImageView! override init(frame frameRect: NSRect) { super.init(frame: frameRect) // Create the label self.label = NSTextField(frame: .zero) self.label.translatesAutoresizingMaskIntoConstrain...
This line can be removed? (36)
class OutlineTableViewCell: NSTableCellView { var label: NSTextField! var icon: NSImageView! override init(frame frameRect: NSRect) { super.init(frame: frameRect) // Create the label self.label = NSTextField(frame: .zero) self.label.translatesAutoresizingMaskIntoConstrain...
@@ -32,26 +32,37 @@ class OutlineTableViewCell: NSTableCellView { self.icon = NSImageView(frame: .zero) self.icon.translatesAutoresizingMaskIntoConstraints = false - self.icon.symbolConfiguration = .init(textStyle: .callout, scale: .medium) + self.icon.symbolConfiguration = .init(point...
CodeEdit/NavigatorSidebar/ProjectNavigator/OutlineView/OutlineTableViewCell.swift
26
Swift
0.143
suggestion
30
51
51
false
`Project Navigator`: Implemented Setting for changing Item Size
418
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
lukepistrol
@IBAction func openWelcome(_ sender: Any) { if let window = NSApp.windows.filter({ window in return (window.contentView as? NSHostingView<WelcomeWindowView>) != nil }).first { window.makeKeyAndOrderFront(self) return } let window = NSWindow(conten...
move the `else` statement to the previous line: ```swift if ... { ... } else { … } ``` having it on a new line fails in `SwiftLint`
@IBAction func openWelcome(_ sender: Any) { if let window = NSApp.windows.filter({ window in return (window.contentView as? NSHostingView<WelcomeWindowView>) != nil }).first { window.makeKeyAndOrderFront(self) return } let window = NSWindow(conten...
@@ -144,10 +144,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { } } - } else { - CodeEditDocumentController.shared.openDocument { _, _ in + } + else {
CodeEdit/AppDelegate.swift
26
Swift
0.786
bug
148
51
51
false
Added functionality to close welcome screen when file is selected
424
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
dzign1
print(document, documentWasAlreadyOpen) }, cancelHandler: {}) } override func openDocument(withContentsOf url: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) { super...
Instead of ```swift func openDocument(completionHandler: @escaping (NSDocument?, Bool) -> Void, cancelHandler: @escaping () -> Void) {} ``` consider using a blank or `onCompletion` label for the first argument and `onCancel` for the second one. ```swift func openDocument(_ completionHandler: @escaping (NSDo...
print(document, documentWasAlreadyOpen) }, onCancel: {}) } override func openDocument(withContentsOf url: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) { super.open...
@@ -41,7 +41,7 @@ class CodeEditDocumentController: NSDocumentController { } extension NSDocumentController { - func openDocument(completionHandler: @escaping (NSDocument?, Bool) -> Void) { + func openDocument(completionHandler: @escaping (NSDocument?, Bool) -> Void, cancelHandler: @escaping () -> Void) {
CodeEdit/Documents/CodeEditDocumentController.swift
26
Swift
1
suggestion
383
51
51
false
Added functionality to close welcome screen when file is selected
424
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
dzign1
// Created by Nanshi Li on 2022/04/01. // import SwiftUI struct SourceControlGitView: View { @State var ignoredFileSelection: IgnoredFiles.ID? @StateObject private var prefs: AppPreferencesModel = .shared var body: some View { VStack { PreferencesSection("Author Name", hideLabe...
Add a 1pt border around the list so it better separates from the rest. <img width="1016" alt="Screen Shot 2022-04-14 at 00 22 17" src="https://user-images.githubusercontent.com/9460130/163280036-171c1d66-c4b3-4d57-ab8c-4970d3d1a987.png"> Reference: <img width="942" alt="Screen Shot 2022-04-14 at 00 26 10" src=...
// Created by Nanshi Li on 2022/04/01. // import SwiftUI struct SourceControlGitView: View { @State var ignoredFileSelection: IgnoredFiles.ID? @StateObject private var prefs: AppPreferencesModel = .shared var body: some View { VStack { PreferencesSection("Author Name", hideLabe...
@@ -27,17 +27,17 @@ struct SourceControlGitView: View { } PreferencesSection("Ignored Files", hideLabels: false) { - if prefs.preferences.sourceControl.git.ignoredFiles.isEmpty { - Text("No Ignored Files") - .background(Color(NSColor.t...
CodeEditModules/Modules/AppPreferences/src/Sections/SourceControlPreferences/SourceControlGitView.swift
26
Swift
0.5
suggestion
427
51
51
false
Small UI fixes regarding previous Accounts and Source Control PR
442
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nanashili
import SwiftUI /// A view that implements the `General` preference section public struct GeneralPreferencesView: View { @StateObject private var prefs: AppPreferencesModel = .shared public init() {} public var body: some View { PreferencesContent { PreferencesSection("Appearance"...
Add a ```swift private let inputWidth: Double = 160 ``` and use this instead of _magic numbers_.
import SwiftUI /// A view that implements the `General` preference section public struct GeneralPreferencesView: View { private let inputWidth: Double = 160 @StateObject private var prefs: AppPreferencesModel = .shared public init() {} public var body: some View { PreferencesContent { ...
@@ -30,6 +30,7 @@ public struct GeneralPreferencesView: View { .onChange(of: prefs.preferences.general.appAppearance) { tag in tag.applyAppearance() } + .frame(width: 160)
CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift
26
Swift
0.786
suggestion
104
51
51
false
Preferences: Add Comparison View and Source Control Navigator
453
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
Toggle("Include upstream changes", isOn: $prefs.preferences.sourceControl.general.includeUpstreamChanges) .toggleStyle(.checkbox) .padding(.leading, 20) } PreferencesSection("Comparison View", hideLabels: true) { ...
Add a ```swift private let inputWidth: Double = 200 ``` and use this instead of _magic numbers_.
.toggleStyle(.checkbox) Toggle("Include upstream changes", isOn: $prefs.preferences.sourceControl.general.includeUpstreamChanges) .toggleStyle(.checkbox) .padding(.leading, 20) } PreferencesSecti...
@@ -51,27 +51,31 @@ struct SourceControlGeneralView: View { .padding(.leading, 20) } - PreferencesSection("Comparison View", hideLabels: false) { - Menu { - Button("Comparison") {} - } label: { + PreferencesSectio...
CodeEditModules/Modules/AppPreferences/src/Sections/SourceControlPreferences/SourceControlGeneralView.swift
26
Swift
0.786
suggestion
104
46
49
false
Preferences: Add Comparison View and Source Control Navigator
453
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
public init() {} public var body: some View { PreferencesContent { PreferencesSection("Shell") { shellSelector optionAsMetaToggle } PreferencesSection("Font") { fontSelector } } } private v...
Add a ```swift private let inputWidth: Double = 150 ``` and use this instead of _magic numbers_.
@StateObject private var prefs: AppPreferencesModel = .shared public init() {} public var body: some View { PreferencesContent { PreferencesSection("Shell") { shellSelector optionAsMetaToggle } PreferencesSection("Font") { ...
@@ -39,6 +39,7 @@ public struct TerminalPreferencesView: View { Text("Bash") .tag(AppPreferences.TerminalShell.bash) } + .frame(width: 150)
CodeEditModules/Modules/AppPreferences/src/Sections/TerminalPreferences/TerminalPreferencesView.swift
26
Swift
0.786
suggestion
104
51
51
false
Preferences: Add Comparison View and Source Control Navigator
453
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
public init() {} /// Explicit decoder init for setting default values when key is not present in `JSON` public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.general = try container.decodeIfPresent(SourceControlGe...
Since this is a setting which will be in `preferences.json` make sure to choose a name that is descriptive to what it does.
public init() {} /// Explicit decoder init for setting default values when key is not present in `JSON` public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.general = try container.decodeIfPresent(SourceControlGe...
@@ -40,9 +40,9 @@ public extension AppPreferences { /// Indicates whether or not we should include the upsteam public var includeUpstreamChanges: Bool = false /// The selected value of the comparison view - public var comparisonView: Int = 0 + public var comparisonView: Comparis...
CodeEditModules/Modules/AppPreferences/src/Model/Source Control/SourceControlPreferences.swift
26
Swift
0.571
suggestion
123
51
51
false
Preferences: Add Comparison View and Source Control Navigator
453
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.general = try container.decodeIfPresent(SourceControlGeneral.self, forKey: .general) ?? .init() self.git = try container.decodeIfPresent(SourceControlGit.self, for...
Since this is a setting which will be in `preferences.json` make sure to choose a name that is descriptive to what it does.
public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.general = try container.decodeIfPresent(SourceControlGeneral.self, forKey: .general) ?? .init() self.git = try container.decodeIfPresent(SourceControlGit.self, for...
@@ -40,9 +40,9 @@ public extension AppPreferences { /// Indicates whether or not we should include the upsteam public var includeUpstreamChanges: Bool = false /// The selected value of the comparison view - public var comparisonView: Int = 0 + public var comparisonView: Comparis...
CodeEditModules/Modules/AppPreferences/src/Model/Source Control/SourceControlPreferences.swift
26
Swift
0.571
suggestion
123
51
51
false
Preferences: Add Comparison View and Source Control Navigator
453
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
// // AccountListItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI struct AccountListItem: View { var gitClientName: String var body: some View { HStack { Image("vault.fill") .resizable() .frame(width: 28.0, height: 28.0) ...
Please also note this in the PR description!
// // AccountListItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI import CodeEditSymbols struct AccountListItem: View { var gitClientName: String var body: some View { HStack { Image(symbol: "vault.fill") .resizable() .frame(wi...
@@ -13,7 +13,7 @@ struct AccountListItem: View { var body: some View { HStack { - Image(systemName: "xmark.square.fill") + Image("vault.fill")
CodeEditModules/Modules/AppPreferences/src/Sections/AccountsPreferences/Accounts/AccountListItem.swift
16
Swift
0.071
suggestion
44
24
25
false
Line Gutter & Accounts: Put the correct font and width size, also added vault icons
469
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nanashili
// // GitAccountItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI struct GitAccountItem: View { @Binding var sourceControlAccount: SourceControlAccounts var body: some View { HStack { Image("vault.fill") .resizable() .frame(...
Please also note this in the PR description!
// // GitAccountItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI import CodeEditSymbols struct GitAccountItem: View { @Binding var sourceControlAccount: SourceControlAccounts var body: some View { HStack { Image(symbol: "vault.fill") .resi...
@@ -14,7 +14,7 @@ struct GitAccountItem: View { var body: some View { HStack { - Image(systemName: "xmark.square.fill") + Image("vault.fill")
CodeEditModules/Modules/AppPreferences/src/Sections/AccountsPreferences/Accounts/Login/GitAccountItem.swift
17
Swift
0.071
suggestion
44
30
31
false
Line Gutter & Accounts: Put the correct font and width size, also added vault icons
469
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nanashili
// // AccountListItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI struct AccountListItem: View { var gitClientName: String var body: some View { HStack { Image("vault.fill") .resizable() .frame(width: 28.0, height: 28.0) ...
Please update to use the new `CodeEditSymbols` package. Reference: * #472 * https://github.com/CodeEditApp/CodeEditSymbols
// // AccountListItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI import CodeEditSymbols struct AccountListItem: View { var gitClientName: String var body: some View { HStack { Image(symbol: "vault.fill") .resizable() .frame(wi...
@@ -13,7 +13,7 @@ struct AccountListItem: View { var body: some View { HStack { - Image(systemName: "xmark.square.fill") + Image("vault.fill")
CodeEditModules/Modules/AppPreferences/src/Sections/AccountsPreferences/Accounts/AccountListItem.swift
16
Swift
0.571
suggestion
129
24
25
false
Line Gutter & Accounts: Put the correct font and width size, also added vault icons
469
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nanashili
// // GitAccountItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI struct GitAccountItem: View { @Binding var sourceControlAccount: SourceControlAccounts var body: some View { HStack { Image("vault.fill") .resizable() .frame(...
Please update to use the new `CodeEditSymbols` package. Reference: * #472 * https://github.com/CodeEditApp/CodeEditSymbols
// // GitAccountItem.swift // // // Created by Nanshi Li on 2022/04/01. // import SwiftUI import CodeEditSymbols struct GitAccountItem: View { @Binding var sourceControlAccount: SourceControlAccounts var body: some View { HStack { Image(symbol: "vault.fill") .resi...
@@ -14,7 +14,7 @@ struct GitAccountItem: View { var body: some View { HStack { - Image(systemName: "xmark.square.fill") + Image("vault.fill")
CodeEditModules/Modules/AppPreferences/src/Sections/AccountsPreferences/Accounts/Login/GitAccountItem.swift
17
Swift
0.571
suggestion
129
30
31
false
Line Gutter & Accounts: Put the correct font and width size, also added vault icons
469
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nanashili
// is possible to make a customized Button (which may solve the clicking conflict, // but I am not sure). I will try that in the future. var body: some View { Button(action: switchAction) { content } .buttonStyle(TabBarItemButtonStyle()) .keyboardShortcut( ...
Please pull the latest `main` since this has changed to: ```swift EffectView( NSVisualEffectView.Material.titlebar, blendingMode: NSVisualEffectView.BlendingMode.withinWindow ) ``` and that is the reason the automated tests failed.
// is possible to make a customized Button (which may solve the clicking conflict, // but I am not sure). I will try that in the future. var body: some View { Button(action: switchAction) { content } .buttonStyle(TabBarItemButtonStyle()) .keyboardShortcut( ...
@@ -254,31 +258,29 @@ struct TabBarItem: View { ) .animation(.easeInOut(duration: 0.08), value: isHovering) } else { - if isActive { - EffectView( - // Use `windowBackground` material to fit the material of t...
CodeEdit/TabBar/TabBarItem.swift
26
Swift
0.857
bug
250
51
51
false
Fix Tab Color Issue in Native Style
483
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
lilingxi01
public let hash: String public let commitHash: String public let message: String public let author: String public let authorEmail: String public let commiter: String public let commiterEmail: String public let remoteURL: URL? public let date: Date public var commitBaseURL: URL? ...
make this `private` and add a new line in between row 37 & 38
public let hash: String public let commitHash: String public let message: String public let author: String public let authorEmail: String public let commiter: String public let commiterEmail: String public let remoteURL: URL? public let date: Date public var commitBaseURL: URL? ...
@@ -23,18 +23,29 @@ public struct Commit: Equatable, Hashable, Identifiable { public var commitBaseURL: URL? { if let remoteURL = remoteURL { if remoteURL.absoluteString.contains("github") { - return remoteURL.deletingPathExtension().appendingPathComponent("commit") + ...
CodeEditModules/Modules/GitClient/src/Models/Commit.swift
26
Swift
0.357
suggestion
61
51
51
false
Added support for ssh based origins
516
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
avdept
private var prefs: AppPreferencesModel = .shared var body: some View { HStack(alignment: .center, spacing: 0) { // Tab bar navigation control. // TODO: Real functionality of tab bar navigation control and their stated foreground color. HStack(spacing: 10) { ...
just use `.inactive` since Swift implicitly gets the Type.
private var prefs: AppPreferencesModel = .shared var body: some View { HStack(alignment: .center, spacing: 0) { // Tab bar navigation control. // TODO: Real functionality of tab bar navigation control and their stated foreground color. HStack(spacing: 10) { ...
@@ -47,6 +50,7 @@ struct TabBar: View { .buttonStyle(.plain) } .padding(.horizontal, 11) + .opacity(activeState != ControlActiveState.inactive ? 1.0 : 0.5)
CodeEdit/TabBar/TabBar.swift
26
Swift
0.571
suggestion
58
51
51
false
Fix Inactive Color Issues and Spacing Issues at Tabs and Breadcrumbs
528
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
lilingxi01
: Color(nsColor: .black) .opacity( isPressingClose ? 0.29 : (isHoveringClose ? 0.11 : 0) ) ) ...
just use `.inactive` since Swift implicitly gets the Type.
} } } var body: some View { Button( action: switchAction, label: { content } ) .buttonStyle(TabBarItemButtonStyle()) .background { if prefs.preferences.general.tabBarStyle == .xcode { Color(nsColor: isActive...
@@ -231,6 +236,11 @@ struct TabBarItem: View { } .frame(maxWidth: .infinity, alignment: .leading) } + .opacity( + activeState != ControlActiveState.inactive
CodeEdit/TabBar/TabBarItem.swift
26
Swift
0.571
suggestion
58
51
51
false
Fix Inactive Color Issues and Spacing Issues at Tabs and Breadcrumbs
528
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
lilingxi01
.contentShape(Rectangle()) .onHover { hover in isHovering = hover DispatchQueue.main.async { if hover { NSCursor.arrow.push() } else { NSCursor.pop() } } } } var b...
just use `.inactive` since Swift implicitly gets the Type.
.padding( // This padding is to avoid background color overlapping with top divider. .top, prefs.preferences.general.tabBarStyle == .xcode ? 1 : 0 ) .offset( x: isAppeared || prefs.preferences.general.tabBarStyle == .native ? 0 : -14, y: 0 ...
@@ -279,7 +289,11 @@ struct TabBarItem: View { .background { if prefs.preferences.general.tabBarStyle == .xcode { Color(nsColor: isActive ? .selectedControlColor : .clear) - .opacity(colorScheme == .dark ? 0.70 : 0.50) + .opacity( + ...
CodeEdit/TabBar/TabBarItem.swift
26
Swift
0.571
suggestion
58
51
51
false
Fix Inactive Color Issues and Spacing Issues at Tabs and Breadcrumbs
528
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
lilingxi01
// // File.swift // // // Created by Lukas Pistrol on 24.04.22. // import Foundation public extension Theme { /// Returns a CSS string describing a highlight.js theme that represents the /// theme set in preferences. /// /// Reference for CSS stylable scopes can be found in /// [`highlightjs d...
Maybe change this to the filename
// // Theme+Highlightr.swift // // // Created by Lukas Pistrol on 24.04.22. // import Foundation import CodeEditUtils public extension Theme { /// Returns a CSS string describing a highlight.js theme that represents the /// theme set in preferences. /// /// Reference for CSS stylable scopes can be...
@@ -0,0 +1,73 @@ +// +// File.swift
CodeEditModules/Modules/AppPreferences/src/Sections/ThemePreferences/Model/Theme+Highlightr.swift
2
Swift
0.143
suggestion
34
27
27
false
Editor: Apply Theme Colors
539
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
lukepistrol
// // Created by Gabriel Theodoropoulos on 1/11/20. // import SwiftUI struct PressActions: ViewModifier { var onPress: () -> Void var onRelease: () -> Void func body(content: Content) -> some View { content .simultaneousGesture( DragGesture(minimumDistance: 0) ...
```swift public struct PressActions: ViewModifier { private var onPress: () -> Void private var onRelease: () -> Void public init(onPress: @escaping () -> Void, onRelease: @escaping () -> Void) { self.onPress = onPress self.onRelease = onRelease } ...
// // Created by Gabriel Theodoropoulos on 1/11/20. // import SwiftUI public struct PressActions: ViewModifier { var onPress: () -> Void var onRelease: () -> Void public init(onPress: @escaping () -> Void, onRelease: @escaping () -> Void) { self.onPress = onPress self.onRelease = onR...
@@ -0,0 +1,32 @@ +// +// Created by Gabriel Theodoropoulos on 1/11/20. +// + +import SwiftUI + +struct PressActions: ViewModifier { + var onPress: () -> Void + var onRelease: () -> Void + func body(content: Content) -> some View { + content + .simultaneousGesture( + DragGestur...
CodeEditModules/Modules/CodeEditUI/src/PressActionsModifier.swift
22
Swift
0.857
suggestion
710
33
37
false
Added hover, push, and inactive states for mini tabs.
551
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
austincondiff
// // Created by Gabriel Theodoropoulos on 1/11/20. // import SwiftUI struct PressActions: ViewModifier { var onPress: () -> Void var onRelease: () -> Void func body(content: Content) -> some View { content .simultaneousGesture( DragGesture(minimumDistance: 0) ...
```swift public extension View {} ```
// // Created by Gabriel Theodoropoulos on 1/11/20. // import SwiftUI public struct PressActions: ViewModifier { var onPress: () -> Void var onRelease: () -> Void public init(onPress: @escaping () -> Void, onRelease: @escaping () -> Void) { self.onPress = onPress self.onRelease = onR...
@@ -0,0 +1,32 @@ +// +// Created by Gabriel Theodoropoulos on 1/11/20. +// + +import SwiftUI + +struct PressActions: ViewModifier { + var onPress: () -> Void + var onRelease: () -> Void + func body(content: Content) -> some View { + content + .simultaneousGesture( + DragGestur...
CodeEditModules/Modules/CodeEditUI/src/PressActionsModifier.swift
24
Swift
0.429
suggestion
39
33
37
false
Added hover, push, and inactive states for mini tabs.
551
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
austincondiff
/// Choose between native-styled tab bar and Xcode-liked tab bar. public var tabBarStyle: TabBarStyle = .xcode /// The reopen behavior of the app public var reopenBehavior: ReopenBehavior = .welcome public var projectNavigatorSize: ProjectNavigatorSize = .medium /// Th...
Try using a unified style when breaking up arguments to multiple lines ```swift try container.decodeIfPresent( Type.self, forKey: .key ) ?? .defaultValue ```
/// Choose between native-styled tab bar and Xcode-liked tab bar. public var tabBarStyle: TabBarStyle = .xcode /// The reopen behavior of the app public var reopenBehavior: ReopenBehavior = .welcome public var projectNavigatorSize: ProjectNavigatorSize = .medium /// Th...
@@ -26,20 +35,38 @@ public extension AppPreferences { public var projectNavigatorSize: ProjectNavigatorSize = .medium + /// The Find Navigator Detail line limit + public var findNavigatorDetail: NavigatorDetail = .upTo3 + + /// The Issue Navigator Detail line limit + public var ...
CodeEditModules/Modules/AppPreferences/src/Model/General/GeneralPreferences.swift
26
Swift
0.857
style
173
51
51
false
[WIP] Add missing general preferences
560
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
/// Default initializer public init() {} /// Explicit decoder init for setting default values when key is not present in `JSON` public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.appAppearance = try co...
Try using a unified style when breaking up arguments to multiple lines ```swift try container.decodeIfPresent( Type.self, forKey: .key ) ?? .defaultValue ```
/// Default initializer public init() {} // swiftlint:disable function_body_length /// Explicit decoder init for setting default values when key is not present in `JSON` public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: Coding...
@@ -26,20 +35,38 @@ public extension AppPreferences { public var projectNavigatorSize: ProjectNavigatorSize = .medium + /// The Find Navigator Detail line limit + public var findNavigatorDetail: NavigatorDetail = .upTo3 + + /// The Issue Navigator Detail line limit + public var ...
CodeEditModules/Modules/AppPreferences/src/Model/General/GeneralPreferences.swift
26
Swift
0.857
style
173
51
51
false
[WIP] Add missing general preferences
560
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
public var findNavigatorDetail: NavigatorDetail = .upTo3 /// The Issue Navigator Detail line limit public var issueNavigatorDetail: NavigatorDetail = .upTo3 /// Default initializer public init() {} /// Explicit decoder init for setting default values when key is not pr...
It seems like the line 64 is still not fixed in the new commit.
public var findNavigatorDetail: NavigatorDetail = .upTo3 /// The Issue Navigator Detail line limit public var issueNavigatorDetail: NavigatorDetail = .upTo3 /// Default initializer public init() {} // swiftlint:disable function_body_length /// Explicit decoder ...
@@ -26,20 +35,57 @@ public extension AppPreferences { public var projectNavigatorSize: ProjectNavigatorSize = .medium + /// The Find Navigator Detail line limit + public var findNavigatorDetail: NavigatorDetail = .upTo3 + + /// The Issue Navigator Detail line limit + public var ...
CodeEditModules/Modules/AppPreferences/src/Model/General/GeneralPreferences.swift
26
Swift
0.214
suggestion
63
51
51
false
[WIP] Add missing general preferences
560
CodeEditApp/CodeEdit
18,361
Swift
lilingxi01
drucelweisse
// // SearchBar.swift // CodeEdit // // Created by Ziyuan Zhao on 2022/3/21. // import SwiftUI import CodeEditUI struct FindNavigatorSearchBar: View { @ObservedObject private var state: WorkspaceDocument.SearchState @FocusState private var focusState: Bool private let title: String @Bind...
since this is a `Bool` rename it to something like `isFocused` so that it's clear in which occasion this is `true` or `false`. Example: ```swift .background(focusState ? // <- here it is not clear EffectView(.contentBackground) : EffectView(.underPageBackground, blendingMode: .withinWindow) ) .backgr...
// // SearchBar.swift // CodeEdit // // Created by Ziyuan Zhao on 2022/3/21. // import SwiftUI import CodeEditUI struct FindNavigatorSearchBar: View { @Environment(\.colorScheme) var colorScheme @ObservedObject private var state: WorkspaceDocument.SearchState @FocusState private var isFoc...
@@ -6,11 +6,15 @@ // import SwiftUI +import CodeEditUI struct FindNavigatorSearchBar: View { @ObservedObject private var state: WorkspaceDocument.SearchState + @FocusState + private var focusState: Bool
CodeEdit/NavigatorSidebar/FindNavigator/FindNavigatorSearchBar.swift
16
Swift
0.857
suggestion
728
41
41
false
[WIP] TextField focus effect in FindNavigatorSearchBar
568
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
// // SearchBar.swift // CodeEdit // // Created by Ziyuan Zhao on 2022/3/21. // import SwiftUI import CodeEditUI extension Color { init(hex: Int, opacity: Double = 1.0) { let red = Double((hex & 0xff0000) >> 16) / 255.0 let green = Double((hex & 0xff00) >> 8) / 255.0 let blue = Double((...
Please extend the already available extensions in `CodeEditUtils/Extensions/Color+HEX.swift` to minimize code duplication.
// // SearchBar.swift // CodeEdit // // Created by Ziyuan Zhao on 2022/3/21. // import SwiftUI import CodeEditUI struct FindNavigatorSearchBar: View { @Environment(\.colorScheme) var colorScheme @ObservedObject private var state: WorkspaceDocument.SearchState @FocusState private var isFoc...
@@ -6,16 +6,62 @@ // import SwiftUI +import CodeEditUI + +extension Color { + init(hex: Int, opacity: Double = 1.0) { + let red = Double((hex & 0xff0000) >> 16) / 255.0 + let green = Double((hex & 0xff00) >> 8) / 255.0 + let blue = Double((hex & 0xff) >> 0) / 255.0 + self.init(.sRGB, ...
CodeEdit/NavigatorSidebar/FindNavigator/FindNavigatorSearchBar.swift
18
Swift
0.5
suggestion
122
43
43
false
[WIP] TextField focus effect in FindNavigatorSearchBar
568
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Angelk90
private var state: WorkspaceDocument.SearchState @StateObject private var prefs: AppPreferencesModel = .shared @State private var isExpanded: Bool = true private var fileItem: WorkspaceClient.FileItem private var results: [SearchResultModel] private var jumpToFile: () -> Void init...
Please add a line break for multiple if let statements: ```swift if let lineContent = lineContent, let keywordRange = keywordRange { ... } ```
private var state: WorkspaceDocument.SearchState @StateObject private var prefs: AppPreferencesModel = .shared @State private var isExpanded: Bool = true private var fileItem: WorkspaceClient.FileItem private var results: [SearchResultModel] private var jumpToFile: () -> Void init...
@@ -32,17 +35,15 @@ struct FindNavigatorResultFileItem: View { self.jumpToFile = jumpToFile } + @ViewBuilder private func foundLineResult(_ lineContent: String?, keywordRange: Range<String.Index>?) -> some View { - guard let lineContent = lineContent, let keywordRange = keywordRange ...
CodeEdit/NavigatorSidebar/FindNavigator/FindNavigatorResultFileItem.swift
26
Swift
0.714
suggestion
158
51
51
false
Add Find Navigator Result reflect general preference "Find Navigator Detail"
581
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
PreferencesSection("Issue Navigator Detail") { Picker("Issue Navigator Detail", selection: $prefs.preferences.general.issueNavigatorDetail) { ForEach(AppPreferences.NavigatorDetail.allCases, id: \.self) { tag in Text(tag.label).tag(tag) } ...
Just make this `Finder Context Menu`
PreferencesSection("Issue Navigator Detail") { Picker("Issue Navigator Detail", selection: $prefs.preferences.general.issueNavigatorDetail) { ForEach(AppPreferences.NavigatorDetail.allCases, id: \.self) { tag in Text(tag.label).tag(tag) } ...
@@ -178,4 +191,21 @@ private extension GeneralPreferencesView { } .disabled(true) } + + var openInCodeEditToggle: some View { + PreferencesSection("Finder Contextmenu", hideLabels: false) {
CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift
26
Swift
0.214
suggestion
36
42
42
false
Open in CodeEdit | #559
597
CodeEditApp/CodeEdit
18,361
Swift
nanashili
0xWDG
case .light: NSApp.appearance = .init(named: .aqua) } } } /// The style for issues display /// - **inline**: Issues show inline /// - **minimized** Issues show minimized enum Issues: String, Codable { case inline case minimized }...
I think `ShownFileExtensions` would be more appropriate than `ShowedFileExtensions`
switch self { case .system: NSApp.appearance = nil case .dark: NSApp.appearance = .init(named: .darkAqua) case .light: NSApp.appearance = .init(named: .aqua) } } } /// The style for issues disp...
@@ -127,12 +134,21 @@ public extension AppPreferences { /// The style for file extensions display /// - **hideAll**: File extensions are hidden /// - **showAll** File extensions are visible - /// - **showOnly** Display specified file extensions - enum FileExtensions: String, Codable { + /// ...
CodeEditModules/Modules/AppPreferences/src/Model/General/GeneralPreferences.swift
26
Swift
0.357
suggestion
83
51
51
false
Add ProjectNavigator OutlineTableViewCell to display file extensions
598
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
Text("Show Minimized") .tag(AppPreferences.Issues.minimized) } .labelsHidden() .frame(width: inputWidth) Toggle("Show Live Issues", isOn: $prefs.preferences.general.showLiveIssues) .toggleStyle(.checkbox) } ...
See above mentioned naming suggestion
.tag(AppPreferences.Appearances.dark) } .onChange(of: prefs.preferences.general.appAppearance) { tag in tag.applyAppearance() } .frame(width: inputWidth) } } // TODO: Implement reflecting Show Issues preference and remo...
@@ -85,8 +85,18 @@ private extension GeneralPreferencesView { .tag(AppPreferences.FileExtensions.showOnly) } .frame(width: inputWidth) + if case .showOnly = prefs.preferences.general.fileExtensions { + let showedFileExtensionsBinding = Binding(get...
CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift
26
Swift
0.071
suggestion
37
51
51
false
Add ProjectNavigator OutlineTableViewCell to display file extensions
598
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
.labelsHidden() .frame(width: inputWidth) Toggle("Show Live Issues", isOn: $prefs.preferences.general.showLiveIssues) .toggleStyle(.checkbox) } .disabled(true) } var fileExtensionsSection: some View { PreferencesSection("File Extensio...
It would be better to use the following: ```swift newValue.components(separatedBy: ",").trimmingCharacters(in: .whitespacesAndNewlines) ``` That way we also respect values entered without a space character.
tag.applyAppearance() } .frame(width: inputWidth) } } // TODO: Implement reflecting Show Issues preference and remove disabled modifier var showIssuesSection: some View { PreferencesSection("Show Issues", hideLabels: false) { Picker("Show ...
@@ -85,8 +85,18 @@ private extension GeneralPreferencesView { .tag(AppPreferences.FileExtensions.showOnly) } .frame(width: inputWidth) + if case .showOnly = prefs.preferences.general.fileExtensions { + let showedFileExtensionsBinding = Binding(get...
CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift
26
Swift
0.857
suggestion
212
51
51
false
Add ProjectNavigator OutlineTableViewCell to display file extensions
598
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
enum Issues: String, Codable { case inline case minimized } /// The style for file extensions display /// - **hideAll**: File extensions are hidden /// - **showAll** File extensions are visible /// - **showOnly** Specific file extensions are visible enum FileExtensions: C...
I think the `string` should be computed (get, set) from the array instead of the other way around since the `string` is just a representation of the data.
enum Issues: String, Codable { case inline case minimized } /// The style for file extensions visibility /// - **hideAll**: File extensions are hidden /// - **showAll** File extensions are visible /// - **showOnly** Specific file extensions are visible /// - **hideOnly**...
@@ -139,15 +146,24 @@ public extension AppPreferences { case hideAll case showAll case showOnly + case hideOnly } - /// The collection of displayed file extensions of ``FileExtensions/showOnly`` preference - struct ShowedFileExtensions: Codable, Hashable { - public ...
CodeEditModules/Modules/AppPreferences/src/Model/General/GeneralPreferences.swift
26
Swift
0.571
suggestion
154
51
51
false
Add ProjectNavigator OutlineTableViewCell to display file extensions
598
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
/// A `NSViewController` that handles the **ProjectNavigator** in the **NavigatorSideabr**. /// /// Adds a ``outlineView`` inside a ``scrollView`` which shows the folder structure of the /// currently open project. final class OutlineViewController: NSViewController { typealias Item = WorkspaceClient.FileItem ...
Just a suggestion: maybe rename it to something more descriptive since the property technically isn't a file extension. Maybe something like `fileExtensionVisibility`.
/// A `NSViewController` that handles the **ProjectNavigator** in the **NavigatorSideabr**. /// /// Adds a ``outlineView`` inside a ``scrollView`` which shows the folder structure of the /// currently open project. final class OutlineViewController: NSViewController { typealias Item = WorkspaceClient.FileItem ...
@@ -35,6 +35,9 @@ final class OutlineViewController: NSViewController { var workspace: WorkspaceDocument? var iconColor: AppPreferences.FileIconStyle = .color + var fileExtension: AppPreferences.FileExtensions = .showAll
CodeEdit/NavigatorSidebar/ProjectNavigator/OutlineView/OutlineViewController.swift
26
Swift
0.571
suggestion
170
51
51
false
Add ProjectNavigator OutlineTableViewCell to display file extensions
598
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
drucelweisse
// // File.swift // // // Created by Andrey Plotnikov on 07.05.2022. // import Foundation import SwiftUI public struct SettingsTextEditor: View { @Binding var text: String @State private var isFocus: Bool = false public init(text: Binding<String>) { self._text = text } publi...
This line could be updated. (It is not an issue so this change is not required and I will manually resolve this conversation as a note.)
// // SettingsTextEditor.swift // // // Created by Andrey Plotnikov on 07.05.2022. // import Foundation import SwiftUI public struct SettingsTextEditor: View { @Binding var text: String @State private var isFocus: Bool = false public init(text: Binding<String>) { self._text = text ...
@@ -0,0 +1,82 @@ +// +// File.swift
CodeEditModules/Modules/CodeEditUI/src/SettingsTextEditor.swift
2
Swift
0.429
suggestion
136
27
27
false
Add ProjectNavigator OutlineTableViewCell to display file extensions
598
CodeEditApp/CodeEdit
18,361
Swift
lilingxi01
drucelweisse
// // PanelDivider.swift // // // Created by Austin Condiff on 5/10/22. // import SwiftUI public struct PanelDivider: View { @Environment(\.colorScheme) private var colorScheme public init() {} public var body: some View { Rectangle() .foregroundColor( Color(n...
If used in `HStack` it should probably be `width: 1.0` to be similar to `Divider`. Should we do this now? Any idea how this might be done?
// // PanelDivider.swift // // // Created by Austin Condiff on 5/10/22. // import SwiftUI public struct PanelDivider: View { @Environment(\.colorScheme) private var colorScheme public init() {} public var body: some View { Divider() .opacity(0) .overlay( ...
@@ -0,0 +1,25 @@ +// +// PanelDivider.swift +// +// +// Created by Austin Condiff on 5/10/22. +// + +import SwiftUI + +public struct PanelDivider: View { + @Environment(\.colorScheme) + private var colorScheme + + public init() {} + + public var body: some View { + Rectangle() + .foreg...
CodeEditModules/Modules/CodeEditUI/src/PanelDivider.swift
23
Swift
0.571
question
138
26
25
false
Fixed Statusbar Divider Color
606
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
austincondiff
// // StatusBarTabType.swift // CodeEditModules/StatusBar // // Created by Lukas Pistrol on 11.05.22. // import Foundation /// A collection of types describing possible tabs in the Status Bar. public enum StatusBarTabType: String, CaseIterable, Identifiable { case terminal case debugger case output ...
nit: we can remove the `return` statement
// // StatusBarTabType.swift // CodeEditModules/StatusBar // // Created by Lukas Pistrol on 11.05.22. // import Foundation /// A collection of types describing possible tabs in the Status Bar. public enum StatusBarTabType: String, CaseIterable, Identifiable { case terminal case debugger case output ...
@@ -0,0 +1,20 @@ +// +// StatusBarTabType.swift +// CodeEditModules/StatusBar +// +// Created by Lukas Pistrol on 11.05.22. +// + +import Foundation + +/// A collection of types describing possible tabs in the Status Bar. +public enum StatusBarTabType: String, CaseIterable, Identifiable { + case terminal + cas...
CodeEditModules/Modules/StatusBar/src/Model/StatusBarTabType.swift
16
Swift
0.286
nitpick
41
21
21
false
StatusBar: Cleanup & Tests
608
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
lukepistrol
// // StatusBarTabType.swift // CodeEditModules/StatusBar // // Created by Lukas Pistrol on 11.05.22. // import Foundation /// A collection of types describing possible tabs in the Status Bar. public enum StatusBarTabType: String, CaseIterable, Identifiable { case terminal case debugger case output ...
I think we can write this using keyPaths, should look like: `StatusBarTabType.allCases.map(\.rawValue.capitalized)`
// // StatusBarTabType.swift // CodeEditModules/StatusBar // // Created by Lukas Pistrol on 11.05.22. // import Foundation /// A collection of types describing possible tabs in the Status Bar. public enum StatusBarTabType: String, CaseIterable, Identifiable { case terminal case debugger case output ...
@@ -0,0 +1,20 @@ +// +// StatusBarTabType.swift +// CodeEditModules/StatusBar +// +// Created by Lukas Pistrol on 11.05.22. +// + +import Foundation + +/// A collection of types describing possible tabs in the Status Bar. +public enum StatusBarTabType: String, CaseIterable, Identifiable { + case terminal + cas...
CodeEditModules/Modules/StatusBar/src/Model/StatusBarTabType.swift
18
Swift
0.714
suggestion
117
21
21
false
StatusBar: Cleanup & Tests
608
CodeEditApp/CodeEdit
18,361
Swift
MarcoCarnevali
lukepistrol
guard let openFileItemIdx = selectionState .openFileItems .firstIndex(where: { $0.tabID == id}) else { return } selectionState.openFileItems.remove(at: openFileItemIdx) } private func closeFileTab(item: WorkspaceClient.FileItem) { defer { let file = s...
Please use `guard` instead of force unwrap.
.openFileItems .firstIndex(where: { $0.tabID == id}) else { return } selectionState.openFileItems.remove(at: openFileItemIdx) } private func closeFileTab(item: WorkspaceClient.FileItem) { defer { let file = selectionState.openedCodeFiles.removeValue(forKey: i...
@@ -157,6 +211,18 @@ final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate { selectionState.openedExtensions.remove(at: idx) } + /// Makes the temporary tab permanent when a file save or edit happens. + @objc func editorUpdatedContent() { + if selectionState.selecte...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.286
suggestion
43
51
51
false
Add Temporary Tab
620
CodeEditApp/CodeEdit
18,361
Swift
lilingxi01
thecoolwinter
context.coordinator.controller = controller return controller } func updateNSViewController(_ nsViewController: OutlineViewController, context: Context) { nsViewController.iconColor = prefs.preferences.general.fileIconStyle nsViewController.rowHeight = rowHeight nsView...
Move `sink` to new line for better readability. ```swift listener = workspace.listenerModel.$highlightedFileItem .sink(receiveValue: { [weak self] fileItem in … }) ```
context.coordinator.controller = controller return controller } func updateNSViewController(_ nsViewController: OutlineViewController, context: Context) { nsViewController.iconColor = prefs.preferences.general.fileIconStyle nsViewController.rowHeight = rowHeight nsView...
@@ -38,6 +41,32 @@ struct OutlineView: NSViewControllerRepresentable { return } + func makeCoordinator() -> Coordinator { + return Coordinator(workspace) + } + + class Coordinator: NSObject { + init(_ workspace: WorkspaceDocument) { + self.workspace = workspace + ...
CodeEdit/NavigatorSidebar/ProjectNavigator/OutlineView/OutlineView.swift
26
Swift
0.786
suggestion
191
51
51
false
Add Tab right-click Actions
648
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
thecoolwinter
dismissWindow: { windowController.window?.close() } ) window.titlebarAppearsTransparent = true window.isMovableByWindowBackground = true window.contentView = NSHostingView(rootView: contentView) window.makeKeyAndOrderFront(self) } ...
Please add documentation to newly added methods.
dismissWindow: { windowController.window?.close() } ) window.titlebarAppearsTransparent = true window.isMovableByWindowBackground = true window.contentView = NSHostingView(rootView: contentView) window.makeKeyAndOrderFront(self) } ...
@@ -170,13 +165,25 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { } @IBAction func openAbout(_ sender: Any) { + if tryFocusWindow(of: AboutView.self) { return } + AboutView().showWindow(width: 530, height: 220) } @IBAction func openFeedback(_ send...
CodeEdit/AppDelegate.swift
26
Swift
0.071
suggestion
48
51
51
false
Fix: `About` and `Feedback` windows opens only if aren't already
650
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nrudnyk
dismissWindow: { windowController.window?.close() } ) window.titlebarAppearsTransparent = true window.isMovableByWindowBackground = true window.contentView = NSHostingView(rootView: contentView) window.makeKeyAndOrderFront(self) } ...
note that double back-ticks are used to reference properties, methods, types,… for inline code use single back-ticks.
dismissWindow: { windowController.window?.close() } ) window.titlebarAppearsTransparent = true window.isMovableByWindowBackground = true window.contentView = NSHostingView(rootView: contentView) window.makeKeyAndOrderFront(self) } ...
@@ -176,6 +176,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { FeedbackView().showWindow() } + + /// Tries to focus a window with specified view content type. + /// - Parameter type: The type of viewContent which hosted in a window to be focused. + /// - Retur...
CodeEdit/AppDelegate.swift
26
Swift
0.571
suggestion
117
51
51
false
Fix: `About` and `Feedback` windows opens only if aren't already
650
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nrudnyk
newDocument: { CodeEditDocumentController.shared.newDocument(nil) }, dismissWindow: { windowController.window?.close() } ) window.titlebarAppearsTransparent = true window.isMovableByWindowBackground = true wi...
fix SwiftLint `vertical_whitespace` error
newDocument: { CodeEditDocumentController.shared.newDocument(nil) }, dismissWindow: { windowController.window?.close() } ) window.titlebarAppearsTransparent = true window.isMovableByWindowBackground = true wi...
@@ -170,13 +165,29 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { } @IBAction func openAbout(_ sender: Any) { + if tryFocusWindow(of: AboutView.self) { return } + AboutView().showWindow(width: 530, height: 220) } @IBAction func openFeedback(_ send...
CodeEdit/AppDelegate.swift
26
Swift
0.357
nitpick
41
51
51
false
Fix: `About` and `Feedback` windows opens only if aren't already
650
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
nrudnyk
let fileItems = try loadFiles(fromURL: folderURL) // workspace fileItem let workspaceItem = FileItem(url: folderURL, children: fileItems) flattenedFileItems[workspaceItem.id] = workspaceItem fileItems.forEach { item in item.parent = workspaceItem } //...
Does this filter filter anything right now?
// initial load let fileItems = try loadFiles(fromURL: folderURL) // workspace fileItem let workspaceItem = FileItem(url: folderURL, children: fileItems) flattenedFileItems[workspaceItem.id] = workspaceItem fileItems.forEach { item in item.parent = workspaceI...
@@ -54,41 +58,141 @@ public extension WorkspaceClient { fileItems.forEach { item in item.parent = workspaceItem } - // By using `CurrentValueSubject` we can define a starting value. + + // By using `CurrentValueSubject` we can define a starting value. // The value p...
CodeEditModules/Modules/WorkspaceClient/src/Live.swift
26
Swift
0.071
question
43
51
51
false
Implement Delete, Create File, Create Folder for the right click menu in ProjectNavigator
655
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
KaiTheRedNinja
newFileItem.parent = fileItem flattenedFileItems[newFileItem.id] = newFileItem newChildren?.append(newFileItem) } } newChildren?.forEach({ try? rebuildFiles(fromItem: $0) flattenedFileIte...
Since you are not throwing any errors, i think you can better chain this guard. ```swift guard item.isFolder, !sources.keys.contains(item.id), FileItem.fileManger.fileExists(atPath: item.url.path) else { continue } ```
fileItem.children?.append(newFileItem) didChangeSomething = true } } fileItem.children?.forEach({ if $0.isFolder { let childChanged = try? rebuildFiles(fromItem: $0) didChangeSomethin...
@@ -54,41 +58,141 @@ public extension WorkspaceClient { fileItems.forEach { item in item.parent = workspaceItem } - // By using `CurrentValueSubject` we can define a starting value. + + // By using `CurrentValueSubject` we can define a starting value. // The value p...
CodeEditModules/Modules/WorkspaceClient/src/Live.swift
26
Swift
1
suggestion
247
51
51
false
Implement Delete, Create File, Create Folder for the right click menu in ProjectNavigator
655
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
KaiTheRedNinja
HStack(spacing: 10) { addNewFileButton Spacer() sortButton } .frame(height: 29, alignment: .center) .frame(maxWidth: .infinity) .padding(.horizontal, 4) .overlay(alignment: .top) { Divider() } } private var ...
I guess this can be deleted now
HStack(spacing: 10) { addNewFileButton Spacer() sortButton } .frame(height: 29, alignment: .center) .frame(maxWidth: .infinity) .padding(.horizontal, 4) .overlay(alignment: .top) { Divider() } } private var ...
@@ -34,8 +34,16 @@ struct NavigatorSidebarToolbarBottom: View { private var addNewFileButton: some View { Menu { - Button("Add File") {} - .disabled(true) + Button("Add File") { + guard let folderURL = workspace.workspaceClient?.folderURL() else { retu...
CodeEdit/NavigatorSidebar/NavigatorSidebarToolbarBottom.swift
26
Swift
0.071
suggestion
31
51
50
false
Implement Delete, Create File, Create Folder for the right click menu in ProjectNavigator
655
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
KaiTheRedNinja
var body: some View { HStack(spacing: 10) { addNewFileButton Spacer() sortButton } .frame(height: 29, alignment: .center) .frame(maxWidth: .infinity) .padding(.horizontal, 4) .overlay(alignment: .top) { Divider() ...
Crashes on projects located on Desktop sometimes. > Thread 1: EXC_BAD_ACCESS (code=1, address=0x3ff0000000000008)
var body: some View { HStack(spacing: 10) { addNewFileButton Spacer() sortButton } .frame(height: 29, alignment: .center) .frame(maxWidth: .infinity) .padding(.horizontal, 4) .overlay(alignment: .top) { Divider() ...
@@ -34,8 +34,16 @@ struct NavigatorSidebarToolbarBottom: View { private var addNewFileButton: some View { Menu { - Button("Add File") {} - .disabled(true) + Button("Add File") { + guard let folderURL = workspace.workspaceClient?.folderURL() else { retu...
CodeEdit/NavigatorSidebar/NavigatorSidebarToolbarBottom.swift
26
Swift
0.5
bug
116
51
51
false
Implement Delete, Create File, Create Folder for the right click menu in ProjectNavigator
655
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
KaiTheRedNinja
/// Action that opens **Finder** at the items location. @objc private func showInFinder() { item?.showInFinder() } /// Action that opens the item, identical to clicking it. @objc private func openInTab() { if let item = item { workspace?.openTab(item: item) ...
If a file already exists it will crash with: > Thread 1: Fatal error: Duplicate keys of type 'FileItem' were found in a Dictionary.
/// Action that opens **Finder** at the items location. @objc private func showInFinder() { item?.showInFinder() } /// Action that opens the item, identical to clicking it. @objc private func openInTab() { if let item = item { workspace?.openTab(item: item) ...
@@ -169,11 +177,45 @@ final class OutlineMenu: NSMenu { item?.showInFinder() } + /// Action that opens the item, identical to clicking it. + @objc + private func openInTab() { + if let item = item { + workspace?.openTab(item: item) + } + } + + /// Action that open...
CodeEdit/NavigatorSidebar/ProjectNavigator/OutlineView/OutlineMenu.swift
26
Swift
0.5
bug
134
51
51
false
Implement Delete, Create File, Create Folder for the right click menu in ProjectNavigator
655
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
KaiTheRedNinja
self.fileItems.remove(at: index) } else { self.fileItems.append(newFile) } } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared...
Use `guard let` so force-unwrapping is not needed: ```swift guard let path = fileURL?.path, let pathData = path.data(using: .utf8) else { return } ```
} } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared?.load { extensionID in return CodeEditAPI(extensionId: extensionID, workspace: self) } } catch let error...
@@ -340,27 +330,20 @@ import TabBar // MARK: Close Workspace + private func saveSelectionState() throws { + guard fileURL != nil else { return } + guard fileURL!.path != "" else { return } + let path = fileURL!.path.data(using: .utf8)
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.786
suggestion
162
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
) self.addWindowController(windowController) } // MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirec...
Perhaps something like this is better to use? ```swift guard let fileData = fileURL?.path?.data(using: .utf8) else { return selectionState } ```
} // MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) ...
@@ -267,37 +268,26 @@ import TabBar object: nil) } + private func readSelectionState() throws -> WorkspaceSelectionState { + guard fileURL != nil else { return selectionState } + guard fileURL!.path != "" else { return selectionState } + let...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.786
suggestion
153
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
Debdut
// // WorkspaceDocument.swift // CodeEdit // // Created by Pavel Kasila on 17.03.22. // import Foundation import AppKit import SwiftUI import WorkspaceClient import Combine import CodeFile import Search import QuickOpen import CodeEditKit import ExtensionsStore import StatusBar import TabBar import CryptoKit // sw...
Please remove this line, it's not needed any linger.
// // WorkspaceDocument.swift // CodeEdit // // Created by Pavel Kasila on 17.03.22. // import Foundation import AppKit import SwiftUI import WorkspaceClient import Combine import CodeFile import Search import QuickOpen import CodeEditKit import ExtensionsStore import StatusBar import TabBar @objc(WorkspaceDocumen...
@@ -17,6 +17,7 @@ import CodeEditKit import ExtensionsStore import StatusBar import TabBar +import CryptoKit // swiftlint:disable:next type_body_length
CodeEdit/Documents/WorkspaceDocument.swift
22
Swift
0.286
refactor
52
47
47
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
Debdut
) self.addWindowController(windowController) } // MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirec...
Use `guard let` so force-unwrapping is not needed: ```swift guard let path = fileURL?.path, let pathData = path.data(using: .utf8) else { return } ```
} // MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) ...
@@ -267,37 +268,26 @@ import TabBar object: nil) } + private func readSelectionState() throws -> WorkspaceSelectionState { + guard fileURL != nil else { return selectionState } + guard fileURL!.path != "" else { return selectionState } + let...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.786
suggestion
162
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
self.fileItems.remove(at: index) } else { self.fileItems.append(newFile) } } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared...
Perhaps something like this is cleaner to use ```swift guard let fileData = fileURL?.path?.data(using: .utf8) else { return selectionState } ```
} } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared?.load { extensionID in return CodeEditAPI(extensionId: extensionID, workspace: self) } } catch let error...
@@ -340,27 +330,20 @@ import TabBar // MARK: Close Workspace + private func saveSelectionState() throws { + guard fileURL != nil else { return } + guard fileURL!.path != "" else { return } + let path = fileURL!.path.data(using: .utf8)
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.786
suggestion
153
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
Debdut
// MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) self.q...
Don't force-unwrap: ```swift if let state = state { return state } ```
private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) self.quickOpenState = .init(fileURL: ...
@@ -267,37 +268,26 @@ import TabBar object: nil) } + private func readSelectionState() throws -> WorkspaceSelectionState { + guard fileURL != nil else { return selectionState } + guard fileURL!.path != "" else { return selectionState } + let...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.571
suggestion
81
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
self.fileItems.append(newFile) } } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared?.load { extensionID in return CodeEditAPI(extensionId: extensionID, w...
since this method `throws` you can use `try` here instead of `try?`
} .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared?.load { extensionID in return CodeEditAPI(extensionId: extensionID, workspace: self) } } catch let error { Swift.print(error) ...
@@ -340,27 +330,20 @@ import TabBar // MARK: Close Workspace + private func saveSelectionState() throws { + guard fileURL != nil else { return } + guard fileURL!.path != "" else { return } + let path = fileURL!.path.data(using: .utf8) + let hash = String(CryptoKit.SHA256.hash(dat...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.429
suggestion
68
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
// MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) self....
This function throws so you can use `try` instead of `try?`
private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) self.quickOpenState = .init(fileURL:...
@@ -267,37 +268,26 @@ import TabBar object: nil) } + private func readSelectionState() throws -> WorkspaceSelectionState { + guard fileURL != nil else { return selectionState } + guard fileURL!.path != "" else { return selectionState } + let...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.429
suggestion
59
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
) self.addWindowController(windowController) } // MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirec...
`.hashValue` will not be equal across executions of the program ([source](https://developer.apple.com/documentation/swift/string/hashvalue)). Consider implementing it something like that: ```swift let stringData = "Hello World".data(using: .utf8)! let hash = SHA256.hash(data: stringData) let hashString = h...
self.addWindowController(windowController) } // MARK: Set Up Workspace private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ...
@@ -267,37 +267,25 @@ import TabBar object: nil) } + private func readSelectionState() throws -> WorkspaceSelectionState { + guard let path = fileURL?.path, + let pathData = path.data(using: .utf8) else { return selectionState } + let ...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.857
suggestion
379
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
self.fileItems.remove(at: index) } else { self.fileItems.append(newFile) } } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared...
`.hashValue` will not be equal across executions of the program ([source](https://developer.apple.com/documentation/swift/string/hashvalue)). Consider implementing it something like that: ```swift let stringData = "Hello World".data(using: .utf8)! let hash = SHA256.hash(data: stringData) let hashString = h...
} else { self.fileItems.append(newFile) } } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared?.load { extensionID in return CodeEditAP...
@@ -340,27 +328,19 @@ import TabBar // MARK: Close Workspace + private func saveSelectionState() throws { + guard let path = fileURL?.path, + let pathData = path.data(using: .utf8) else { return } + let hash = String(CryptoKit.SHA256.hash(data: pathData).hashValue)
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.857
suggestion
379
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
} super.close() } } // MARK: - Extensions extension WorkspaceDocument { func target(didAdd target: Target) { self.targets.append(target) } func target(didRemove target: Target) { self.targets.removeAll { $0.id == target.id } } func targetDidClear() { sel...
Probably better to move that to the Extensions folder. File could be called `String+SHA256.swift` Also make sure to add a documentation block.
// // WorkspaceDocument.swift // CodeEdit // // Created by Pavel Kasila on 17.03.22. // import Foundation import AppKit import SwiftUI import WorkspaceClient import Combine import CodeFile import Search import QuickOpen import CodeEditKit import ExtensionsStore import StatusBar import TabBar @objc(WorkspaceDocumen...
@@ -372,3 +372,11 @@ extension WorkspaceDocument { self.targets.removeAll() } } + +extension String { + var sha256Hash: String? { + guard let data = self.data(using: .utf8) else { return nil } + let hash = SHA256.hash(data: data) + return hash.compactMap { String(format: "%02x", $...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.571
suggestion
145
27
375
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
if let index = self.fileItems.firstIndex(of: newFile) { self.fileItems.remove(at: index) } else { self.fileItems.append(newFile) } } } .store(in: &cancellables) //...
this can be combined: ```swift guard let path = fileURL?.path, let hash = path.sha256Hash else { return } ```
self.fileItems.remove(at: index) } else { self.fileItems.append(newFile) } } } .store(in: &cancellables) // initialize extensions do { try ExtensionsManager.shared...
@@ -329,11 +329,11 @@ import CryptoKit // MARK: Close Workspace private func saveSelectionState() throws { - guard let path = fileURL?.path, - let pathData = path.data(using: .utf8) else { return } - let hash = String(CryptoKit.SHA256.hash(data: pathData).hashValue) - let d...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.714
suggestion
121
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) self.quickOpenState = .init(fileURL:...
combine `if let` statements with `guard let` statement for cleaner code (see other comment).
private func initWorkspaceState(_ url: URL) throws { self.workspaceClient = try .default( fileManager: .default, folderURL: url, ignoredFilesAndFolders: ignoredFilesAndDirectory ) self.searchState = .init(self) self.quickOpenState = .init(fileURL: ...
@@ -268,12 +268,12 @@ import CryptoKit } private func readSelectionState() throws -> WorkspaceSelectionState { - guard let path = fileURL?.path, - let pathData = path.data(using: .utf8) else { return selectionState } - let hash = String(CryptoKit.SHA256.hash(data: pathData).hashVa...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.357
suggestion
92
51
51
false
Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513
656
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Debdut
// CodeEdit // // Created by Nanashi Li on 2022/04/18. // import Foundation import Git public final class HistoryInspectorModel: ObservableObject { /// A GitClient instance private(set) var gitClient: GitClient /// The base URL of the workspace private(set) var workspaceURL: URL /// The base ...
Please remove vertical whitespace
// CodeEdit // // Created by Nanashi Li on 2022/04/18. // import Foundation import Git public final class HistoryInspectorModel: ObservableObject { /// A GitClient instance private(set) var gitClient: GitClient /// The base URL of the workspace private(set) var workspaceURL: URL /// The base ...
@@ -25,7 +25,7 @@ public final class HistoryInspectorModel: ObservableObject { /// Initialize with a GitClient /// - Parameter workspaceURL: the current workspace URL - /// +
CodeEdit/InspectorSidebar/Models/HistoryInspectorModel.swift
26
Swift
0.143
nitpick
33
42
42
false
Improving comments
664
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
itsliamdowd
} } } func contextMenuDelete(projectPath: String) -> some View { Group { Button(NSLocalizedString("Remove from Recent Projects", bundle: .module, comment: "")) { deleteFromRecent(item: projectPath) } } } func deleteFromRecent(...
Shouldn't we also be removing the path entry from `UserDefaults` as well?
} } } func contextMenuDelete(projectPath: String) -> some View { Group { Button(NSLocalizedString("Remove from Recent Projects", bundle: .module, comment: "")) { deleteFromRecent(item: projectPath) } } } func deleteFromRecent(...
@@ -74,9 +74,10 @@ public struct RecentProjectsView: View { ) } - /// Update recent projects. + /// Update recent projects, and remove ones that no longer exist func updateRecentProjects() { - recentProjectPaths = UserDefaults.standard.array(forKey: "recentProjectPaths") as? [String] ?...
CodeEditModules/Modules/WelcomeModule/src/RecentProjectsView.swift
26
Swift
0.429
question
73
51
51
false
Deleted projects are now automatically removed from recent project view
668
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
KaiTheRedNinja
// // SidebarSearch.swift // CodeEdit // // Created by Ziyuan Zhao on 2022/3/20. // import SwiftUI import WorkspaceClient import Search struct FindNavigator: View { @ObservedObject private var state: WorkspaceDocument.SearchState @State private var searchText: String = "" @State var filters: ...
Could we replace this array with an enum? Using an array like this feels breakable, especially with only two possible values.
// // SidebarSearch.swift // CodeEdit // // Created by Ziyuan Zhao on 2022/3/20. // import SwiftUI import WorkspaceClient import Search struct FindNavigator: View { @ObservedObject private var state: WorkspaceDocument.SearchState @State private var searchText: String = "" enum Filters: String...
@@ -16,6 +16,10 @@ struct FindNavigator: View { @State private var searchText: String = "" + @State var filters: [String] = ["Ignoring Case", "Matching Case"]
CodeEdit/NavigatorSidebar/FindNavigator/FindNavigator.swift
19
Swift
0.429
suggestion
125
44
44
false
Find navigator improvements
678
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
KaiTheRedNinja
init(state: WorkspaceDocument.SearchState) { self.state = state } var body: some View { VStack { VStack { FindNavigatorModeSelector(state: state) FindNavigatorSearchBar(state: state, title: "", text: $searchText) HStack { ...
I think this is supposed to be `state.ignoreCase = false`.
state.searchResult.filter { $0.hasKeywordInfo }.count } init(state: WorkspaceDocument.SearchState) { self.state = state } var body: some View { VStack { VStack { FindNavigatorModeSelector(state: state) FindNavigatorSearchBar(state: st...
@@ -31,10 +35,45 @@ struct FindNavigator: View { var body: some View { VStack { VStack { - FindNavigatorModeSelector() + FindNavigatorModeSelector(state: state) FindNavigatorSearchBar(state: state, title: "", text: $searchText) H...
CodeEdit/NavigatorSidebar/FindNavigator/FindNavigator.swift
26
Swift
0.357
suggestion
58
51
51
false
Find navigator improvements
678
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
KaiTheRedNinja
ZStack { if let item = workspace.selectionState.openFileItems.first(where: { file in if file.tabID == workspace.selectionState.selectedId { print("Item loaded is: ", file.url) } return file.tabID == workspace.selectionState.selected...
I like how you split this code into methods! However, I think the `@ViewBuilder` wrapper before each method is unnecessary. If you always return only one view like `VStack` or `CodeFileView` - even with some modifiers - this wrapper is superfluous. If you are up to you can remove all of them from your methods. ```sug...
ZStack { if let item = workspace.selectionState.openFileItems.first(where: { file in if file.tabID == workspace.selectionState.selectedId { print("Item loaded is: ", file.url) } return file.tabID == workspace.selectionState.selected...
@@ -30,26 +31,65 @@ struct WorkspaceCodeFileView: View { } return file.tabID == workspace.selectionState.selectedId }) { - if let codeFile = workspace.selectionState.openedCodeFiles[item] { - CodeFileView(codeFile: codeFile) - ...
CodeEdit/Documents/WorkspaceCodeFileView.swift
26
Swift
0.857
refactor
332
51
51
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
case UTType.text: codeFileView(fileItem, for: item) default: otherFileView(fileItem, for: item) } } } else { Text("No Editor") .font(.system(size: 1...
I noticed that in the other two methods, instead of `.safeAreaInset(edge:)`, you used only `VStack`. I believe this also should work correctly here. @wdg @pkasila @lilingxi01 @lukepistrol @StefKors @austincondiff, does anyone know why someone decided to use `.safeAreaInset(edge:)` instead of code like this: ``` VStac...
otherFileView(fileItem, for: item) } } } else { Text("No Editor") .font(.system(size: 17)) .foregroundColor(.secondary) .frame(minHeight: 0) .clipped() ...
@@ -30,26 +31,65 @@ struct WorkspaceCodeFileView: View { } return file.tabID == workspace.selectionState.selectedId }) { - if let codeFile = workspace.selectionState.openedCodeFiles[item] { - CodeFileView(codeFile: codeFile) - ...
CodeEdit/Documents/WorkspaceCodeFileView.swift
26
Swift
0.857
suggestion
533
51
51
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
*/ public var typeOfFile: UTType? { if !self.content.isEmpty { return UTType.text } guard let fileType = fileType, let type = UTType(filenameExtension: fileType) else { return nil } if type.conforms(to: UTType.image) { return UTType.ima...
I believe that `URL(string: "")` will return `nil`, so force unwrapping in line 57 will produce a crash. I would suggest changing the `URL` type of this property to `URL?`. ```suggestion public var previewItemURL: URL? { fileURL } ``` After this change, probably `OtherFileView` also will require ...
return UTType.text } guard let fileType = fileType, let type = UTType(filenameExtension: fileType) else { return nil } if type.conforms(to: UTType.image) { return UTType.image } if type.conforms(to: UTType.text) { return UTT...
@@ -8,17 +8,57 @@ import AppKit import Foundation import SwiftUI +import UniformTypeIdentifiers +import QuickLookUI public enum CodeFileError: Error { case failedToDecode case failedToEncode + case fileTypeError } @objc(CodeFileDocument) -public final class CodeFileDocument: NSDocument, Observabl...
CodeEditModules/Modules/CodeFile/src/CodeFile.swift
26
Swift
1
bug
1,158
51
51
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
// CodeFile.swift // CodeEditModules/CodeFile // // Created by Rehatbir Singh on 12/03/2022. // import AppKit import Foundation import SwiftUI import UniformTypeIdentifiers import QuickLookUI public enum CodeFileError: Error { case failedToDecode case failedToEncode case fileTypeError } @objc(CodeFile...
I wonder about these two properties. Am I correct that both of them should not be set simultaneously? I can think only about the scenario where one is set, and the other is not. If my thinking is correct, we can consider merging them into one property. It can be achieved using `enum`, something like this: ``` enum C...
// CodeFile.swift // CodeEditModules/CodeFile // // Created by Rehatbir Singh on 12/03/2022. // import AppKit import Foundation import SwiftUI import UniformTypeIdentifiers import QuickLookUI public enum CodeFileError: Error { case failedToDecode case failedToEncode case fileTypeError } @objc(CodeFile...
@@ -8,17 +8,57 @@ import AppKit import Foundation import SwiftUI +import UniformTypeIdentifiers +import QuickLookUI public enum CodeFileError: Error { case failedToDecode case failedToEncode + case fileTypeError } @objc(CodeFileDocument) -public final class CodeFileDocument: NSDocument, Observabl...
CodeEditModules/Modules/CodeFile/src/CodeFile.swift
26
Swift
1
suggestion
624
51
51
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
*/ public var previewItemURL: URL { guard let fileURL = self.fileURL else { return URL(string: "")! } return fileURL } // MARK: - NSDocument override public class var autosavesInPlace: Bool { true } override public func makeWindowControllers() ...
If `image` is set instead of `content`, should we not return data of the image here?
} // MARK: - NSDocument override public class var autosavesInPlace: Bool { true } override public func makeWindowControllers() { // Returns the Storyboard that contains your Document window. let contentView = CodeFileView(codeFile: self) let window = NSWindow( ...
@@ -44,8 +84,24 @@ public final class CodeFileDocument: NSDocument, ObservableObject { return data }
CodeEditModules/Modules/CodeFile/src/CodeFile.swift
26
Swift
0.429
question
84
51
35
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
} override public func data(ofType _: String) throws -> Data { guard let data = content.data(using: .utf8) else { throw CodeFileError.failedToEncode } return data } /// This fuction is used for decoding files. /// It should not throw error as unsupported files can still be opened b...
I noticed that for `self.typeOfFile` is nil, `typeOfFile` is `.text` and `typeOfFile` is `default` cases you have the same logic. Maybe it would be a good idea to simplify it? You can use `switch` to do this: ```suggestion switch typeOfFile { case .some(.image): guard let image = NSImage...
// // CodeFile.swift // CodeEditModules/CodeFile // // Created by Rehatbir Singh on 12/03/2022. // import AppKit import Foundation import SwiftUI import UniformTypeIdentifiers import QuickLookUI public enum CodeFileError: Error { case failedToDecode case failedToEncode case fileTypeError } @objc(CodeF...
@@ -44,8 +84,24 @@ public final class CodeFileDocument: NSDocument, ObservableObject { return data } + /// This fuction is used for decoding files. + /// It should not throw error as unsupported files can still be opened by QLPreviewView. override public func read(from data: Data, ofType _: S...
CodeEditModules/Modules/CodeFile/src/CodeFile.swift
26
Swift
1
refactor
1,293
29
88
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
// // ImageFileView.swift // CodeEditModules/CodeFile // // Created by Nanashi Li on 2022/04/16. // import SwiftUI public struct ImageFileView: View { @ObservedObject private var imageFile: CodeFileDocument public init(imageFile: CodeFileDocument) { self.imageFile = imageFile } publi...
I wonder why this property is marked as `ObservedObject`? I can't find any reason for that 🤔
// // ImageFileView.swift // CodeEditModules/CodeFile // // Created by Nanashi Li on 2022/04/16. // import SwiftUI public struct ImageFileView: View { private let image: NSImage? public init(image: NSImage?) { self.image = image } public var body: some View { GeometryReader { pro...
@@ -7,31 +7,33 @@ import SwiftUI -struct ImageFileView: View { - var body: some View { - Image("") - .resizable() - .frame(maxWidth: .infinity, maxHeight: .infinity) - } - - func loadImageFromDiskWith(fileName: String) -> NSImage? { - - let documentDirectory = FileManag...
CodeEditModules/Modules/CodeFile/src/Image/ImageFileView.swift
13
Swift
0.357
suggestion
92
38
35
false
Fix open unsupported Documents, support for open image files
679
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
shibotong
} FileItem.watcherCode = { // Something has changed inside the directory // We should reload the files. guard !isRunning else { // this runs when a file change is detected but is already running anotherInstanceRan += 1 return ...
If this method is empty and generally does nothing, may we remove it?
} FileItem.watcherCode = { // Something has changed inside the directory // We should reload the files. guard !isRunning else { // this runs when a file change is detected but is already running anotherInstanceRan += 1 return ...
@@ -128,78 +126,38 @@ public extension WorkspaceClient { return didChangeSomething } - var sources: [String: DispatchSourceFileSystemObject] = [:] - - /// Function to apply listeners that rebuild the file index when the file system is changed. - /// Optimised so that it only...
CodeEditModules/Modules/WorkspaceClient/src/Live.swift
26
Swift
0.286
question
70
51
51
false
Project sidebar loading optimisation
686
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
KaiTheRedNinja
) } } extension URL { var attributes: [FileAttributeKey: Any]? { do { return try FileManager.default.attributesOfItem(atPath: path) } catch let error as NSError { print("FileAttribute error: \(error)") } return nil } var fileSize: UInt64 ...
It seems to me that this code isn't used anywhere. Are we sure we need to add it in this PR?
// // Live.swift // CodeEditModules/WorkspaceClient // // Created by Marco Carnevali on 16/03/22. // import Combine import Foundation // TODO: DOCS (Marco Carnevali) // swiftlint:disable missing_docs public extension WorkspaceClient { // swiftlint:disable:next function_body_length static func `default`( ...
@@ -222,3 +180,26 @@ public extension WorkspaceClient { ) } } + +extension URL { + var attributes: [FileAttributeKey: Any]? { + do { + return try FileManager.default.attributesOfItem(atPath: path) + } catch let error as NSError { + print("FileAttribute error: \(erro...
CodeEditModules/Modules/WorkspaceClient/src/Live.swift
26
Swift
0.286
question
92
27
177
false
Project sidebar loading optimisation
686
CodeEditApp/CodeEdit
18,361
Swift
Matejkob
KaiTheRedNinja
deleteConfirmation.addButton(withTitle: "Delete") deleteConfirmation.buttons.last?.hasDestructiveAction = true deleteConfirmation.addButton(withTitle: "Cancel") if deleteConfirmation.runModal() == .alertFirstButtonReturn { // "Delete" button if FileItem.fi...
if `fileextension` is empty then this would produce an additional `.`
deleteConfirmation.addButton(withTitle: "Delete") deleteConfirmation.buttons.last?.hasDestructiveAction = true deleteConfirmation.addButton(withTitle: "Cancel") if deleteConfirmation.runModal() == .alertFirstButtonReturn { // "Delete" button if FileItem.fi...
@@ -257,7 +257,12 @@ public extension WorkspaceClient { var fileUrl = self.url while FileItem.fileManger.fileExists(atPath: fileUrl.path) { let previousName = fileUrl.lastPathComponent - fileUrl = fileUrl.deletingLastPathComponent().appendingPathComponent("\(pre...
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.357
suggestion
69
51
51
false
Add duplicate file functionality
736
CodeEditApp/CodeEdit
18,361
Swift
muescha
Muhammed9991
let deleteConfirmation = NSAlert() let message = "\(self.fileName)\(self.isFolder ? " and its children" :"")" deleteConfirmation.messageText = "Are you sure you want to move \(message) to the Trash?" deleteConfirmation.alertStyle = .critical deleteConfirmatio...
`deletingPathExtension()` (note: an method) is also available at `URL` so i would avoid the additional casting to ~NSString
let deleteConfirmation = NSAlert() let message = "\(self.fileName)\(self.isFolder ? " and its children" :"")" deleteConfirmation.messageText = "Are you sure you want to move \(message) to the Trash?" deleteConfirmation.alertStyle = .critical deleteConfirmatio...
@@ -257,7 +257,12 @@ public extension WorkspaceClient { var fileUrl = self.url while FileItem.fileManger.fileExists(atPath: fileUrl.path) { let previousName = fileUrl.lastPathComponent - fileUrl = fileUrl.deletingLastPathComponent().appendingPathComponent("\(pre...
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.714
suggestion
123
51
51
false
Add duplicate file functionality
736
CodeEditApp/CodeEdit
18,361
Swift
muescha
Muhammed9991
deleteConfirmation.buttons.last?.hasDestructiveAction = true deleteConfirmation.addButton(withTitle: "Cancel") if deleteConfirmation.runModal() == .alertFirstButtonReturn { // "Delete" button if FileItem.fileManger.fileExists(atPath: self.url.path) { ...
```suggestion fileUrl.appendPathExtension(filextension) ```
deleteConfirmation.buttons.last?.hasDestructiveAction = true deleteConfirmation.addButton(withTitle: "Cancel") if deleteConfirmation.runModal() == .alertFirstButtonReturn { // "Delete" button if FileItem.fileManger.fileExists(atPath: self.url.path) { ...
@@ -257,7 +257,13 @@ public extension WorkspaceClient { var fileUrl = self.url while FileItem.fileManger.fileExists(atPath: fileUrl.path) { let previousName = fileUrl.lastPathComponent - fileUrl = fileUrl.deletingLastPathComponent().appendingPathComponent("\(pre...
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.571
suggestion
77
51
51
false
Add duplicate file functionality
736
CodeEditApp/CodeEdit
18,361
Swift
muescha
Muhammed9991
deleteConfirmation.messageText = "Are you sure you want to move \(message) to the Trash?" deleteConfirmation.alertStyle = .critical deleteConfirmation.addButton(withTitle: "Delete") deleteConfirmation.buttons.last?.hasDestructiveAction = true deleteConfirmatio...
somehow this makes no sense in this place previousName and previousNameWithoutExtension should be the same at this point if fileextension is empty
deleteConfirmation.messageText = "Are you sure you want to move \(message) to the Trash?" deleteConfirmation.alertStyle = .critical deleteConfirmation.addButton(withTitle: "Delete") deleteConfirmation.buttons.last?.hasDestructiveAction = true deleteConfirmatio...
@@ -257,7 +257,13 @@ public extension WorkspaceClient { var fileUrl = self.url while FileItem.fileManger.fileExists(atPath: fileUrl.path) { let previousName = fileUrl.lastPathComponent - fileUrl = fileUrl.deletingLastPathComponent().appendingPathComponent("\(pre...
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.429
suggestion
148
51
51
false
Add duplicate file functionality
736
CodeEditApp/CodeEdit
18,361
Swift
muescha
Muhammed9991
// file system can change outside of the editor let deleteConfirmation = NSAlert() let message = "\(self.fileName)\(self.isFolder ? " and its children" :"")" deleteConfirmation.messageText = "Are you sure you want to move \(message) to the Trash?" deleteConfi...
if you change the order then you not need to cast to NSString: ```suggestion let previousName = fileUrl.deletingPathExtension().lastPathComponent ```
// file system can change outside of the editor let deleteConfirmation = NSAlert() let message = "\(self.fileName)\(self.isFolder ? " and its children" :"")" deleteConfirmation.messageText = "Are you sure you want to move \(message) to the Trash?" deleteConfi...
@@ -256,8 +256,13 @@ public extension WorkspaceClient { // if a file/folder with the same name exists, add "copy" to the end var fileUrl = self.url while FileItem.fileManger.fileExists(atPath: fileUrl.path) { - let previousName = fileUrl.lastPathComponent - ...
CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift
26
Swift
0.929
suggestion
170
51
51
false
Add duplicate file functionality
736
CodeEditApp/CodeEdit
18,361
Swift
muescha
Muhammed9991
// // GeneralPreferencesView.swift // CodeEditModules/AppPreferences // // Created by Lukas Pistrol on 30.03.22. // import SwiftUI import CodeEditUI import Sparkle /// A view that implements the `General` preference section public struct GeneralPreferencesView: View { @StateObject private var updater = Observa...
Unless I'm missing something, I think unless `GeneralPreferencesView` get initialized at the start of your app - the updater won't get initialized and therefore won't automatically check for updates.
// // GeneralPreferencesView.swift // CodeEditModules/AppPreferences // // Created by Lukas Pistrol on 30.03.22. // import SwiftUI import CodeEditUI import Sparkle /// A view that implements the `General` preference section public struct GeneralPreferencesView: View { @EnvironmentObject var updater: SoftwareUp...
@@ -7,9 +7,11 @@ import SwiftUI import CodeEditUI +import Sparkle /// A view that implements the `General` preference section public struct GeneralPreferencesView: View { + @StateObject private var updater = ObservableUpdater()
CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift
14
Swift
0.571
suggestion
200
39
39
false
Sparkle updates
759
CodeEditApp/CodeEdit
18,361
Swift
MattKiazyk
austincondiff
// // SoftwareUpdater.swift // CodeEdit // // Created by Austin Condiff on 9/19/22. // import Foundation import Sparkle public class ObservableUpdater: ObservableObject { public static let shared = ObservableUpdater() private let updater: SPUUpdater @Published var automaticallyChecksForUpdates = false...
Should this be named `SoftwareUpdater` like your file name? #picky
// // SoftwareUpdater.swift // CodeEdit // // Created by Austin Condiff on 9/19/22. // import Foundation import Sparkle public class SoftwareUpdater: ObservableObject { private let updater: SPUUpdater @Published var automaticallyChecksForUpdates = false { didSet { updater.automaticallyC...
@@ -0,0 +1,64 @@ +// +// SoftwareUpdater.swift +// CodeEdit +// +// Created by Austin Condiff on 9/19/22. +// + +import Foundation +import Sparkle + +public class ObservableUpdater: ObservableObject {
CodeEditModules/Modules/AppPreferences/src/SoftwareUpdater.swift
11
Swift
0.429
suggestion
67
36
36
false
Sparkle updates
759
CodeEditApp/CodeEdit
18,361
Swift
MattKiazyk
austincondiff
guard let path = fileURL?.path else { return } let hash = path.sha256() let data = try PropertyListEncoder().encode(selectionState) UserDefaults.standard.set(data, forKey: hash) } override func close() { do { try saveSelectionState() } catch { ...
Typo: "editied" should be "edited" #picky
guard let path = fileURL?.path else { return } let hash = path.sha256() let data = try PropertyListEncoder().encode(selectionState) UserDefaults.standard.set(data, forKey: hash) } override func close() { do { try saveSelectionState() } catch { ...
@@ -368,6 +380,89 @@ import TabBar super.close() } + + /// Determines the windows should be closed. + /// + /// This method iterates all editied documents If there are any editied documents.
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.143
suggestion
41
51
51
false
Add preferences option to toggle auto-save.
763
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
sk409
} override func close() { do { try saveSelectionState() } catch { Swift.print("couldn't save selection state from user defaults") } selectionState.selectedId = nil selectionState.openedCodeFiles.removeAll() if let url = self.fileURL { ...
Grammatical error: "breaked" should be "broken" #picky
} override func close() { do { try saveSelectionState() } catch { Swift.print("couldn't save selection state from user defaults") } selectionState.selectedId = nil selectionState.openedCodeFiles.removeAll() if let url = self.fileURL { ...
@@ -368,6 +380,89 @@ import TabBar super.close() } + + /// Determines the windows should be closed. + /// + /// This method iterates all editied documents If there are any editied documents. + /// + /// A panel giving the user the choice of canceling, discarding changes, or saving is pres...
CodeEdit/Documents/WorkspaceDocument.swift
26
Swift
0.429
bug
54
51
51
false
Add preferences option to toggle auto-save.
763
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
sk409
if let attributes = overrides[key] { theme.editor[key] = attributes } } } // add the theme to themes array self.themes.append(theme) // if there already is a ...
So, this part is not working the way I want. It seems that ColorScheme is not yet initialized by the application at this point. The `colorScheme` variable is always `.light` even if the system appearance is dark. What happens, is that the app will always open with a white theme at the first start, instead of using the ...
} // add the theme to themes array self.themes.append(theme) // if there already is a selected theme in `preferences.json` select this theme // otherwise take the first in the list self.selectedDarkTheme = self.darkThemes....
@@ -143,10 +166,33 @@ public final class ThemeModel: ObservableObject { // if there already is a selected theme in `preferences.json` select this theme // otherwise take the first in the list - self.selectedTheme = self.themes.first { $0.name == prefs.theme.selectedThe...
CodeEditModules/Modules/AppPreferences/src/Sections/ThemePreferences/Model/ThemeModel.swift
26
Swift
0.643
suggestion
422
51
51
false
Fixes 714: Theme does not sync with system appearance
765
CodeEditApp/CodeEdit
18,361
Swift
matthijseikelenboom
matthijseikelenboom
/// The publicly available singleton instance of ``AppPreferencesModel`` public static let shared: AppPreferencesModel = .init() private init() { self.preferences = .init() self.preferences = loadPreferences() } /// Published instance of the ``AppPreferences`` model. /// //...
Maybe we can replace this with `baseURL`
/// The publicly available singleton instance of ``AppPreferencesModel`` public static let shared: AppPreferencesModel = .init() private init() { self.preferences = .init() self.preferences = loadPreferences() } /// Published instance of the ``AppPreferences`` model. /// //...
@@ -37,12 +37,12 @@ public final class AppPreferencesModel: ObservableObject { } /// Load and construct ``AppPreferences`` model from - /// `~/.codeedit/preferences.json` + /// `~/Library/Application Support/CodeEdit/preferences.json` private func loadPreferences() -> AppPreferences { if...
CodeEditModules/Modules/AppPreferences/src/Model/AppPreferencesModel.swift
26
Swift
0.286
suggestion
40
51
51
false
Moved Themes and Preferences to Application Support
827
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
austincondiff
} func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool { false } func handleOpen() { let behavior = AppPreferencesModel.shared.preferences.general.reopenBehavior switch behavior { case .welcome: openWelcome(self) case .openPanel: ...
Why is this by default 1, a more natural approach is line 0, column 0.
} func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool { false } func handleOpen() { let behavior = AppPreferencesModel.shared.preferences.general.reopenBehavior switch behavior { case .welcome: openWelcome(self) case .openPanel: ...
@@ -121,6 +122,27 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { } } + /// Handle urls with the form `codeedit://file/{filepath}:{line}:{column}` + func application(_ application: NSApplication, open urls: [URL]) { + for url in urls { + let file =...
CodeEdit/AppDelegate.swift
26
Swift
0.214
suggestion
70
51
51
false
Add ability to open files using `codeedit://` URLs.
840
CodeEditApp/CodeEdit
18,361
Swift
0xWDG
ezraberch
} .frame(height: 29, alignment: .center) .frame(maxWidth: .infinity) .overlay(alignment: .top) { Divider() } .overlay(alignment: .bottom) { Divider() } .animation(.default, value: icons) } private func makeIcon(named: Strin...
Wouldn't it be better to use `.fit` instead? `.fill` might lead to cut-off icons if they are particularly wide or tall.
} } .frame(maxWidth: .infinity, maxHeight: .infinity) .overlay(alignment: .top) { Divider() } .overlay(alignment: .bottom) { Divider() } .animation(.default, value: icons) } ...
@@ -73,6 +73,8 @@ struct NavigatorSidebarToolbarTop: View { selection = id } label: { getSafeImage(named: named, accesibilityDescription: title) + .resizable() + .aspectRatio(contentMode: .fill)
CodeEdit/Features/NavigatorSidebar/NavigatorSidebarToolbarTop.swift
26
Swift
0.571
suggestion
119
51
51
false
Snap Sidebar To Width
882
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
yapryntsev
} ) includePrereleaseVersions = UserDefaults.standard.bool(forKey: "includePrereleaseVersions") } func allowedChannels(for updater: SPUUpdater) -> Set<String> { if includePrereleaseVersions { return ["dev"] } return [] } func checkForUpd...
Can't this be merged into 1 variable?
// // SoftwareUpdater.swift // CodeEdit // // Created by Austin Condiff on 9/19/22. // import Foundation import Sparkle class SoftwareUpdater: NSObject, ObservableObject, SPUUpdaterDelegate { private var updater: SPUUpdater? private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation? p...
@@ -62,12 +63,24 @@ class SoftwareUpdater: ObservableObject { includePrereleaseVersions = UserDefaults.standard.bool(forKey: "includePrereleaseVersions") } + func allowedChannels(for updater: SPUUpdater) -> Set<String> { + if includePrereleaseVersions { + return ["dev"] + } +...
CodeEdit/Features/AppPreferences/SoftwareUpdater.swift
26
Swift
0.071
question
37
28
80
false
[fix]: Sparkle Software Updater
909
CodeEditApp/CodeEdit
18,361
Swift
Wouter01
lukepistrol
} .frame(maxWidth: .infinity, idealHeight: 29) .fixedSize(horizontal: false, vertical: true) } private func makeIcon(named: String, title: String, id: Int, scale: Image.Scale = .medium, ...
break up arguments to new lines ```swift SomeTypeDefinition( arg1: …, arg2: … ) ```
} .frame(maxWidth: .infinity, idealHeight: 29) .fixedSize(horizontal: false, vertical: true) } private func makeIcon(named: String, title: String, id: Int, scale: Image.Scale = .medium, ...
@@ -84,7 +84,10 @@ struct NavigatorSidebarToolbarTop: View { .frame(width: .zero) } } - .buttonStyle(NavigatorToolbarButtonStyle(id: id, selection: selection, activeState: activeState)) + .buttonStyle(NavigatorToolbarButtonStyle(id: id,
CodeEdit/Features/NavigatorSidebar/NavigatorSidebarToolbarTop.swift
26
Swift
0.714
suggestion
95
51
51
false
fix for icon size
920
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
Wouter01
class SoftwareUpdater: NSObject, ObservableObject, SPUUpdaterDelegate { private var updater: SPUUpdater? private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation? private var lastUpdateCheckDateObservation: NSKeyValueObservation? @Published var automaticallyChecksForUpdates = fal...
Should we be setting these URL's in an Info.plist and referencing here instead of hardcoding?
class SoftwareUpdater: NSObject, ObservableObject, SPUUpdaterDelegate { private var updater: SPUUpdater? private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation? private var lastUpdateCheckDateObservation: NSKeyValueObservation? @Published var automaticallyChecksForUpdates = fal...
@@ -30,6 +30,27 @@ class SoftwareUpdater: NSObject, ObservableObject, SPUUpdaterDelegate { } } + private var feedURLTask: Task<(), Never>? + + private func setFeedURL() async { + let url = URL(string: "https://api.github.com/repos/CodeEditApp/CodeEdit/releases/latest")!
CodeEdit/Features/AppPreferences/SoftwareUpdater.swift
26
Swift
0.286
question
93
51
51
false
[fix]: Update Mechanism
939
CodeEditApp/CodeEdit
18,361
Swift
austincondiff
lukepistrol
} } @Published var lastUpdateCheckDate: Date? @Published var includePrereleaseVersions = false { didSet { UserDefaults.standard.setValue(includePrereleaseVersions, forKey: "includePrereleaseVersions") } } private var feedURLTask: Task<(), Never>? p...
This should maybe be removed to avoid unnecessary logs.
} } @Published var lastUpdateCheckDate: Date? @Published var includePrereleaseVersions = false { didSet { UserDefaults.standard.setValue(includePrereleaseVersions, forKey: "includePrereleaseVersions") } } private var feedURLTask: Task<(), Never>? p...
@@ -30,6 +30,27 @@ class SoftwareUpdater: NSObject, ObservableObject, SPUUpdaterDelegate { } } + private var feedURLTask: Task<(), Never>? + + private func setFeedURL() async { + let url = URL(string: "https://api.github.com/repos/CodeEditApp/CodeEdit/releases/latest")! + let request...
CodeEdit/Features/AppPreferences/SoftwareUpdater.swift
26
Swift
0.286
suggestion
55
51
51
false
[fix]: Update Mechanism
939
CodeEditApp/CodeEdit
18,361
Swift
thecoolwinter
lukepistrol
// TextEditingPreferences.swift // CodeEditModules/AppPreferences // // Created by Nanashi Li on 2022/04/08. // import Foundation extension AppPreferences { /// The global settings for text editing struct TextEditingPreferences: Codable { /// An integer indicating how many spaces a `tab` will gene...
please also add `self.populateCommands()` here
// TextEditingPreferences.swift // CodeEditModules/AppPreferences // // Created by Nanashi Li on 2022/04/08. // import Foundation extension AppPreferences { /// The global settings for text editing struct TextEditingPreferences: Codable { /// An integer indicating how many spaces a `tab` will gene...
@@ -21,6 +21,8 @@ extension AppPreferences { var autocompleteBraces: Bool = true + var wrapLinesToEditorWidth: Bool = true + /// Default initializer init() {}
CodeEdit/Features/AppPreferences/Model/Text Editing/TextEditingPreferences.swift
26
Swift
0.214
suggestion
46
51
51
false
Add preference for text wrapping in editor, add command palette options for text editing prefs
948
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
ben-p-commits
// // TextEditingPreferences.swift // CodeEditModules/AppPreferences // // Created by Nanashi Li on 2022/04/08. // import Foundation extension AppPreferences { /// The global settings for text editing struct TextEditingPreferences: Codable { /// An integer indicating how many spaces a `tab` will g...
Also please add a doc-comment above the property
// // TextEditingPreferences.swift // CodeEditModules/AppPreferences // // Created by Nanashi Li on 2022/04/08. // import Foundation extension AppPreferences { /// The global settings for text editing struct TextEditingPreferences: Codable { /// An integer indicating how many spaces a `tab` will g...
@@ -21,6 +21,8 @@ extension AppPreferences { var autocompleteBraces: Bool = true + var wrapLinesToEditorWidth: Bool = true
CodeEdit/Features/AppPreferences/Model/Text Editing/TextEditingPreferences.swift
25
Swift
0.071
suggestion
48
50
50
false
Add preference for text wrapping in editor, add command palette options for text editing prefs
948
CodeEditApp/CodeEdit
18,361
Swift
lukepistrol
ben-p-commits