before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
}
private var enableTypeOverCompletion: some View {
HStack {
Toggle("Enable type-over completion", isOn: $prefs.preferences.textEditing.enableTypeOverCompletion)
Text("Enable type-over completion")
}
}
private var wrapLinesToEditorWidth: some View {
HSta... | `spaces` is not appropriate here | }
private var enableTypeOverCompletion: some View {
HStack {
Toggle("Enable type-over completion", isOn: $prefs.preferences.textEditing.enableTypeOverCompletion)
Text("Enable type-over completion")
}
}
private var wrapLinesToEditorWidth: some View {
HSta... | @@ -86,4 +102,16 @@ struct TextEditingPreferencesView: View {
}
}
+ private var lineHeightMultiple: some View {
+ HStack(spacing: 5) {
+ TextField("", value: $prefs.preferences.textEditing.lineHeightMultiple, formatter: lineHeightFormatter)
+ .multilineTextAlignment(.... | CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift | 26 | Swift | 0.214 | suggestion | 32 | 30 | 29 | false | Add line height multiple option to text editing preferences | 955 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | ben-p-commits | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift
PR Title: Add line height multiple option to text editing preferences
BEFORE CODE: }
private var enableTypeOverCompletion: some View {
HStack {
... | `spaces` is not appropriate here | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
struct AcknowledgementRow: View {
@Environment(\.openURL) var openURL
var acknowledgement: AcknowledgementDependency
var body: some View {
HStack(alignment: .firstTextBaseline, spacing: 10) {
Text(acknowledgement.name)
.bold()
Text(acknowledgement.version)
... | Any reason for the shortened name of the struct? |
struct AcknowledgementRow: View {
@Environment(\.openURL) var openURL
var acknowledgement: AcknowledgementDependency
var body: some View {
HStack(alignment: .firstTextBaseline, spacing: 10) {
Text(acknowledgement.name)
.bold()
Text(acknowledgement.version)
... | @@ -64,6 +65,12 @@ struct AcknowledgementRow: View {
}
}
+struct Ackn_Previews: PreviewProvider { | CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift | 26 | Swift | 0.071 | question | 48 | 51 | 51 | false | [fix]: Acknowledgements Window | 963 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | lukepistrol | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift
PR Title: [fix]: Acknowledgements Window
BEFORE CODE:
struct AcknowledgementRow: View {
@Environment(\.openURL) var openURL
var acknowledgement: AcknowledgementDependency
var bod... | Any reason for the shortened name of the struct? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
splitView.setPosition(.snapWidth, ofDividerAt: .zero)
}
// MARK: - NSSplitViewDelegate
override func splitView(
_ splitView: NSSplitView,
constrainSplitPosition proposedPosition: CGFloat,
ofSubviewAt dividerIndex: Int
) -> CGFloat {
if dividerIndex == 0 {
... | Reading through the code, I really don't know what "121" means or is. Perhaps make a constant for it? | splitView.setPosition(.snapWidth, ofDividerAt: .zero)
}
// MARK: - NSSplitViewDelegate
override func splitView(
_ splitView: NSSplitView,
constrainSplitPosition proposedPosition: CGFloat,
ofSubviewAt dividerIndex: Int
) -> CGFloat {
if dividerIndex == 0 {
... | @@ -51,12 +51,51 @@ final class CodeEditSplitViewController: NSSplitViewController {
constrainSplitPosition proposedPosition: CGFloat,
ofSubviewAt dividerIndex: Int
) -> CGFloat {
- if (CGFloat.minSnapWidth...CGFloat.maxSnapWidth).contains(proposedPosition) {
- isSnapped = true
... | CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift | 26 | Swift | 0.357 | question | 101 | 51 | 51 | false | Resize inspector | 970 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | thecoolwinter | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift
PR Title: Resize inspector
BEFORE CODE: splitView.setPosition(.snapWidth, ofDividerAt: .zero)
}
// MARK: - NSSplitViewDelegate
override func splitView(
_ spl... | Reading through the code, I really don't know what "121" means or is. Perhaps make a constant for it? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if newValue, newValue != isSnapped {
feedbackPerformer.perform(.alignment, performanceTime: .now)
}
}
}
// Dependencies
private let feedbackPerformer: NSHapticFeedbackPerformer
// MARK: - Initialization
init(workspace: WorkspaceDocument, feedbackPer... | Shouldn't the default width for the sidebar be `snapWidth` instead of the minimum width? I believe this is also what we are doing for now. |
// Properties
private(set) var isSnapped: Bool = false {
willSet {
if newValue, newValue != isSnapped {
feedbackPerformer.perform(.alignment, performanceTime: .now)
}
}
}
// Dependencies
private let feedbackPerformer: NSHapticFeedbackPerforme... | @@ -46,8 +46,8 @@ final class CodeEditSplitViewController: NSSplitViewController {
override func viewWillAppear() {
super.viewWillAppear()
- let width = workspace.getFromWorkspaceState(key: self.widthStateName) as? CGFloat ?? 0
- splitView.setPosition(width, ofDividerAt: .zero)
+ le... | CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift | 26 | Swift | 0.571 | suggestion | 138 | 51 | 51 | false | Save UI state per Workspace | 984 | CodeEditApp/CodeEdit | 18,361 | Swift | Qubik65536 | Code-DJ | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift
PR Title: Save UI state per Workspace
BEFORE CODE: if newValue, newValue != isSnapped {
feedbackPerformer.perform(.alignment, performanceTime: .now)
... | Shouldn't the default width for the sidebar be `snapWidth` instead of the minimum width? I believe this is also what we are doing for now. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
override func viewWillAppear() {
super.viewWillAppear()
let width = workspace.getFromWorkspaceState(key: self.widthStateName) as? CGFloat
splitView.setPosition(width ?? .snapWidth, ofDividerAt: .zero)
setWidthFromState = true
}
// MARK: - NSSplitViewDelegate
over... | Found a little problem...
As discussed in #976, we should initialize the sidebar with a width only if the user-preferred width exists and is not the snap width, otherwise, the haptic feedback for snapping the sidebar will be triggered. Here's a suggested solution:
```suggestion
/// Initialize the sidebar with u... |
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewWillAppear() {
super.viewWillAppear()
let width = workspace.getFromWorkspaceState(key: self.widthStateName) as? CGFloat
splitView.setPosit... | @@ -39,10 +44,12 @@ final class CodeEditSplitViewController: NSSplitViewController {
fatalError("init(coder:) has not been implemented")
}
- // TODO: Set user preferences width if it is not the snap width
-// override func viewWillAppear() {
-// super.viewWillAppear()
-// }
+ override... | CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift | 26 | Swift | 0.857 | suggestion | 822 | 51 | 51 | false | Save UI state per Workspace | 984 | CodeEditApp/CodeEdit | 18,361 | Swift | Qubik65536 | Code-DJ | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift
PR Title: Save UI state per Workspace
BEFORE CODE: }
override func viewWillAppear() {
super.viewWillAppear()
let width = workspace.getFromWorkspaceState(key: self... | Found a little problem...
As discussed in #976, we should initialize the sidebar with a width only if the user-preferred width exists and is not the snap width, otherwise, the haptic feedback for snapping the sidebar will be triggered. Here's a suggested solution:
```suggestion
/// Initialize the sidebar with u... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// ContributorsView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
... | Should be 48x48...
```suggestion
.frame(width: 48, height: 48)
``` | //
// ContributorsView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
... | @@ -0,0 +1,72 @@
+//
+// ContributorsView.swift
+// CodeEdit
+//
+// Created by Lukas Pistrol on 19.01.23.
+//
+
+import SwiftUI
+
+struct ContributorsView: View {
+
+ @StateObject private var viewModel = ContributorsViewModel()
+ @State private var displayDivider = false
+
+ var body: some View {
+ ... | CodeEdit/Features/Contributors/ContributorsView.swift | 19 | Swift | 0.643 | suggestion | 85 | 44 | 44 | false | Feat/contributors window | 1,002 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | lukepistrol | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Contributors/ContributorsView.swift
PR Title: Feat/contributors window
BEFORE CODE: //
// ContributorsView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
import SwiftUI
struct ContributorsView: View {
@StateObject p... | Should be 48x48...
```suggestion
.frame(width: 48, height: 48)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// ContributorsView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
... | ```suggestion
.font(.title)
``` | //
// ContributorsView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
... | @@ -0,0 +1,72 @@
+//
+// ContributorsView.swift
+// CodeEdit
+//
+// Created by Lukas Pistrol on 19.01.23.
+//
+
+import SwiftUI
+
+struct ContributorsView: View {
+
+ @StateObject private var viewModel = ContributorsViewModel()
+ @State private var displayDivider = false
+
+ var body: some View {
+ ... | CodeEdit/Features/Contributors/ContributorsView.swift | 22 | Swift | 0.429 | suggestion | 49 | 47 | 47 | false | Feat/contributors window | 1,002 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | lukepistrol | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Contributors/ContributorsView.swift
PR Title: Feat/contributors window
BEFORE CODE: //
// ContributorsView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
import SwiftUI
struct ContributorsView: View {
@StateObject p... | ```suggestion
.font(.title)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 48, height: 48)
Text("Contr... | To match other windows and ensure that the design can fit within these bounds for future transition work...
```suggestion
.frame(width: 280, height: 400)
``` | @StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 48, height: 48)
Text("Contr... | @@ -0,0 +1,71 @@
+//
+// ContributorsView.swift
+// CodeEdit
+//
+// Created by Lukas Pistrol on 19.01.23.
+//
+
+import SwiftUI
+
+struct ContributorsView: View {
+
+ @StateObject private var viewModel = ContributorsViewModel()
+ @State private var displayDivider = false
+
+ var body: some View {
+ ... | CodeEdit/Features/Contributors/ContributorsView.swift | 26 | Swift | 0.714 | suggestion | 168 | 51 | 51 | false | Feat/contributors window | 1,002 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | lukepistrol | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Contributors/ContributorsView.swift
PR Title: Feat/contributors window
BEFORE CODE: @StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacin... | To match other windows and ensure that the design can fit within these bounds for future transition work...
```suggestion
.frame(width: 280, height: 400)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.fr... | After discussing the Acknowledgement and Contributors design with @Wouter01, we are in agreement that these dividers in between rows should be subtle.
```suggestion
Divider()
.frame(height: 0.5)
.opacity(0.5)
... |
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.fr... | @@ -0,0 +1,71 @@
+//
+// ContributorsView.swift
+// CodeEdit
+//
+// Created by Lukas Pistrol on 19.01.23.
+//
+
+import SwiftUI
+
+struct ContributorsView: View {
+
+ @StateObject private var viewModel = ContributorsViewModel()
+ @State private var displayDivider = false
+
+ var body: some View {
+ ... | CodeEdit/Features/Contributors/ContributorsView.swift | 26 | Swift | 0.857 | suggestion | 411 | 51 | 51 | false | Feat/contributors window | 1,002 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | lukepistrol | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Contributors/ContributorsView.swift
PR Title: Feat/contributors window
BEFORE CODE:
import SwiftUI
struct ContributorsView: View {
@StateObject private var viewModel = ContributorsViewModel()
@State private var displayDivider = fals... | After discussing the Acknowledgement and Contributors design with @Wouter01, we are in agreement that these dividers in between rows should be subtle.
```suggestion
Divider()
.frame(height: 0.5)
.opacity(0.5)
... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 48, height: 48)
Text("Acknowledgements")
.font(.title)
.fontWeight(.bold)
.padding(.vertic... | Maybe move this to a `private func acknowledgementCell(_ acknowledgement: )` to make it easier to read | Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 48, height: 48)
Text("Acknowledgements")
.font(.title)
.fontWeight(.bold)
.padding(.vertical, 8)
Divider()
.opacity(di... | @@ -14,38 +14,55 @@ struct AcknowledgementsView: View {
@ObservedObject
private var model = AcknowledgementsViewModel()
+ @State private var displayDivider = false
+
var body: some View {
- VStack {
+ VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
... | CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift | 26 | Swift | 0.571 | refactor | 103 | 51 | 37 | false | Made design improvements to About and Acknowledgements windows | 1,003 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift
PR Title: Made design improvements to About and Acknowledgements windows
BEFORE CODE:
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconIma... | Maybe move this to a `private func acknowledgementCell(_ acknowledgement: )` to make it easier to read | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import SwiftUI
struct AcknowledgementsView: View {
@ObservedObject
private var model = AcknowledgementsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
... | Please move this to the view model as a computed property like so:
```swift
var indexedAcknowledgements: [(index: Int, acknowledgement: AcknowledgementDependency)] {
return Array(zip(acknowledgements.indices, acknowledgements))
}
``` |
import SwiftUI
struct AcknowledgementsView: View {
@ObservedObject
private var model = AcknowledgementsViewModel()
@State private var displayDivider = false
var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
... | @@ -8,44 +8,43 @@
import SwiftUI
struct AcknowledgementsView: View {
-
- @Environment(\.openURL) private var openURL
-
@ObservedObject
private var model = AcknowledgementsViewModel()
+ @State private var displayDivider = false
+
var body: some View {
- VStack {
+ VStack(spacing:... | CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift | 26 | Swift | 0.857 | refactor | 242 | 48 | 48 | false | Made design improvements to About and Acknowledgements windows | 1,003 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift
PR Title: Made design improvements to About and Acknowledgements windows
BEFORE CODE:
import SwiftUI
struct AcknowledgementsView: View {
@ObservedObject
private var model = Acknowledg... | Please move this to the view model as a computed property like so:
```swift
var indexedAcknowledgements: [(index: Int, acknowledgement: AcknowledgementDependency)] {
return Array(zip(acknowledgements.indices, acknowledgements))
}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let createdFile = self.fileManager.createFile(
atPath: newDocumentUrl.path,
contents: nil,
attributes: [FileAttributeKey.creationDate: Date()]
)
guard createdFile else {
print("Failed to create new document")
return
}
s... | Could we use a [`NSSavePanel`](https://developer.apple.com/documentation/appkit/nssavepanel) here instead? It would look something like:
```
let panel = NSSavePanel()
// Maybe add some customization to the panel here...
guard panel.runModal() == .OK else {
return nil
}
return panel.url
```
It would allow... | let createdFile = self.fileManager.createFile(
atPath: newDocumentUrl.path,
contents: nil,
attributes: [FileAttributeKey.creationDate: Date()]
)
guard createdFile else {
print("Failed to create new document")
return
}
s... | @@ -8,6 +8,42 @@
import Cocoa
final class CodeEditDocumentController: NSDocumentController {
+ lazy var fileManager: FileManager = {
+ FileManager.default
+ }()
+
+ override func newDocument(_ sender: Any?) {
+ guard let newDocumentUrl = self.newDocumentUrl else { return }
+
+ let crea... | CodeEdit/Features/Documents/Controllers/CodeEditDocumentController.swift | 26 | Swift | 1 | suggestion | 513 | 51 | 51 | false | fix: Don't use defaultType to determine file extension | 1,030 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | SwampThingTom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditDocumentController.swift
PR Title: fix: Don't use defaultType to determine file extension
BEFORE CODE: let createdFile = self.fileManager.createFile(
atPath: newDocumentUrl.path,
co... | Could we use a [`NSSavePanel`](https://developer.apple.com/documentation/appkit/nssavepanel) here instead? It would look something like:
```
let panel = NSSavePanel()
// Maybe add some customization to the panel here...
guard panel.runModal() == .OK else {
return nil
}
return panel.url
```
It would allow... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@EnvironmentObject
var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 10) {
addNewFileButton
Spacer()
sortButton
}
.frame(height: 29, alignment: .center)
.frame(maxWidth: .infinity)
.padding(.horizontal, 4)
... | This nested dispatch should be changed to a single `DispatchQueue.main.async`. `DispatchQueue.main.async` will queue the completion for the next render loop, so there's no need to do two context switches. |
@EnvironmentObject
var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 10) {
addNewFileButton
Spacer()
sortButton
}
.frame(height: 29, alignment: .center)
.frame(maxWidth: .infinity)
.padding(.horizontal, 4)
... | @@ -33,7 +33,17 @@ struct NavigatorSidebarToolbarBottom: View {
Button("Add File") {
guard let folderURL = workspace.workspaceClient?.folderURL() else { return }
guard let root = try? workspace.workspaceClient?.getFileItem(folderURL.path) else { return }
- r... | CodeEdit/Features/NavigatorSidebar/NavigatorSidebarToolbarBottom.swift | 26 | Swift | 0.643 | suggestion | 204 | 51 | 51 | false | Push newly created file into the workspace (#696) | 1,057 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | RenanGreca | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorSidebar/NavigatorSidebarToolbarBottom.swift
PR Title: Push newly created file into the workspace (#696)
BEFORE CODE:
@EnvironmentObject
var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 10) {... | This nested dispatch should be changed to a single `DispatchQueue.main.async`. `DispatchQueue.main.async` will queue the completion for the next render loop, so there's no need to do two context switches. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import CodeEditSymbols
final class CodeEditApplication: NSApplication {
let strongDelegate = AppDelegate()
override init() {
super.init()
self.delegate = strongDelegate
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been impl... | This is more of an open suggestion, but we could wrap lines like these in a private function, describing what it does, instead of adding a comment above it. In this case it could be `enableWindowSizeSaveOnQuit()` for example. And we can always add a function description block for a better explanation. | import CodeEditSymbols
final class CodeEditApplication: NSApplication {
let strongDelegate = AppDelegate()
override init() {
super.init()
self.delegate = strongDelegate
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been impl... | @@ -25,11 +25,14 @@ final class CodeEditApplication: NSApplication {
}
@NSApplicationMain
-final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { // swiftlint:disable:this type_body_length
+final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
var updater: SoftwareU... | CodeEdit/AppDelegate.swift | 26 | Swift | 0.643 | suggestion | 303 | 51 | 51 | false | improvement to window state | 1,068 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/AppDelegate.swift
PR Title: improvement to window state
BEFORE CODE: import CodeEditSymbols
final class CodeEditApplication: NSApplication {
let strongDelegate = AppDelegate()
override init() {
super.init()
self.delegate = str... | This is more of an open suggestion, but we could wrap lines like these in a private function, describing what it does, instead of adding a comment above it. In this case it could be `enableWindowSizeSaveOnQuit()` for example. And we can always add a function description block for a better explanation. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let files = filesToOpen.split(separator: ";")
for filePath in files {
let fileURL = URL(fileURLWithPath: String(filePath))
CodeEditDocumentController.shared.reopenDocument(
for: fileURL,
withContentsOf: fileURL,
... | What is the reason this function `static`? | let files = filesToOpen.split(separator: ";")
for filePath in files {
let fileURL = URL(fileURLWithPath: String(filePath))
CodeEditDocumentController.shared.reopenDocument(
for: fileURL,
withContentsOf: fileURL,
... | @@ -233,6 +221,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { //
}
}
+ /// Enable window size restoring on app relaunch after quitting.
+ static func enableWindowSizeSaveOnQuit() {
+ // This enables window restoring on normal quit (instead of only on forc... | CodeEdit/AppDelegate.swift | 26 | Swift | 0.214 | question | 42 | 51 | 51 | false | improvement to window state | 1,068 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/AppDelegate.swift
PR Title: improvement to window state
BEFORE CODE: let files = filesToOpen.split(separator: ";")
for filePath in files {
let fileURL = URL(fileURLWithPath: String(filePath))
Cod... | What is the reason this function `static`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
///
/// Default implementation pulled from Example app from "SwiftTerm":
/// ```swift
/// let bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)
/// guard bufsize != -1 else { return "/bin/bash" }
/// let buffer = UnsafeMutablePointer<Int8>.allocate(capacity: bufsize)
/// defer {
/// ... | This should read `getTerminalCaret()` or to be consistent just `getTerminalCursor()`. | ///
/// Default implementation pulled from Example app from "SwiftTerm":
/// ```swift
/// let bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)
/// guard bufsize != -1 else { return "/bin/bash" }
/// let buffer = UnsafeMutablePointer<Int8>.allocate(capacity: bufsize)
/// defer {
/// ... | @@ -72,6 +72,22 @@ struct TerminalEmulatorView: NSViewRepresentable {
return "/bin/zsh"
}
}
+ private func getTerminalCarrot() -> CursorStyle { | CodeEdit/Features/TerminalEmulator/TerminalEmulatorView.swift | 26 | Swift | 0.429 | suggestion | 85 | 51 | 51 | false | Addressing features/bugs with the terminal | 1,117 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | bombardier200 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/TerminalEmulator/TerminalEmulatorView.swift
PR Title: Addressing features/bugs with the terminal
BEFORE CODE: ///
/// Default implementation pulled from Example app from "SwiftTerm":
/// ```swift
/// let bufsize = sysconf(_S... | This should read `getTerminalCaret()` or to be consistent just `getTerminalCursor()`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
shellSelector
optionAsMetaToggle
}
PreferencesSection("Font") {
fontSelector
}
PreferencesSection("Style") {
carrotSelector
}
}
}
private var shellSelector: some View {
Pi... | Either use `Terminal Caret Style:` or `Terminal Cursor Style:` here | shellSelector
optionAsMetaToggle
}
PreferencesSection("Font") {
fontSelector
}
PreferencesSection("Cursor") {
cursorStyle
cursorBlink
}
}
}
private var shellSelect... | @@ -41,6 +44,23 @@ struct TerminalPreferencesView: View {
}
.frame(width: inputWidth)
}
+ private var carrotSelector: some View {
+ Picker("Terminal Carrot Style: ", selection: $prefs.preferences.terminal.cursorStyle) { | CodeEdit/Features/AppPreferences/Sections/TerminalPreferences/TerminalPreferencesView.swift | 26 | Swift | 0.429 | style | 67 | 51 | 51 | false | Addressing features/bugs with the terminal | 1,117 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | bombardier200 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Sections/TerminalPreferences/TerminalPreferencesView.swift
PR Title: Addressing features/bugs with the terminal
BEFORE CODE: shellSelector
optionAsMetaToggle
}
PreferencesS... | Either use `Terminal Caret Style:` or `Terminal Cursor Style:` here | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// if true, the terminal uses the background color of the theme, otherwise it is clear
var useThemeBackground: Bool = true
/// If true, the terminal treats the `Option` key as the `Meta` key
var optionAsMeta: Bool = false
/// The selected shell to use.
var shell: Termi... | This line makes `SwiftLint` unhappy. Please break it up into multiple lines 😊
```suggestion
self.cursorStyle = try container.decodeIfPresent(
TerminalCursorStyle.self,
forKey: .cursorStyle
) ?? .steadyBlock
``` | /// if true, the terminal uses the background color of the theme, otherwise it is clear
var useThemeBackground: Bool = true
/// If true, the terminal treats the `Option` key as the `Meta` key
var optionAsMeta: Bool = false
/// The selected shell to use.
var shell: Termi... | @@ -37,6 +40,7 @@ extension AppPreferences {
self.optionAsMeta = try container.decodeIfPresent(Bool.self, forKey: .optionAsMeta) ?? false
self.shell = try container.decodeIfPresent(TerminalShell.self, forKey: .shell) ?? .system
self.font = try container.decodeIfPresent(TerminalFon... | CodeEdit/Features/AppPreferences/Model/Terminal/TerminalPreferences.swift | 26 | Swift | 0.786 | suggestion | 273 | 51 | 51 | false | Addressing features/bugs with the terminal | 1,117 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | bombardier200 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Model/Terminal/TerminalPreferences.swift
PR Title: Addressing features/bugs with the terminal
BEFORE CODE: /// if true, the terminal uses the background color of the theme, otherwise it is clear
var useThemeBackg... | This line makes `SwiftLint` unhappy. Please break it up into multiple lines 😊
```suggestion
self.cursorStyle = try container.decodeIfPresent(
TerminalCursorStyle.self,
forKey: .cursorStyle
) ?? .steadyBlock
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var useThemeBackground: Bool = true
/// If true, the terminal treats the `Option` key as the `Meta` key
var optionAsMeta: Bool = false
/// The selected shell to use.
var shell: TerminalShell = .system
/// The font to use in terminal.
var font: TerminalFont = .i... | This needs to be formatted this way (see [code style](https://github.com/CodeEditApp/CodeEdit/wiki/Code-Style#parameter-alignment))
```suggestion
self.cursorStyle = try container.decodeIfPresent(
TerminalCursorStyle.self,
forKey: .cursorStyle
) ?? .steadyBl... | var useThemeBackground: Bool = true
/// If true, the terminal treats the `Option` key as the `Meta` key
var optionAsMeta: Bool = false
/// The selected shell to use.
var shell: TerminalShell = .system
/// The font to use in terminal.
var font: TerminalFont = .i... | @@ -37,6 +40,8 @@ extension AppPreferences {
self.optionAsMeta = try container.decodeIfPresent(Bool.self, forKey: .optionAsMeta) ?? false
self.shell = try container.decodeIfPresent(TerminalShell.self, forKey: .shell) ?? .system
self.font = try container.decodeIfPresent(TerminalFon... | CodeEdit/Features/AppPreferences/Model/Terminal/TerminalPreferences.swift | 26 | Swift | 0.786 | suggestion | 328 | 51 | 51 | false | Addressing features/bugs with the terminal | 1,117 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | bombardier200 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Model/Terminal/TerminalPreferences.swift
PR Title: Addressing features/bugs with the terminal
BEFORE CODE: var useThemeBackground: Bool = true
/// If true, the terminal treats the `Option` key as the `Meta` key
... | This needs to be formatted this way (see [code style](https://github.com/CodeEditApp/CodeEdit/wiki/Code-Style#parameter-alignment))
```suggestion
self.cursorStyle = try container.decodeIfPresent(
TerminalCursorStyle.self,
forKey: .cursorStyle
) ?? .steadyBl... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
self.cursorStyle = try container.decodeIfPresent(
TerminalCursorStyle.self,
forKey: .cursorStyle
) ?? .steadyBlock
}
}
/// The shell options.
/// - **bash**: uses the default bash shell
/// - **zsh**: uses the ZSH shell
/// - **system*... | Remember to add a new line here! | self.optionAsMeta = try container.decodeIfPresent(Bool.self, forKey: .optionAsMeta) ?? false
self.shell = try container.decodeIfPresent(TerminalShell.self, forKey: .shell) ?? .system
self.font = try container.decodeIfPresent(TerminalFont.self, forKey: .font) ?? .init()
se... | @@ -50,6 +57,14 @@ extension AppPreferences {
case system
}
+ enum TerminalCursorStyle: String, Codable {
+ case blinkBlock
+ case steadyBlock
+ case blinkUnderline
+ case steadyUnderline
+ case blinkingBar
+ case steadyBar
+ } | CodeEdit/Features/AppPreferences/Model/Terminal/TerminalPreferences.swift | 26 | Swift | 0.071 | suggestion | 32 | 48 | 50 | false | Addressing features/bugs with the terminal | 1,117 | CodeEditApp/CodeEdit | 18,361 | Swift | iggy890 | bombardier200 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Model/Terminal/TerminalPreferences.swift
PR Title: Addressing features/bugs with the terminal
BEFORE CODE: self.cursorStyle = try container.decodeIfPresent(
TerminalCursorStyle.self,
f... | Remember to add a new line here! | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
newSelectedMode.append(searchMode)
self.updateSelectedMode(searchMode, searchModel: &newSelectedMode)
self.selectedMode = newSelectedMode
case 1:
if let firstMode = selectedMode.first {
newSelectedMode.append(contentsOf: [firstMode, sea... | ```suggestion
private func updateSelectedMode(_ searchMode: SearchModeModel, searchModel: inout [SearchModeModel]) {
``` | newSelectedMode.append(searchMode)
self.updateSelectedMode(searchMode, searchModel: &newSelectedMode)
self.selectedMode = newSelectedMode
case 1:
if let firstMode = selectedMode.first {
newSelectedMode.append(contentsOf: [firstMode, sea... | @@ -59,7 +59,7 @@ struct FindNavigatorModeSelector: View {
}
}
- private func updateSelectedMode(_ searchMode: SearchModeModel, searchModel: inout [SearchModeModel]) {
+ private func updateSelectedMode(_ searchMode: SearchModeModel, searchModel: input [SearchModeModel]) { | CodeEdit/Features/NavigatorSidebar/FindNavigator/FindNavigatorModeSelector.swift | 26 | Swift | 0.714 | suggestion | 126 | 51 | 51 | false | chore(typos): fix typos | 1,121 | CodeEditApp/CodeEdit | 18,361 | Swift | stavares843 | stavares843 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorSidebar/FindNavigator/FindNavigatorModeSelector.swift
PR Title: chore(typos): fix typos
BEFORE CODE: newSelectedMode.append(searchMode)
self.updateSelectedMode(searchMode, searchModel: &newSelectedMode)... | ```suggestion
private func updateSelectedMode(_ searchMode: SearchModeModel, searchModel: inout [SearchModeModel]) {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var body: some View {
PreferencesContent {
PreferencesSection("Default Tab Width") {
HStack(spacing: 5) {
TextField("", value: $prefs.preferences.textEditing.defaultTabWidth, formatter: tabWidthFormatter)
.multilineTextAlignment(.traili... | Consider moving `fontSizeSelector` here | private var fontSizeFormatter: NumberFormatter {
let formatter = NumberFormatter()
formatter.allowsFloats = false
formatter.minimum = 1
formatter.maximum = 288
return formatter
}
var body: some View {
PreferencesContent {
PreferencesSection("Defa... | @@ -53,6 +62,9 @@ struct TextEditingPreferencesView: View {
PreferencesSection("Font") {
fontSelector | CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift | 26 | Swift | 0.286 | suggestion | 39 | 51 | 51 | false | Added setting to change font size, so can now change the default font… | 1,128 | CodeEditApp/CodeEdit | 18,361 | Swift | iggy890 | scrapp08 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift
PR Title: Added setting to change font size, so can now change the default font…
BEFORE CODE: var body: some View {
PreferencesContent {
Pr... | Consider moving `fontSizeSelector` here | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
name: $prefs.preferences.textEditing.font.name, size: $prefs.preferences.textEditing.font.size
)
}
}
private var autocompleteBraces: some View {
HStack {
Toggle("Autocomplete braces", isOn: $prefs.preferences.textEditing.autocompleteBraces)
Te... | This maximum font size is a bit large, but you don't need to change it, just a suggestion | @ViewBuilder
private var fontSelector: some View {
Picker("Font:", selection: $prefs.preferences.textEditing.font.customFont) {
Text("System Font")
.tag(false)
Text("Custom")
.tag(true)
}
.fixedSize()
if prefs.preferences.te... | @@ -83,6 +95,20 @@ struct TextEditingPreferencesView: View {
}
}
+ private var fontSizeSelector: some View {
+ HStack(spacing: 5) {
+ TextField("", value: $prefs.preferences.textEditing.font.size, formatter: fontSizeFormatter)
+ .multilineTextAlignment(.trailing)
+ ... | CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift | 26 | Swift | 0.286 | suggestion | 89 | 41 | 51 | false | Added setting to change font size, so can now change the default font… | 1,128 | CodeEditApp/CodeEdit | 18,361 | Swift | iggy890 | scrapp08 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift
PR Title: Added setting to change font size, so can now change the default font…
BEFORE CODE: name: $prefs.preferences.textEditing.font.name, size:... | This maximum font size is a bit large, but you don't need to change it, just a suggestion | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
func saveInspectorCollapsedState(isCollapsed: Bool) {
workspace.addToWorkspaceState(key: isInspectorCollapsedStateName, value: isCollapsed)
}
/// Quick fix for list tracking separator needing to be added again after closing,
/// then opening the inspector with a drag.
private func insertToo... | Maybe call this `hideInspectorToolbarBackground` to be more specific?
```suggestion
func hideInspectorToolbarBackground() {
``` | func saveInspectorCollapsedState(isCollapsed: Bool) {
workspace.addToWorkspaceState(key: isInspectorCollapsedStateName, value: isCollapsed)
}
/// Quick fix for list tracking separator needing to be added again after closing,
/// then opening the inspector with a drag.
private func insertToo... | @@ -163,4 +164,15 @@ final class CodeEditSplitViewController: NSSplitViewController {
}
view.window?.toolbar?.removeItem(at: index)
}
+
+ func fixInspectorToolbarBackground() { | CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift | 26 | Swift | 0.714 | suggestion | 134 | 37 | 37 | false | Fix for background color of toolbar in inspector | 1,155 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift
PR Title: Fix for background color of toolbar in inspector
BEFORE CODE: func saveInspectorCollapsedState(isCollapsed: Bool) {
workspace.addToWorkspaceState(key: isInspectorCol... | Maybe call this `hideInspectorToolbarBackground` to be more specific?
```suggestion
func hideInspectorToolbarBackground() {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
override func viewWillAppear() {
super.viewWillAppear()
viewIsReady = false
let width = workspace.getFromWorkspaceState(key: self.widthStateName) as? CGFloat
splitView.setPosition(width ?? .snapWidth, ofDividerAt: .zero)
setWidthFromState = true
if let firstSplitVie... | Maybe call this `hideInspectorToolbarBackground` to be more specific?
```suggestion
hideInspectorToolbarBackground()
``` | override func viewWillAppear() {
super.viewWillAppear()
viewIsReady = false
let width = workspace.getFromWorkspaceState(key: self.widthStateName) as? CGFloat
splitView.setPosition(width ?? .snapWidth, ofDividerAt: .zero)
setWidthFromState = true
if let firstSplitVie... | @@ -85,6 +85,7 @@ final class CodeEditSplitViewController: NSSplitViewController {
override func viewDidAppear() {
viewIsReady = true
+ fixInspectorToolbarBackground() | CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift | 26 | Swift | 0.714 | suggestion | 131 | 51 | 51 | false | Fix for background color of toolbar in inspector | 1,155 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift
PR Title: Fix for background color of toolbar in inspector
BEFORE CODE: override func viewWillAppear() {
super.viewWillAppear()
viewIsReady = false
let width ... | Maybe call this `hideInspectorToolbarBackground` to be more specific?
```suggestion
hideInspectorToolbarBackground()
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// ViewCommands.swift
// CodeEdit
//
// Created by Wouter Hennen on 13/03/2023.
//
import SwiftUI
struct ViewCommands: Commands {
var body: some Commands {
CommandGroup(after: .toolbar) {
Button("Show Command Palette") {
NSApp.sendAction(#selector(CodeEditWindowController... | If possible, make this an `@ObservedObject` | //
// ViewCommands.swift
// CodeEdit
//
// Created by Wouter Hennen on 13/03/2023.
//
import SwiftUI
struct ViewCommands: Commands {
private var prefs: AppPreferencesModel = .shared
var body: some Commands {
CommandGroup(after: .toolbar) {
Button("Show Command Palette") {
... | @@ -8,16 +8,31 @@
import SwiftUI
struct ViewCommands: Commands {
+ private var prefs: AppPreferencesModel = .shared | CodeEdit/Features/WindowCommands/ViewCommands.swift | 11 | Swift | 0.214 | suggestion | 43 | 24 | 36 | false | Add text zoom shortcut | 1,191 | CodeEditApp/CodeEdit | 18,361 | Swift | Wouter01 | luah5 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/ViewCommands.swift
PR Title: Add text zoom shortcut
BEFORE CODE: //
// ViewCommands.swift
// CodeEdit
//
// Created by Wouter Hennen on 13/03/2023.
//
import SwiftUI
struct ViewCommands: Commands {
var body: some Comman... | If possible, make this an `@ObservedObject` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
override func openDocument(
withContentsOf url: URL,
display displayDocument: Bool,
completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void
) {
super.noteNewRecentDocumentURL(url)
super.openDocument(withContentsOf: url, display: displayDocument) { document, docu... | Maybe use a `switch case` statement instead the `if-else-if` |
override func openDocument(
withContentsOf url: URL,
display displayDocument: Bool,
completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void
) {
super.noteNewRecentDocumentURL(url)
super.openDocument(withContentsOf: url, display: displayDocument) { document, docu... | @@ -76,6 +78,16 @@ final class CodeEditDocumentController: NSDocumentController {
override func removeDocument(_ document: NSDocument) {
super.removeDocument(document)
+
+ if CodeEditDocumentController.shared.documents.isEmpty {
+ if prefs.preferences.general.reopenWindowAfterWorkspace... | CodeEdit/Features/Documents/Controllers/CodeEditDocumentController.swift | 26 | Swift | 0.429 | suggestion | 60 | 51 | 51 | false | Add setting to determine what happens after closing the last open workspace | 1,194 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | luah5 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditDocumentController.swift
PR Title: Add setting to determine what happens after closing the last open workspace
BEFORE CODE:
override func openDocument(
withContentsOf url: URL,
display display... | Maybe use a `switch case` statement instead the `if-else-if` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.preview")
private let item: CEWorkspaceFile
@ObservedObject
var document: CodeFileDocument
init(
item: CEWorkspaceFile
) {
self.item = item
l... | Besides images, are there other types of files that can be previewed using `OtherFileView`? |
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.preview")
private let item: CEWorkspaceFile
@ObservedObject
var document: CodeFileDocument
init(
item: CEWorkspaceFile
) {
self.item = item
l... | @@ -28,6 +28,12 @@ struct QuickOpenPreviewView: View {
}
var body: some View {
- CodeFileView(codeFile: document, isEditable: false)
+ if document.fileURL != nil {
+ if document.fileURL!.isImage() { | CodeEdit/Features/QuickOpen/Views/QuickOpenPreviewView.swift | 26 | Swift | 0.5 | question | 91 | 34 | 51 | false | Quicklook Previews in Open Quickly overlay | 1,266 | CodeEditApp/CodeEdit | 18,361 | Swift | RayZhao1998 | luah5 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/QuickOpen/Views/QuickOpenPreviewView.swift
PR Title: Quicklook Previews in Open Quickly overlay
BEFORE CODE:
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.p... | Besides images, are there other types of files that can be previewed using `OtherFileView`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.preview")
private let item: CEWorkspaceFile
@ObservedObject
var document: CodeFileDocument
init(
item: CEWorkspaceFile
) {
self.item = item
... | You can move `if let` to here.
```suggestion
if let url = document.fileUrl {
``` | //
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.preview")
private let item: CEWorkspaceFile
@ObservedObject
var document: CodeFileDocument
init(
item: CEWorkspaceFile
) {
self.item = item
... | @@ -28,6 +28,33 @@ struct QuickOpenPreviewView: View {
}
var body: some View {
- CodeFileView(codeFile: document, isEditable: false)
+ if document.fileURL != nil { | CodeEdit/Features/QuickOpen/Views/QuickOpenPreviewView.swift | 26 | Swift | 0.643 | suggestion | 91 | 51 | 51 | false | Quicklook Previews in Open Quickly overlay | 1,266 | CodeEditApp/CodeEdit | 18,361 | Swift | RayZhao1998 | luah5 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/QuickOpen/Views/QuickOpenPreviewView.swift
PR Title: Quicklook Previews in Open Quickly overlay
BEFORE CODE: //
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpe... | You can move `if let` to here.
```suggestion
if let url = document.fileUrl {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
format: .number
)
}
private var defaultTabWidth: some View {
HStack(alignment: .top) {
Stepper(
"Default Tab Width",
value: Binding<Double>(
get: { Double(textEditing.defaultTabWidth) },
set: { textE... | It would be great if this range was a little bigger. I think from 0.5 to 2.0 would be good. | format: .number
)
}
private var defaultTabWidth: some View {
HStack(alignment: .top) {
Stepper(
"Default Tab Width",
value: Binding<Double>(
get: { Double(textEditing.defaultTabWidth) },
set: { textE... | @@ -90,4 +91,14 @@ private extension TextEditingSettingsView {
.foregroundColor(.secondary)
}
}
+
+ private var letterSpacing: some View {
+ Stepper(
+ "Letter Spacing",
+ value: $textEditing.letterSpacing,
+ in: 1.0...2.0, | CodeEdit/Features/Settings/Pages/TextEditingSettings/TextEditingSettingsView.swift | 26 | Swift | 0.214 | suggestion | 91 | 32 | 32 | false | Add setting for letter spacing | 1,269 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | luah5 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/TextEditingSettings/TextEditingSettingsView.swift
PR Title: Add setting for letter spacing
BEFORE CODE: format: .number
)
}
private var defaultTabWidth: some View {
HStack(alignment: .top) {
... | It would be great if this range was a little bigger. I think from 0.5 to 2.0 would be good. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
extension Color {
/// Initializes a `Color` from a HEX String (e.g.: `#1D2E3F`) and an optional alpha value.
/// - Parameters:
/// - hex: A String of a HEX representation of a color (format: `#1D2E3F`)
/// - alpha: A Double indicating the alpha value from `0.0` to `1.0`
init(hex: String, alpha... | Why the removal of the comment? |
extension Color {
/// Initializes a `Color` from a HEX String (e.g.: `#1D2E3F`) and an optional alpha value.
/// - Parameters:
/// - hex: A String of a HEX representation of a color (format: `#1D2E3F`)
/// - alpha: A Double indicating the alpha value from `0.0` to `1.0`
init(hex: String, alpha... | @@ -31,7 +31,6 @@ extension Color {
self.init(.sRGB, red: Double(red) / 255, green: Double(green) / 255, blue: Double(blue) / 255, opacity: alpha)
}
- /// Returns an Int representing the `Color` in hex format (e.g.: 0x112233) | CodeEdit/Utils/Extensions/Color/Color+HEX.swift | 26 | Swift | 0.071 | question | 31 | 51 | 51 | false | Fix Settings color picker | 1,277 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | defaultdino | Review this pull request change.
Language: Swift
File: CodeEdit/Utils/Extensions/Color/Color+HEX.swift
PR Title: Fix Settings color picker
BEFORE CODE:
extension Color {
/// Initializes a `Color` from a HEX String (e.g.: `#1D2E3F`) and an optional alpha value.
/// - Parameters:
/// - hex: A String o... | Why the removal of the comment? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@IBAction func openFeedback(_ sender: Any) {
if tryFocusWindow(of: FeedbackView.self) { return }
FeedbackView().showWindow()
}
@IBAction private func checkForUpdates(_ sender: Any) {
updater.checkForUpdates()
}
/// Tries to focus a window with specified view content type.... | ```suggestion
suiteName: "app.codeedit.CodeEdit.shared"
``` |
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
false
}
// MARK: - Open windows
@IBAction private func openWelcome(_ sender: Any) {
NSApp.openWindow(.welcome)
}
@IBAction private func openAbout(_ sender: Any) {
NSApp.openWindow(... | @@ -168,7 +168,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
// MARK: - Open With CodeEdit (Extension) functions
private func checkForFilesToOpen() {
guard let defaults = UserDefaults.init(
- suiteName: "austincondiff.CodeEdit.shared"
+ suiteN... | CodeEdit/AppDelegate.swift | 26 | Swift | 0.571 | suggestion | 73 | 51 | 51 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/AppDelegate.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE:
@IBAction func openFeedback(_ sender: Any) {
if tryFocusWindow(of: FeedbackView.self) { return }
FeedbackView().showWindow()
}
@IB... | ```suggestion
suiteName: "app.codeedit.CodeEdit.shared"
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// QuickOpenState.swift
// CodeEditModules/QuickOpen
//
// Created by Marco Carnevali on 05/04/22.
//
import Combine
import Foundation
final class QuickOpenViewModel: ObservableObject {
@Published
var openQuicklyQuery: String = ""
@Published
var openQuicklyFiles: [CEWorkspaceFile] = []
@P... | ```suggestion
private let queue = DispatchQueue(label: "app.codeedit.CodeEdit.quickOpen.searchFiles")
``` | //
// QuickOpenState.swift
// CodeEditModules/QuickOpen
//
// Created by Marco Carnevali on 05/04/22.
//
import Combine
import Foundation
final class QuickOpenViewModel: ObservableObject {
@Published
var openQuicklyQuery: String = ""
@Published
var openQuicklyFiles: [CEWorkspaceFile] = []
@P... | @@ -21,7 +21,7 @@ final class QuickOpenViewModel: ObservableObject {
let fileURL: URL
- private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.searchFiles")
+ private let queue = DispatchQueue(label: "com.codeedit.CodeEdit.quickOpen.searchFiles") | CodeEdit/Features/QuickOpen/ViewModels/QuickOpenViewModel.swift | 24 | Swift | 0.714 | suggestion | 111 | 49 | 49 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/QuickOpen/ViewModels/QuickOpenViewModel.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: //
// QuickOpenState.swift
// CodeEditModules/QuickOpen
//
// Created by Marco Carnevali on 05/04/22.
//
import Combine
... | ```suggestion
private let queue = DispatchQueue(label: "app.codeedit.CodeEdit.quickOpen.searchFiles")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// QuickOpenPreviewView.swift
// CodeEditModules/QuickOpen
//
// Created by Pavel Kasila on 20.03.22.
//
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "com.codeedit.CodeEdit.quickOpen.preview")
private let item: CEWorkspaceFile
@ObservedObject
var ... | ```suggestion
private let queue = DispatchQueue(label: "app.codeedit.CodeEdit.quickOpen.preview")
``` | //
// QuickOpenPreviewView.swift
// CodeEditModules/QuickOpen
//
// Created by Pavel Kasila on 20.03.22.
//
import SwiftUI
struct QuickOpenPreviewView: View {
private let queue = DispatchQueue(label: "app.codeedit.CodeEdit.quickOpen.preview")
private let item: CEWorkspaceFile
@ObservedObject
var ... | @@ -9,7 +9,7 @@ import SwiftUI
struct QuickOpenPreviewView: View {
- private let queue = DispatchQueue(label: "austincondiff.CodeEdit.quickOpen.preview")
+ private let queue = DispatchQueue(label: "com.codeedit.CodeEdit.quickOpen.preview") | CodeEdit/Features/QuickOpen/Views/QuickOpenPreviewView.swift | 12 | Swift | 0.714 | suggestion | 107 | 37 | 37 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/QuickOpen/Views/QuickOpenPreviewView.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: //
// QuickOpenPreviewView.swift
// CodeEditModules/QuickOpen
//
// Created by Pavel Kasila on 20.03.22.
//
import SwiftUI
... | ```suggestion
private let queue = DispatchQueue(label: "app.codeedit.CodeEdit.quickOpen.preview")
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// GeneralSettingsView.swift
// CodeEdit
//
// Created by Austin Condiff on 4/1/23.
//
import SwiftUI
/// A view that implements the `General` settings page
struct GeneralSettingsView: View {
private let inputWidth: Double = 160
private let textEditorWidth: Double = 220
private let textEditorHeight:... | ```suggestion
suiteName: "app.codeedit.CodeEdit.shared"
``` | //
// GeneralSettingsView.swift
// CodeEdit
//
// Created by Austin Condiff on 4/1/23.
//
import SwiftUI
/// A view that implements the `General` settings page
struct GeneralSettingsView: View {
private let inputWidth: Double = 160
private let textEditorWidth: Double = 220
private let textEditorHeight:... | @@ -22,7 +22,7 @@ struct GeneralSettingsView: View {
init() {
guard let defaults = UserDefaults.init(
- suiteName: "austincondiff.CodeEdit.shared"
+ suiteName: "com.codeedit.CodeEdit.shared" | CodeEdit/Features/Settings/Pages/GeneralSettings/GeneralSettingsView.swift | 25 | Swift | 0.571 | suggestion | 73 | 50 | 50 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/GeneralSettings/GeneralSettingsView.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: //
// GeneralSettingsView.swift
// CodeEdit
//
// Created by Austin Condiff on 4/1/23.
//
import SwiftUI
///... | ```suggestion
suiteName: "app.codeedit.CodeEdit.shared"
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
"with administrator privileges"
]
let cmdStr = cmd.joined(separator: " ")
let task = Process()
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
task.arguments = ["-c", cmdStr]
task.executableURL = URL(fileURLWithPath: "... | ```suggestion
suiteName: "app.codeedit.CodeEdit.shared"
``` | "with administrator privileges"
]
let cmdStr = cmd.joined(separator: " ")
let task = Process()
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
task.arguments = ["-c", cmdStr]
task.executableURL = URL(fileURLWithPath: "... | @@ -351,7 +351,7 @@ private extension GeneralSettingsView {
Toggle("Show “Open With CodeEdit” option in Finder", isOn: $openInCodeEdit)
.onChange(of: openInCodeEdit) { newValue in
guard let defaults = UserDefaults.init(
- suiteName: "austincondiff.CodeEdit.share... | CodeEdit/Features/Settings/Pages/GeneralSettings/GeneralSettingsView.swift | 26 | Swift | 0.571 | suggestion | 81 | 51 | 51 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/GeneralSettings/GeneralSettingsView.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: "with administrator privileges"
]
let cmdStr = cmd.joined(separator: " ")
l... | ```suggestion
suiteName: "app.codeedit.CodeEdit.shared"
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Add finder sync
let finderSync = FIFinderSyncController.default()
if let mountedVolumes = FileManager.default.mountedVolumeURLs(
includingResourceValuesForKeys: nil,
options: [.skipHiddenVolumes]
) {
finderSync.directoryURLs = Set<URL>(mountedVolume... | ```suggestion
let defaults = UserDefaults.init(suiteName: "app.codeedit.CodeEdit.shared") else {
``` | // Add finder sync
let finderSync = FIFinderSyncController.default()
if let mountedVolumes = FileManager.default.mountedVolumeURLs(
includingResourceValuesForKeys: nil,
options: [.skipHiddenVolumes]
) {
finderSync.directoryURLs = Set<URL>(mountedVolume... | @@ -45,7 +45,7 @@ class CEOpenWith: FIFinderSync {
/// - Parameter sender: sender
@objc func openInCodeEditAction(_ sender: AnyObject?) {
guard let items = FIFinderSyncController.default().selectedItemURLs(),
- let defaults = UserDefaults.init(suiteName: "austincondiff.CodeEdit.shared") ... | OpenWithCodeEdit/FinderSync.swift | 26 | Swift | 0.786 | suggestion | 116 | 51 | 51 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: OpenWithCodeEdit/FinderSync.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: // Add finder sync
let finderSync = FIFinderSyncController.default()
if let mountedVolumes = FileManager.default.mountedVolumeURLs... | ```suggestion
let defaults = UserDefaults.init(suiteName: "app.codeedit.CodeEdit.shared") else {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
object: nil,
queue: .main
) { notification in
if let volumeURL = notification.userInfo?[NSWorkspace.volumeURLUserInfoKey] as? URL {
finderSync.directoryURLs.insert(volumeURL)
}
}
}
/// Open in CodeEdit (menu) action
/// - Param... | ```suggestion
withBundleIdentifier: "app.codeedit.CodeEdit"
``` | object: nil,
queue: .main
) { notification in
if let volumeURL = notification.userInfo?[NSWorkspace.volumeURLUserInfoKey] as? URL {
finderSync.directoryURLs.insert(volumeURL)
}
}
}
/// Open in CodeEdit (menu) action
/// - Param... | @@ -57,7 +57,7 @@ class CEOpenWith: FIFinderSync {
}
guard let codeEdit = NSWorkspace.shared.urlForApplication(
- withBundleIdentifier: "austincondiff.CodeEdit"
+ withBundleIdentifier: "com.codeedit.CodeEdit" | OpenWithCodeEdit/FinderSync.swift | 26 | Swift | 0.571 | suggestion | 77 | 51 | 51 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: OpenWithCodeEdit/FinderSync.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: object: nil,
queue: .main
) { notification in
if let volumeURL = notification.userInfo?[NSWorkspace.volumeURLU... | ```suggestion
withBundleIdentifier: "app.codeedit.CodeEdit"
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
// Make values compatible to ArrayLiteralElement
var files = ""
for obj in items {
files.append("\(obj.path);")
}
guard let codeEdit = NSWorkspace.shared.urlForApplication(
withBundleIdentifier: "com.codeedit.CodeEdit"
) else { return ... | ```suggestion
guard let defaults = UserDefaults.init(suiteName: "app.codeedit.CodeEdit.shared") else {
``` | }
// Make values compatible to ArrayLiteralElement
var files = ""
for obj in items {
files.append("\(obj.path);")
}
guard let codeEdit = NSWorkspace.shared.urlForApplication(
withBundleIdentifier: "app.codeedit.CodeEdit"
) else { return ... | @@ -72,7 +72,7 @@ class CEOpenWith: FIFinderSync {
// MARK: - Menu and toolbar item support
override func menu(for menuKind: FIMenuKind) -> NSMenu {
- guard let defaults = UserDefaults.init(suiteName: "austincondiff.CodeEdit.shared") else {
+ guard let defaults = UserDefaults.init(suiteName: "... | OpenWithCodeEdit/FinderSync.swift | 26 | Swift | 0.786 | suggestion | 116 | 50 | 50 | false | rename bundle identifier to app.codeedit.CodeEdit | 1,287 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | Wouter01 | Review this pull request change.
Language: Swift
File: OpenWithCodeEdit/FinderSync.swift
PR Title: rename bundle identifier to app.codeedit.CodeEdit
BEFORE CODE: }
// Make values compatible to ArrayLiteralElement
var files = ""
for obj in items {
files.append("\(obj.pat... | ```suggestion
guard let defaults = UserDefaults.init(suiteName: "app.codeedit.CodeEdit.shared") else {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@StateObject
var prefs: Settings = .shared
typealias NSViewControllerType = ProjectNavigatorViewController
func makeNSViewController(context: Context) -> ProjectNavigatorViewController {
let controller = ProjectNavigatorViewController()
controller.workspace = workspace
controll... | ```suggestion
/// if the window becomes active from background, it will restore the selection to outline view.
``` | @StateObject
var prefs: Settings = .shared
typealias NSViewControllerType = ProjectNavigatorViewController
func makeNSViewController(context: Context) -> ProjectNavigatorViewController {
let controller = ProjectNavigatorViewController()
controller.workspace = workspace
controll... | @@ -42,7 +39,8 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable {
nsViewController.fileExtensionsVisibility = prefs.preferences.general.fileExtensionsVisibility
nsViewController.shownFileExtensions = prefs.preferences.general.shownFileExtensions
nsViewController.hiddenFile... | CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift | 26 | Swift | 0.714 | suggestion | 124 | 51 | 51 | false | Sync file selection state between tab group and outline view | 1,296 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | dscyrescotti | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift
PR Title: Sync file selection state between tab group and outline view
BEFORE CODE: @StateObject
var prefs: Settings = .shared
typealias NSViewControl... | ```suggestion
/// if the window becomes active from background, it will restore the selection to outline view.
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
self.workspace = workspace
super.init()
workspace.listenerModel.$highlightedFileItem
.sink(receiveValue: { [weak self] fileItem in
guard let fileItem else {
return
}
self?.controller?... | This is done automatically and can be removed | //
// OutlineView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 05.04.22.
//
import SwiftUI
import Combine
/// Wraps an ``OutlineViewController`` inside a `NSViewControllerRepresentable`
struct ProjectNavigatorOutlineView: NSViewControllerRepresentable {
@EnvironmentObject
var workspace: WorkspaceDo... | @@ -55,21 +53,28 @@ struct ProjectNavigatorOutlineView: NSViewControllerRepresentable {
self.workspace = workspace
super.init()
- listener = workspace.listenerModel.$highlightedFileItem
+ workspace.listenerModel.$highlightedFileItem
.sink(receiveValue: ... | CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift | 26 | Swift | 0.143 | suggestion | 45 | 29 | 77 | false | Sync file selection state between tab group and outline view | 1,296 | CodeEditApp/CodeEdit | 18,361 | Swift | Wouter01 | dscyrescotti | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorOutlineView.swift
PR Title: Sync file selection state between tab group and outline view
BEFORE CODE: self.workspace = workspace
super.init()
wo... | This is done automatically and can be removed | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
column.title = "Cell"
outlineView.addTableColumn(column)
outlineView.setDraggingSourceOperationMask(.move, forLocal: false)
outlineView.registerForDraggedTypes([.fileURL])
scrollView.documentView = outlineView
scrollView.contentView.automaticallyAdjustsContentInsets = f... | Everything works great except this has one small bug. When `Settings.shared.preferences.general.revealFileOnFocusChange` is set to `false` the file isn't revealed. This is because `select(by id: TabBarItemID, from collection: [CEWorkspaceFile])` won't reveal the file if that setting is false.
To fix this is really s... | column.title = "Cell"
outlineView.addTableColumn(column)
outlineView.setDraggingSourceOperationMask(.move, forLocal: false)
outlineView.registerForDraggedTypes([.fileURL])
scrollView.documentView = outlineView
scrollView.contentView.automaticallyAdjustsContentInsets = f... | @@ -86,6 +86,10 @@ final class ProjectNavigatorViewController: NSViewController {
fatalError()
}
+ @objc func revealFile(_ sender: Any) { | CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift | 26 | Swift | 0.786 | bug | 741 | 51 | 51 | false | Reveal file in the middle of Project Navigator | 1,352 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | dscyrescotti | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorSidebar/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift
PR Title: Reveal file in the middle of Project Navigator
BEFORE CODE: column.title = "Cell"
outlineView.addTableColumn(column)
outlineV... | Everything works great except this has one small bug. When `Settings.shared.preferences.general.revealFileOnFocusChange` is set to `false` the file isn't revealed. This is because `select(by id: TabBarItemID, from collection: [CEWorkspaceFile])` won't reveal the file if that setting is false.
To fix this is really s... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// NavigateCommands.swift
// CodeEdit
//
// Created by Wouter Hennen on 13/03/2023.
//
import SwiftUI
struct NavigateCommands: Commands {
var body: some Commands {
CommandMenu("Navigate") {
Group {
Button("Reveal in Project Navigator") {
NSApp.sendActi... | If you could enable this command by adding `.disabled` to the other buttons in NavigateCommands that'd be great. They're only disabled because there was no implementation. | //
// NavigateCommands.swift
// CodeEdit
//
// Created by Wouter Hennen on 13/03/2023.
//
import SwiftUI
struct NavigateCommands: Commands {
@FocusedObject var tabGroup: TabGroupData?
var body: some Commands {
CommandMenu("Navigate") {
Group {
Button("Reveal in Project... | @@ -12,7 +12,7 @@ struct NavigateCommands: Commands {
CommandMenu("Navigate") {
Group {
Button("Reveal in Project Navigator") {
-
+ NSApp.sendAction(#selector(ProjectNavigatorViewController.revealFile(_:)), to: nil, from: nil) | CodeEdit/Features/WindowCommands/NavigateCommands.swift | 18 | Swift | 0.571 | suggestion | 171 | 43 | 43 | false | Reveal file in the middle of Project Navigator | 1,352 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | dscyrescotti | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/NavigateCommands.swift
PR Title: Reveal file in the middle of Project Navigator
BEFORE CODE: //
// NavigateCommands.swift
// CodeEdit
//
// Created by Wouter Hennen on 13/03/2023.
//
import SwiftUI
struct NavigateCommands: ... | If you could enable this command by adding `.disabled` to the other buttons in NavigateCommands that'd be great. They're only disabled because there was no implementation. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Button("Close Window") {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
}
.keyboardShortcut("w", modifiers: [.shift, .command])
Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" ... | Where would functions like this be stored? I ultimately agree with your proposal, however if we stored everything as individual commands, there would be a lot of random files and functions floating around. If we were to do this we would need to come up with a way to neatly organize them all. This might coincide with ho... | }
.keyboardShortcut("w", modifiers: [.shift, .command])
Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" command and adjust accordingly
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
... | @@ -72,4 +75,79 @@ struct FileCommands: Commands {
.keyboardShortcut("s")
}
}
+
+ // TODO: This logic needs to become a command, not a function bound to the MenuBar | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.429 | question | 344 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE:
Button("Close Window") {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
... | Where would functions like this be stored? I ultimately agree with your proposal, however if we stored everything as individual commands, there would be a lot of random files and functions floating around. If we were to do this we would need to come up with a way to neatly organize them all. This might coincide with ho... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
)
toolbarItem.view = view
return toolbarItem
default:
return NSToolbarItem(itemIdentifier: itemIdentifier)
}
}
private func getCurrentWorkspaceFile() -> CEWorkspaceFile? {
workspace?.editorManager.activeEditor.selectedTa... | Would it make sense to move all functions under 220 to a new file? | )
)
toolbarItem.view = view
return toolbarItem
default:
return NSToolbarItem(itemIdentifier: itemIdentifier)
}
}
private func getCurrentWorkspaceFile() -> CEWorkspaceFile? {
return workspace?.editorManager.activeEditor.sel... | @@ -218,13 +219,31 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
}
}
- private func getSelectedCodeFile() -> CodeFileDocument? {
- workspace?.editorManager.activeEditor.selectedTab?.fileDocument
+ private func getCurrentWorkspaceFile() -> CEWorkspaceFil... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.286 | question | 66 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE: )
)
toolbarItem.view = view
return toolbarItem
... | Would it make sense to move all functions under 220 to a new file? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Opens a custom NSAlert for saving a draft file
///
/// (A draft file is a file that has been created
/// but is not saved anywhere outside the CodeEdit 'Application Support' folder)
/// - Returns: A boolean that tells whether the tab can be closed
private func openDraftSavePanel(for file: C... | ```suggestion
/// - Parameters:
/// - file: The draft file to be saved.
/// - Returns: A boolean that tells whether the tab can be closed
``` |
return shouldClose.pointee
}
if file.isScratch {
let fileManager = FileManager.default
if fileManager.fileExists(atPath: file.url.path) {
do {
try fileManager.removeItem(at: file.url)
} catch {
... | @@ -245,9 +249,55 @@ final class Editor: ObservableObject, Identifiable {
return shouldClose.pointee
}
+ if item.isScratch {
+ let fileManager = FileManager.default
+
+ if fileManager.fileExists(atPath: item.url.path) {
+ do {
+ try ... | CodeEdit/Features/Editor/Models/Editor.swift | 26 | Swift | 0.714 | suggestion | 161 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/Models/Editor.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE:
/// Opens a custom NSAlert for saving a draft file
///
/// (A draft file is a file that has been created
/// but ... | ```suggestion
/// - Parameters:
/// - file: The draft file to be saved.
/// - Returns: A boolean that tells whether the tab can be closed
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if fileManager.fileExists(atPath: file.url.path) {
do {
try fileManager.removeItem(at: file.url)
} catch {
fatalError(error.localizedDescription)
}
}
return true
}
return false
... | Is there a better way to deal with this error? | /// but is not saved anywhere outside the CodeEdit 'Application Support' folder)
/// - Parameters:
/// - file: The draft file to be sa
/// - Returns: A boolean that tells whether the tab can be closed
private func openDraftSavePanel(for file: CEWorkspaceFile) -> Bool {
guard let current... | @@ -245,9 +249,55 @@ final class Editor: ObservableObject, Identifiable {
return shouldClose.pointee
}
+ if item.isScratch {
+ let fileManager = FileManager.default
+
+ if fileManager.fileExists(atPath: item.url.path) {
+ do {
+ try ... | CodeEdit/Features/Editor/Models/Editor.swift | 26 | Swift | 0.286 | question | 46 | 43 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/Models/Editor.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE:
if fileManager.fileExists(atPath: file.url.path) {
do {
try fileManager.removeIte... | Is there a better way to deal with this error? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Button("Close Window") {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
}
.keyboardShortcut("w", modifiers: [.shift, .command])
Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" ... | Could you please create an issue for this? Otherwise, it might get buried under the pile of TODO comments. | }
.keyboardShortcut("w", modifiers: [.shift, .command])
Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" command and adjust accordingly
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
... | @@ -72,4 +75,79 @@ struct FileCommands: Commands {
.keyboardShortcut("s")
}
}
+
+ // TODO: This logic needs to become a command, not a function bound to the MenuBar | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.429 | question | 107 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE:
Button("Close Window") {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
... | Could you please create an issue for this? Otherwise, it might get buried under the pile of TODO comments. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Button("Close Window") {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
}
.keyboardShortcut("w", modifiers: [.shift, .command])
Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" c... | ```suggestion
guard let windowController = getCurrentCEWindowController(),
let workspaceName = windowController.workspace?.workspaceFileManager?.folderUrl.lastPathComponent else {
return
}
``` | .keyboardShortcut("w", modifiers: [.shift, .command])
Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" command and adjust accordingly
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
}
... | @@ -72,4 +75,79 @@ struct FileCommands: Commands {
.keyboardShortcut("s")
}
}
+
+ // TODO: This logic needs to become a command, not a function bound to the MenuBar
+ private func createNewFile() {
+ guard let windowController = getCurrentCEWindowController() else { return } | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.786 | suggestion | 235 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE: Button("Close Window") {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
... | ```suggestion
guard let windowController = getCurrentCEWindowController(),
let workspaceName = windowController.workspace?.workspaceFileManager?.folderUrl.lastPathComponent else {
return
}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
.keyboardShortcut("w", modifiers: [.control, .option, .command])
if let utilityAreaViewModel {
Button("Close Terminal") {
utilityAreaViewModel.removeTerminals(utilityAreaViewModel.selectedTerminals)
}
.keyboardShortcut(.delete)... | ```suggestion
let hashedWorkspaceName = (workspaceName ?? "no-workspace").md5()
``` | Button("Close Terminal") {
utilityAreaViewModel.removeTerminals(utilityAreaViewModel.selectedTerminals)
}
.keyboardShortcut(.delete)
}
Divider()
Button("Save") {
NSApp.sendAction(#selector(CodeEditW... | @@ -72,4 +75,79 @@ struct FileCommands: Commands {
.keyboardShortcut("s")
}
}
+
+ // TODO: This logic needs to become a command, not a function bound to the MenuBar
+ private func createNewFile() {
+ guard let windowController = getCurrentCEWindowController() else { return }
+
+ ... | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.571 | suggestion | 92 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE: .keyboardShortcut("w", modifiers: [.control, .option, .command])
if let utilityAreaViewModel {
... | ```suggestion
let hashedWorkspaceName = (workspaceName ?? "no-workspace").md5()
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let fileManager = FileManager.default
let workspaceName = windowController.workspace?.workspaceFileManager?.folderUrl.lastPathComponent
var hashedWorkspaceName = "no-workspace".md5()
if let workspaceName {
hashedWorkspaceName = workspaceName.md5()
}
let tem... | ```suggestion
alert.informativeText = "An error occurred: \(error.localizedDescription)"
``` | var hashedWorkspaceName = (workspaceName ?? "no-workspace").md5()
let tempStorageDir = CodeEditApp.applicationSupportURL
.appendingPathComponent("workspaces/\(hashedWorkspaceName)", isDirectory: true)
do {
try createDirectoryIfNotExists(atPath: tempStorageDir.path)
... | @@ -72,4 +75,79 @@ struct FileCommands: Commands {
.keyboardShortcut("s")
}
}
+
+ // TODO: This logic needs to become a command, not a function bound to the MenuBar
+ private func createNewFile() {
+ guard let windowController = getCurrentCEWindowController() else { return }
+
+ ... | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.857 | suggestion | 106 | 51 | 51 | false | New files should not be saved to location until manually saved | 1,366 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | matthijseikelenboom | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: New files should not be saved to location until manually saved
BEFORE CODE:
let fileManager = FileManager.default
let workspaceName = windowController.workspace?.workspaceFileManager... | ```suggestion
alert.informativeText = "An error occurred: \(error.localizedDescription)"
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var body: some Commands {
CommandGroup(replacing: .newItem) {
Group {
Button("New") {
NSDocumentController.shared.newDocument(nil)
}
.keyboardShortcut("n")
Button("Open...") {
NSDocumentContr... | We should keep this item in the menu. Instead of putting the button in TabBarItemView, leave it here. We should be able to call a function that closes the active tab that is in the editor split that is currently in focus. | var body: some Commands {
CommandGroup(replacing: .newItem) {
Group {
Button("New") {
NSDocumentController.shared.newDocument(nil)
}
.keyboardShortcut("n")
Button("Open...") {
NSDocumentContr... | @@ -36,13 +36,8 @@ struct FileCommands: Commands {
}
CommandGroup(replacing: .saveItem) {
- Button("Close Tab") { | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.5 | suggestion | 221 | 51 | 51 | false | Fixed close tab and close window shortcut | 1,381 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | FastestMolasses | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: Fixed close tab and close window shortcut
BEFORE CODE: var body: some Commands {
CommandGroup(replacing: .newItem) {
Group {
Button("New") {
... | We should keep this item in the menu. Instead of putting the button in TabBarItemView, leave it here. We should be able to call a function that closes the active tab that is in the editor split that is currently in focus. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Button("New") {
NSDocumentController.shared.newDocument(nil)
}
.keyboardShortcut("n")
Button("Open...") {
NSDocumentController.shared.openDocument(nil)
}
.keyboardShortcut("o")
... | This is not required as this is the default. | Button("New") {
NSDocumentController.shared.newDocument(nil)
}
.keyboardShortcut("n")
Button("Open...") {
NSDocumentController.shared.openDocument(nil)
}
.keyboardShortcut("o")
... | @@ -37,12 +37,12 @@ struct FileCommands: Commands {
CommandGroup(replacing: .saveItem) {
Button("Close Tab") {
- NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
+ NSApp.sendAction(#selector(CodeEditWindowController.closeCurrentTab(_:)), to: nil, from... | CodeEdit/Features/WindowCommands/FileCommands.swift | 26 | Swift | 0.071 | suggestion | 44 | 51 | 51 | false | Fixed close tab and close window shortcut | 1,381 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | FastestMolasses | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/FileCommands.swift
PR Title: Fixed close tab and close window shortcut
BEFORE CODE: Button("New") {
NSDocumentController.shared.newDocument(nil)
}
.keyboardShor... | This is not required as this is the default. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Update the last dragging location if there's enough offset
let currentLocationOnAxis = ((position == .top) ? value.location.x : value.location.y)
if draggingLastLocation == nil || abs(currentLocationOnAxis - draggingLastLocation!) >= 10 {
draggingLa... | There is a lot of duplicate code here, between `swapWithPreviousTab` and `swapWithNextTab`. The functions are also quite large. Can this be simplified? | direction: .next
)
// Update the last dragging location if there's enough offset
let currentLocationOnAxis = ((position == .top) ? value.location.x : value.location.y)
if draggingLastLocation == nil || abs(currentLocationOnAxis - dragg... | @@ -100,85 +108,167 @@ struct AreaTabBar<Tab: AreaTab>: View {
alignment: .center
)
.help(tab.title)
- // .onDrag {
- // if let index = icons.firstIndex(where: { $0.imageName == named }) {
- // ... | CodeEdit/Features/CodeEditUI/Views/AreaTabBar.swift | 26 | Swift | 0.5 | refactor | 151 | 51 | 51 | false | Keyboard shortcut to switch sidebar navigator tabs | 1,382 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | FastestMolasses | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CodeEditUI/Views/AreaTabBar.swift
PR Title: Keyboard shortcut to switch sidebar navigator tabs
BEFORE CODE: // Update the last dragging location if there's enough offset
let currentLocationOnAxis = ((position ==... | There is a lot of duplicate code here, between `swapWithPreviousTab` and `swapWithNextTab`. The functions are also quite large. Can this be simplified? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// WindowSplitView.swift
// CodeEdit
//
// Created by Wouter Hennen on 18/06/2023.
//
import SwiftUI
struct WindowSplitView: View {
@StateObject var workspace: WorkspaceDocument
@StateObject var navigatorViewModel = NavigatorSidebarViewModel()
@State var visibility: NavigationSplitViewVisibility = .... | Does this have to be created here, because it's just passed into `NavigatorSidebarView` and used nowhere else | //
// WindowSplitView.swift
// CodeEdit
//
// Created by Wouter Hennen on 18/06/2023.
//
import SwiftUI
struct WindowSplitView: View {
@StateObject var workspace: WorkspaceDocument
@State var visibility: NavigationSplitViewVisibility = .all
@State var showInspector = true
@State var window: NSWindo... | @@ -9,14 +9,15 @@ import SwiftUI
struct WindowSplitView: View {
@StateObject var workspace: WorkspaceDocument
+ @StateObject var navigatorViewModel = NavigatorSidebarViewModel() | CodeEdit/WindowSplitView.swift | 12 | Swift | 0.571 | suggestion | 109 | 37 | 37 | false | Keyboard shortcut to switch sidebar navigator tabs | 1,382 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | FastestMolasses | Review this pull request change.
Language: Swift
File: CodeEdit/WindowSplitView.swift
PR Title: Keyboard shortcut to switch sidebar navigator tabs
BEFORE CODE: //
// WindowSplitView.swift
// CodeEdit
//
// Created by Wouter Hennen on 18/06/2023.
//
import SwiftUI
struct WindowSplitView: View {
@StateObject... | Does this have to be created here, because it's just passed into `NavigatorSidebarView` and used nowhere else | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
name: "Quick Open",
title: "Quick Open",
id: "quick_open",
command: CommandClosureWrapper(closure: { self.openQuickly(self) })
)
CommandManager.shared.addCommand(
name: "Toggle Left Sidebar",
title: "Toggle Left Sidebar",
... | Here a `NavigatorSidebarViewModel` is also created, but just to pass it onto the `NavigatorSidebarView`. It's not used in other places in this class | name: "Quick Open",
title: "Quick Open",
id: "quick_open",
command: CommandClosureWrapper(closure: { self.openQuickly(self) })
)
CommandManager.shared.addCommand(
name: "Toggle Navigator",
title: "Toggle Navigator",
id:... | @@ -79,13 +80,18 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
let feedbackPerformer = NSHapticFeedbackManager.defaultPerformer
let splitVC = CodeEditSplitViewController(workspace: workspace, feedbackPerformer: feedbackPerformer)
- let navigatorView = Set... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 148 | 51 | 51 | false | Keyboard shortcut to switch sidebar navigator tabs | 1,382 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | FastestMolasses | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift
PR Title: Keyboard shortcut to switch sidebar navigator tabs
BEFORE CODE: name: "Quick Open",
title: "Quick Open",
id: "quick_open",
command: ... | Here a `NavigatorSidebarViewModel` is also created, but just to pass it onto the `NavigatorSidebarView`. It's not used in other places in this class | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// TrackableScrollView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
// Inspired by SwiftUITrackableScrollView by Natchanon A.
// https://github.com/maxnatchanon/trackable-scroll-view
import SwiftUI
private struct ScrollViewOffsetPreferenceKey: PreferenceKey {
typealias Value = [CGFloa... | `public` keywords are not necessary | //
// TrackableScrollView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
// Inspired by SwiftUITrackableScrollView by Natchanon A.
// https://github.com/maxnatchanon/trackable-scroll-view
import SwiftUI
private struct ScrollViewOffsetPreferenceKey: PreferenceKey {
typealias Value = [CGFloa... | CodeEdit/Features/CodeEditUI/Views/TrackableScrollView.swift | 1 | Swift | 0.214 | suggestion | 35 | 26 | 26 | false | Added shadows to tab bar when tabs overflow | 1,412 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CodeEditUI/Views/TrackableScrollView.swift
PR Title: Added shadows to tab bar when tabs overflow
BEFORE CODE: //
// TrackableScrollView.swift
// CodeEdit
//
// Created by Lukas Pistrol on 19.01.23.
//
// Inspired by SwiftUITrackableScroll... | `public` keywords are not necessary | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
//
// TabManager.swift
// CodeEdit
//
// Created by Wouter Hennen on 03/03/2023.
//
import Combine
import Foundation
import DequeModule
import OrderedCollections
class TabManager: ObservableObject {
/// Collection of all the tabgroups.
@Published var tabGroups: TabGroup
@Published var focusActive: Boo... | What does this variable mean? When naming a boolean its good practice to prefix it with "State of being verbs" like "is" | //
// TabManager.swift
// CodeEdit
//
// Created by Wouter Hennen on 03/03/2023.
//
import Combine
import Foundation
import DequeModule
import OrderedCollections
class TabManager: ObservableObject {
/// Collection of all the tabgroups.
@Published var tabGroups: TabGroup
@Published var isFocusingActive... | @@ -14,6 +14,8 @@ class TabManager: ObservableObject {
/// Collection of all the tabgroups.
@Published var tabGroups: TabGroup
+ @Published var focusActive: Bool | CodeEdit/Features/Tabs/Models/TabManager.swift | 17 | Swift | 0.357 | question | 120 | 42 | 42 | false | Added ability to focus a single editor | 1,414 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Tabs/Models/TabManager.swift
PR Title: Added ability to focus a single editor
BEFORE CODE: //
// TabManager.swift
// CodeEdit
//
// Created by Wouter Hennen on 03/03/2023.
//
import Combine
import Foundation
import DequeModule
import Order... | What does this variable mean? When naming a boolean its good practice to prefix it with "State of being verbs" like "is" | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
.font(.system(size: 12))
if !filter.isEmpty {
clearFilterButton
.padding(.trailing, 5)
}
}
.onChange(of: filter, perform: {
workspace.filter = $0
})
.padding(.v... | We want to prevent optionals as much as possible. In this case you could just return the workspace root URL, if nothing is selected in my opinion. | .font(.system(size: 12))
if !filter.isEmpty {
clearFilterButton
.padding(.trailing, 5)
}
}
.onChange(of: filter, perform: {
workspace.filter = $0
})
.padding(.v... | @@ -50,21 +52,56 @@ struct ProjectNavigatorToolbarBottom: View {
}
}
+ /// Retrieves the active tab URL from the underlying editor instance, if theres no
+ /// active tab, fallbacks to the workspace's root directory
+ private func activeTabURL() -> URL? { | CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift | 26 | Swift | 0.429 | suggestion | 146 | 51 | 51 | false | feat: creates file/directory in active path | 1,416 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift
PR Title: feat: creates file/directory in active path
BEFORE CODE: .font(.system(size: 12))
if !filter.isEmpty {
clearFi... | We want to prevent optionals as much as possible. In this case you could just return the workspace root URL, if nothing is selected in my opinion. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let fileURL = NSURL.fileURL(withPathComponents: pathComponents)! as URL
return fileURL
}
}
if let workspaceFileManager = workspace.workspaceFileManager {
let folderURL = workspaceFileManager.folderUrl
if let root = workspaceFileManage... | This won't necessary if `activeTablURL` doesn't return an optional |
let fileURL = NSURL.fileURL(withPathComponents: pathComponents)! as URL
return fileURL
}
}
return workspace.workspaceFileManager.unsafelyUnwrapped.folderUrl
}
private var addNewFileButton: some View {
Menu {
Button("Add File") {
... | @@ -50,21 +52,56 @@ struct ProjectNavigatorToolbarBottom: View {
}
}
+ /// Retrieves the active tab URL from the underlying editor instance, if theres no
+ /// active tab, fallbacks to the workspace's root directory
+ private func activeTabURL() -> URL? {
+ if let selectedTab = editorMan... | CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift | 26 | Swift | 0.357 | suggestion | 66 | 51 | 51 | false | feat: creates file/directory in active path | 1,416 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift
PR Title: feat: creates file/directory in active path
BEFORE CODE:
let fileURL = NSURL.fileURL(withPathComponents: pathComponents)! as URL
retu... | This won't necessary if `activeTablURL` doesn't return an optional | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Returns the extension of the file or an empty string if no extension is present.
var type: FileIcon.FileType { .init(rawValue: url.pathExtension) ?? .txt }
/// Returns the URL of the ``CEWorkspaceFile``
var url: URL
/// Return the icon of the file as `Image`
var icon: Image { Image(system... | Maybe define the variable above its usages, reads a bit easier imo. Less search work |
/// Returns the extension of the file or an empty string if no extension is present.
var type: FileIcon.FileType { .init(rawValue: url.pathExtension) ?? .txt }
/// Returns the URL of the ``CEWorkspaceFile``
var url: URL
/// Return the icon of the file as `Image`
var icon: Image { Image(system... | @@ -54,7 +55,17 @@ final class CEWorkspaceFile: Codable, Comparable, Hashable, Identifiable, Editor
/// If the item already is the top-level ``CEWorkspaceFile`` this returns `nil`.
var parent: CEWorkspaceFile?
- var fileDocument: CodeFileDocument?
+ var fileDocument: CodeFileDocument? {
+ didSe... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift | 26 | Swift | 0.214 | suggestion | 84 | 51 | 51 | false | Unsaved changes indicator in editor tab | 1,441 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift
PR Title: Unsaved changes indicator in editor tab
BEFORE CODE:
/// Returns the extension of the file or an empty string if no extension is present.
var type: FileIcon.FileType { .init(rawValue:... | Maybe define the variable above its usages, reads a bit easier imo. Less search work | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if type.conforms(to: UTType.image) {
return UTType.image
}
if type.conforms(to: UTType.text) {
return UTType.text
}
if type.conforms(to: .data) {
return .data
}
return nil
}
/*
This is the QLPreviewItemURL
*/
... | Here also, maybe define the variable above its usages | if type.conforms(to: UTType.image) {
return UTType.image
}
if type.conforms(to: UTType.text) {
return UTType.text
}
if type.conforms(to: .data) {
return .data
}
return nil
}
/*
This is the QLPreviewItemURL
*/
... | @@ -71,6 +72,12 @@ final class CodeFileDocument: NSDocument, ObservableObject, QLPreviewItem {
@Published var cursorPosition = (1, 1)
+ /// Publisher for isDocumentEdited property
+ var isDocumentEditedPublisher: AnyPublisher<Bool, Never> {
+ isDocumentEditedSubject.eraseToAnyPublisher()
+ }
+ ... | CodeEdit/Features/CodeFile/CodeFile.swift | 26 | Swift | 0.214 | suggestion | 53 | 51 | 51 | false | Unsaved changes indicator in editor tab | 1,441 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CodeFile/CodeFile.swift
PR Title: Unsaved changes indicator in editor tab
BEFORE CODE: if type.conforms(to: UTType.image) {
return UTType.image
}
if type.conforms(to: UTType.text) {
return UTType... | Here also, maybe define the variable above its usages | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
func hasLoadedChildrenFor(file: CEWorkspaceFile) -> Bool {
childrenMap[file.id] != nil
}
#endif
// MARK: - Directory Events
/// Run when the owner of the ``CEWorkspaceFileManager`` doesn't need it anymore.
/// This de-inits most functions in the ``CEWorkspaceFileManager``, so that in case ... | This looks a bit like a overkill especially compared with the old code `directory.removeLast()` | func hasLoadedChildrenFor(file: CEWorkspaceFile) -> Bool {
childrenMap[file.id] != nil
}
#endif
// MARK: - Directory Events
/// Run when the owner of the ``CEWorkspaceFileManager`` doesn't need it anymore.
/// This de-inits most functions in the ``CEWorkspaceFileManager``, so that in case ... | @@ -187,33 +187,28 @@ final class CEWorkspaceFileManager {
/// - Parameter events: An array of events that occurred.
private func fileSystemEventReceived(events: [DirectoryEventStream.Event]) {
DispatchQueue.main.async {
- var eventHandledCount = 0
+ var files: Set<CEWorkspaceFi... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager.swift | 26 | Swift | 0.429 | suggestion | 95 | 51 | 51 | false | Project navigator files watch fixes | 1,452 | CodeEditApp/CodeEdit | 18,361 | Swift | 0xWDG | avinizhanov | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager.swift
PR Title: Project navigator files watch fixes
BEFORE CODE: func hasLoadedChildrenFor(file: CEWorkspaceFile) -> Bool {
childrenMap[file.id] != nil
}
#endif
// MARK: - Director... | This looks a bit like a overkill especially compared with the old code `directory.removeLast()` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import SwiftUI
struct SourceControlToolbarBottom: View {
@EnvironmentObject private var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 0) {
sourceControlMenu
SourceControlSearchToolbar()
}
.frame(height: 29, alignment: .center)
.fram... | Is there any possibility this could be `nil` at this point? Im not 100% familiar with state handling on this bit. |
import SwiftUI
struct SourceControlToolbarBottom: View {
@EnvironmentObject private var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 0) {
sourceControlMenu
SourceControlSearchToolbar()
}
.frame(height: 29, alignment: .center)
.fram... | @@ -23,8 +25,11 @@ struct SourceControlToolbarBottom: View {
private var sourceControlMenu: some View {
Menu {
- Button("Discard Changes...") {}
- .disabled(true) // TODO: Implementation Needed
+ Button("Discard Changes...") {
+ if discardChangesDialog... | CodeEdit/Features/NavigatorArea/SourceControlNavigator/SourceControlToolbarBottom.swift | 26 | Swift | 0.571 | suggestion | 113 | 51 | 51 | false | feat: discard changes support for `SourceControlToolbarBottom` | 1,480 | CodeEditApp/CodeEdit | 18,361 | Swift | LeoBorai | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorArea/SourceControlNavigator/SourceControlToolbarBottom.swift
PR Title: feat: discard changes support for `SourceControlToolbarBottom`
BEFORE CODE:
import SwiftUI
struct SourceControlToolbarBottom: View {
@EnvironmentObject priva... | Is there any possibility this could be `nil` at this point? Im not 100% familiar with state handling on this bit. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// CodeEdit
//
// Created by Nanashi Li on 2022/05/20.
//
import SwiftUI
struct SourceControlToolbarBottom: View {
@EnvironmentObject private var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 0) {
sourceControlMenu
SourceControlSearchToolbar()
}
... | Should we maybe say “Discard All Changes…”? | // CodeEdit
//
// Created by Nanashi Li on 2022/05/20.
//
import SwiftUI
struct SourceControlToolbarBottom: View {
@EnvironmentObject private var workspace: WorkspaceDocument
var body: some View {
HStack(spacing: 0) {
sourceControlMenu
SourceControlSearchToolbar()
}
... | @@ -23,8 +25,11 @@ struct SourceControlToolbarBottom: View {
private var sourceControlMenu: some View {
Menu {
- Button("Discard Changes...") {}
- .disabled(true) // TODO: Implementation Needed
+ Button("Discard Changes...") { | CodeEdit/Features/NavigatorArea/SourceControlNavigator/SourceControlToolbarBottom.swift | 26 | Swift | 0.143 | question | 43 | 51 | 51 | false | feat: discard changes support for `SourceControlToolbarBottom` | 1,480 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorArea/SourceControlNavigator/SourceControlToolbarBottom.swift
PR Title: feat: discard changes support for `SourceControlToolbarBottom`
BEFORE CODE: // CodeEdit
//
// Created by Nanashi Li on 2022/05/20.
//
import SwiftUI
struct Sou... | Should we maybe say “Discard All Changes…”? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
updateWithNewStatus(newStatus)
}
}
/// Updates the bar with a new status update.
/// - Parameter status: The new status.
private func updateWithNewStatus(_ status: WorkspaceDocument.SearchState.IndexStatus) {
switch status {
case .none:
self.p... | There's an extra level of indentation. Let's use one tab instead of two. | updateWithNewStatus(newStatus)
}
}
/// Updates the bar with a new status update.
/// - Parameter status: The new status.
private func updateWithNewStatus(_ status: WorkspaceDocument.SearchState.IndexStatus) {
switch status {
case .none:
self.progress = 0.... | @@ -0,0 +1,69 @@
+//
+// FindNavigatorIndexBar.swift
+// CodeEdit
+//
+// Created by Khan Winter on 12/4/23.
+//
+
+import SwiftUI
+
+struct FindNavigatorIndexBar: View {
+ @ObservedObject private var state: WorkspaceDocument.SearchState
+ @State private var progress: Double = 0.0
+ @State private var shoul... | CodeEdit/Features/NavigatorArea/FindNavigator/FindNavigatorIndexBar.swift | 26 | Swift | 0.286 | suggestion | 72 | 29 | 29 | false | Add Indexing Progress, Index Off Main Thread | 1,501 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter | Review this pull request change.
Language: Swift
File: CodeEdit/Features/NavigatorArea/FindNavigator/FindNavigatorIndexBar.swift
PR Title: Add Indexing Progress, Index Off Main Thread
BEFORE CODE: updateWithNewStatus(newStatus)
}
}
/// Updates the bar with a new status update.
/// -... | There's an extra level of indentation. Let's use one tab instead of two. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
guard let url = workspace.fileURL else {
return
}
indexStatus = .indexing(progress: 0.0)
Task.detached {
let filePaths = self.getFileURLs(at: url)
let asyncController = SearchIndexer.AsyncManager(index: indexer)
... | I'm uncertain about the necessity of calling `index.compact()` here; it should be invoked only if the index becomes significantly fragmented.
**Apple Docs:**
Over time, as document URL objects (of type SKDocument) and associated contents get added to and removed from an index, the index’s disk or memory footprint may... |
guard let url = workspace.fileURL else {
return
}
indexStatus = .indexing(progress: 0.0)
Task.detached {
let filePaths = self.getFileURLs(at: url)
let asyncController = SearchIndexer.AsyncManager(index: indexer)
... | @@ -40,11 +48,31 @@ extension WorkspaceDocument {
return
}
- let filePaths = getFileURLs(at: url)
- Task {
- let textFiles = await getFileContents(from: filePaths)
+ indexStatus = .indexing(progress: 0.0)
+
+ Task.detached {
+ ... | CodeEdit/Features/Documents/WorkspaceDocument+Search.swift | 26 | Swift | 0.786 | suggestion | 738 | 51 | 51 | false | Add Indexing Progress, Index Off Main Thread | 1,501 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/WorkspaceDocument+Search.swift
PR Title: Add Indexing Progress, Index Off Main Thread
BEFORE CODE:
guard let url = workspace.fileURL else {
return
}
indexStatus = .indexing(progre... | I'm uncertain about the necessity of calling `index.compact()` here; it should be invoked only if the index becomes significantly fragmented.
**Apple Docs:**
Over time, as document URL objects (of type SKDocument) and associated contents get added to and removed from an index, the index’s disk or memory footprint may... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return "*\(newQuery)"
default:
return newQuery
}
}
/// Searches the entire workspace for the given string, using the
/// ``WorkspaceDocument/SearchState-swift.class/selectedMode`` modifiers
/// to modify the search if needed. This ... | Due to the separation of concerns, I'd suggest using this function
```suggestion
clearResults()
``` | default:
return newQuery
}
}
/// Searches the entire workspace for the given string, using the
/// ``WorkspaceDocument/SearchState-swift.class/selectedMode`` modifiers
/// to modify the search if needed. This is done by filtering out files with Se... | @@ -115,6 +126,12 @@ extension WorkspaceDocument {
///
/// - Parameter query: The search query to search for.
func search(_ query: String) async {
+ await MainActor.run {
+ searchResult = []
+ searchResultsCount = 0
+ searchResultsFileCo... | CodeEdit/Features/Documents/WorkspaceDocument+Search.swift | 26 | Swift | 0.714 | suggestion | 103 | 51 | 51 | false | Add Indexing Progress, Index Off Main Thread | 1,501 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/WorkspaceDocument+Search.swift
PR Title: Add Indexing Progress, Index Off Main Thread
BEFORE CODE: return "*\(newQuery)"
default:
return newQuery
}
}
/// Search... | Due to the separation of concerns, I'd suggest using this function
```suggestion
clearResults()
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var siblings: [CEWorkspaceFile] {
guard let fileManager = workspace.workspaceFileManager,
let parent = fileItem.parent else {
return [fileItem]
}
if let siblings = fileManager.childrenOfFile(parent), !siblings.isEmpty {
return siblings
} else {
... | This feels a bit weird. Can't this be done some other way instead of storing a reference to the NSPopupButton? |
var siblings: [CEWorkspaceFile] {
guard let fileManager = workspace.workspaceFileManager,
let parent = fileItem.parent else {
return [fileItem]
}
if let siblings = fileManager.childrenOfFile(parent), !siblings.isEmpty {
return siblings
} else {
... | @@ -58,11 +62,52 @@ struct EditorPathBarComponent: View {
button.font = .systemFont(ofSize: NSFont.systemFontSize(for: .small))
button.isBordered = false
(button.cell as? NSPopUpButtonCell)?.arrowPosition = .noArrow
+ DispatchQueue.main.async { | CodeEdit/Features/Editor/PathBar/Views/EditorPathBarComponent.swift | 26 | Swift | 0.429 | question | 110 | 51 | 51 | false | Updated path picker design | 1,502 | CodeEditApp/CodeEdit | 18,361 | Swift | Wouter01 | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/PathBar/Views/EditorPathBarComponent.swift
PR Title: Updated path picker design
BEFORE CODE:
var siblings: [CEWorkspaceFile] {
guard let fileManager = workspace.workspaceFileManager,
let parent = fileItem.pare... | This feels a bit weird. Can't this be done some other way instead of storing a reference to the NSPopupButton? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// SearchSettings.swift
// CodeEdit
//
// Created by Esteban on 12/10/23.
//
import Foundation
extension SettingsData {
struct SearchSettings: Codable, Hashable, SearchableSettingsPage {
/// The search keys
var searchKeys: [String] {
[
"Ignore Glob Patterns",
... | ```suggestion
```
I think this line is unnecessary | //
// SearchSettings.swift
// CodeEdit
//
// Created by Esteban on 12/10/23.
//
import Foundation
extension SettingsData {
struct SearchSettings: Codable, Hashable, SearchableSettingsPage {
/// The search keys
var searchKeys: [String] {
[
"Ignore Glob Patterns",
... | @@ -0,0 +1,39 @@
+//
+// SearchSettings.swift
+// CodeEdit
+//
+// Created by Esteban on 12/10/23.
+//
+
+import Foundation
+
+extension SettingsData {
+ | CodeEdit/Features/Settings/Pages/SearchSettings/Models/SearchSettings.swift | 11 | Swift | 0.571 | suggestion | 53 | 36 | 36 | false | feat(settings): section with glob pattern crud | 1,507 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/SearchSettings/Models/SearchSettings.swift
PR Title: feat(settings): section with glob pattern crud
BEFORE CODE: //
// SearchSettings.swift
// CodeEdit
//
// Created by Esteban on 12/10/23.
//
import Foundation
extension Se... | ```suggestion
```
I think this line is unnecessary | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
TextField("", text: $value)
.focused(focusedField, equals: pattern.id.uuidString)
.focused($isFocused)
.disableAutocorrection(true)
.autocorrectionDisabled()
.labelsHidden()
.onSubmit {
if !value.isEmpty && isLast {
... | I would drop this View into a separate file. Wdyt? | //
// SearchSettingsView.swift
// CodeEdit
//
// Created by Esteban on 12/10/23.
//
import SwiftUI
struct SearchSettingsView: View {
var body: some View {
SettingsForm {
Section {
ExcludedGlobPatternList()
} header: {
Text("Exclude")
... | @@ -0,0 +1,190 @@
+//
+// SearchSettingsView.swift
+// CodeEdit
+//
+// Created by Esteban on 12/10/23.
+//
+
+import SwiftUI
+
+struct SearchSettingsView: View {
+ var body: some View {
+ SettingsForm {
+ Section {
+ ExcludedGlobPatternList()
+ } header: {
+ ... | CodeEdit/Features/Settings/Pages/SearchSettings/SearchSettingsView.swift | 26 | Swift | 0.214 | question | 50 | 27 | 133 | false | feat(settings): section with glob pattern crud | 1,507 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/SearchSettings/SearchSettingsView.swift
PR Title: feat(settings): section with glob pattern crud
BEFORE CODE: TextField("", text: $value)
.focused(focusedField, equals: pattern.id.uuidString)
.foc... | I would drop this View into a separate file. Wdyt? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@State private var selection: GlobPattern?
func addPattern() {
searchSettingsModel.ignoreGlobPatterns.append(GlobPattern(value: ""))
}
func removePattern(_ pattern: GlobPattern?) {
let selectedIndex = searchSettingsModel.ignoreGlobPatterns.firstIndex {
$0 == selection
... | In SwiftUI, I prefer organizing a struct with properties at the top, followed by the body, and then the methods at the bottom. It adds a nice flow to the code! Like here:
```swift
struct SomeView: View {
@State private var x: Int = 0
var body: some View {
Text(hi())
}
func hi() -> Str... |
@State private var selection: GlobPattern?
var body: some View {
List(selection: $selection) {
ForEach(
Array(searchSettingsModel.ignoreGlobPatterns.enumerated()),
id: \.element
) { index, ignorePattern in
IgnorePatternListItem(
... | @@ -0,0 +1,190 @@
+//
+// SearchSettingsView.swift
+// CodeEdit
+//
+// Created by Esteban on 12/10/23.
+//
+
+import SwiftUI
+
+struct SearchSettingsView: View {
+ var body: some View {
+ SettingsForm {
+ Section {
+ ExcludedGlobPatternList()
+ } header: {
+ ... | CodeEdit/Features/Settings/Pages/SearchSettings/SearchSettingsView.swift | 26 | Swift | 0.857 | suggestion | 361 | 51 | 51 | false | feat(settings): section with glob pattern crud | 1,507 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | LeoBorai | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/SearchSettings/SearchSettingsView.swift
PR Title: feat(settings): section with glob pattern crud
BEFORE CODE:
@State private var selection: GlobPattern?
func addPattern() {
searchSettingsModel.ignoreGlobPattern... | In SwiftUI, I prefer organizing a struct with properties at the top, followed by the body, and then the methods at the bottom. It adds a nice flow to the code! Like here:
```swift
struct SomeView: View {
@State private var x: Int = 0
var body: some View {
Text(hi())
}
func hi() -> Str... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if !self.content.isEmpty {
return UTType.text
}
guard let fileType, let type = UTType(fileType) else {
return nil
}
if type.conforms(to: UTType.image) {
return UTType.image
}
if type.conforms(to: UTType.text) {
retur... | How does this look in our statusbar? If it is now an array, are we showing the cursor position of the last item in the array or handling it in some other way? | if !self.content.isEmpty {
return UTType.text
}
guard let fileType, let type = UTType(fileType) else {
return nil
}
if type.conforms(to: UTType.image) {
return UTType.image
}
if type.conforms(to: UTType.text) {
retur... | @@ -70,7 +70,7 @@ final class CodeFileDocument: NSDocument, ObservableObject, QLPreviewItem {
fileURL
}
- @Published var cursorPosition = (1, 1)
+ @Published var cursorPositions = [CursorPosition]() | CodeEdit/Features/CodeFile/CodeFile.swift | 26 | Swift | 0.357 | question | 158 | 51 | 51 | false | Update To New Text View | 1,509 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | thecoolwinter | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CodeFile/CodeFile.swift
PR Title: Update To New Text View
BEFORE CODE: if !self.content.isEmpty {
return UTType.text
}
guard let fileType, let type = UTType(fileType) else {
return nil
}
... | How does this look in our statusbar? If it is now an array, are we showing the cursor position of the last item in the array or handling it in some other way? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if !(editorFontSize >= 288) {
editorFontSize += 1
}
if !(terminalFontSize >= 288) {
terminalFontSize += 1
}
}
.keyboardShortcut("+")
.disabled(windowController == nil)
... | Maybe fine for now, but this shouldn't be hardcoded. If someone has bad vision, that person should be able to set a standard font size, or we should try to get the system font size (if possible) | Button("Increase") {
if !(editorFontSize >= 288) {
editorFontSize += 1
}
if !(terminalFontSize >= 288) {
terminalFontSize += 1
}
}
.keyboardShor... | @@ -45,26 +45,35 @@ struct ViewCommands: Commands {
}
.keyboardShortcut("p", modifiers: [.shift, .command])
- Button("Increase font size") {
- if !(editorFontSize >= 288) {
- editorFontSize += 1
- }
- if !(terminalFon... | CodeEdit/Features/WindowCommands/ViewCommands.swift | 26 | Swift | 0.429 | suggestion | 194 | 51 | 51 | false | ^⌘0 resets font size | 1,562 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | luah5 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/WindowCommands/ViewCommands.swift
PR Title: ^⌘0 resets font size
BEFORE CODE: if !(editorFontSize >= 288) {
editorFontSize += 1
}
if !(terminalFontSize >= 288) {
... | Maybe fine for now, but this shouldn't be hardcoded. If someone has bad vision, that person should be able to set a standard font size, or we should try to get the system font size (if possible) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@Published var indexStatus: IndexStatus = .none
@Published var findNavigatorStatus: FindNavigatorStatus = .none
unowned var workspace: WorkspaceDocument
var tempSearchResults = [SearchResultModel]()
var caseSensitive: Bool = false
var indexer: SearchIndexer?
va... | Not sure if it's just American spelling but I think the original was correct? Unless thats how they spell it overseas then that's fine! |
@Published var indexStatus: IndexStatus = .none
@Published var findNavigatorStatus: FindNavigatorStatus = .none
unowned var workspace: WorkspaceDocument
var tempSearchResults = [SearchResultModel]()
var caseSensitive: Bool = false
var indexer: SearchIndexer?
va... | @@ -55,7 +55,7 @@ extension WorkspaceDocument {
///
/// The `replaceOptions` property is a lazy, computed property that dynamically calculates
/// the compare options based on the values of `selectedMode` and `ignoreCase`. It is used
- /// for controlling string replacement behavior fo... | CodeEdit/Features/Documents/WorkspaceDocument+SearchState.swift | 26 | Swift | 0.357 | nitpick | 135 | 45 | 45 | false | Fixing Typos | 1,579 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | tom-ludwig | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/WorkspaceDocument+SearchState.swift
PR Title: Fixing Typos
BEFORE CODE:
@Published var indexStatus: IndexStatus = .none
@Published var findNavigatorStatus: FindNavigatorStatus = .none
unowned var workspace:... | Not sure if it's just American spelling but I think the original was correct? Unless thats how they spell it overseas then that's fine! | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// SwiftUI also ignores this value, so it just manages to set the initial window size. *Hopefully* this
// is fixed in the future.
if let rectString = getFromWorkspaceState(.workspaceWindowSize) as? String {
window.minSize = NSRectFromString(rectString).size
... | Jus to be clear, this will show nhe filename from tho whole path/URL to the file right?
| // SwiftUI also ignores this value, so it just manages to set the initial window size. *Hopefully* this
// is fixed in the future.
if let rectString = getFromWorkspaceState(.workspaceWindowSize) as? String {
window.minSize = NSRectFromString(rectString).size
... | @@ -111,6 +111,8 @@ final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {
private func initWorkspaceState(_ url: URL) throws {
self.fileURL = url
+ self.displayName = url.lastPathComponent | CodeEdit/Features/Documents/WorkspaceDocument.swift | 26 | Swift | 0.214 | question | 88 | 51 | 51 | false | Correct Commands For All Windows, Fix ⌘W | 1,587 | CodeEditApp/CodeEdit | 18,361 | Swift | LeoBorai | thecoolwinter | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Documents/WorkspaceDocument.swift
PR Title: Correct Commands For All Windows, Fix ⌘W
BEFORE CODE: // SwiftUI also ignores this value, so it just manages to set the initial window size. *Hopefully* this
// is fixed in th... | Jus to be clear, this will show nhe filename from tho whole path/URL to the file right?
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@Published var activeEditor: Editor {
didSet {
activeEditorHistory.prepend { [weak oldValue] in oldValue }
switchToActiveEditor()
}
}
/// History of last-used editors.
var activeEditorHistory: Deque<() -> Editor?> = []
var fileDocuments: [CEWorkspaceFile: Co... | Forgot to set `updateCachedFlattenedEditors` back to true whenever we update the editors | @Published var activeEditor: Editor {
didSet {
activeEditorHistory.prepend { [weak oldValue] in oldValue }
switchToActiveEditor()
}
}
/// History of last-used editors.
var activeEditorHistory: Deque<() -> Editor?> = []
var fileDocuments: [CEWorkspaceFile: Co... | @@ -36,6 +36,17 @@ class EditorManager: ObservableObject {
var tabBarTabIdSubject = PassthroughSubject<String?, Never>()
var cancellable: AnyCancellable?
+ // This caching mechanism is a temporary solution and is not optimized
+ var updateCachedFlattenedEditors: Bool = true
+ var cachedFlettenedEdi... | CodeEdit/Features/Editor/Models/EditorManager.swift | 26 | Swift | 0.357 | performance | 88 | 51 | 51 | false | Navigation style setting and file history navigation improvements | 1,603 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/Models/EditorManager.swift
PR Title: Navigation style setting and file history navigation improvements
BEFORE CODE: @Published var activeEditor: Editor {
didSet {
activeEditorHistory.prepend { [weak oldValue] in ... | Forgot to set `updateCachedFlattenedEditors` back to true whenever we update the editors | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Functionally identical to the initializer for this class.
func initCleanState() {
let tab = Editor()
self.activeEditor = tab
self.activeEditorHistory.prepend { [weak tab] in tab }
self.editorLayout = .horizontal(.init(.horizontal, editorLayouts: [.one(tab)]))
self.isF... | This returns the same thing, can't we use an OR operator here? | /// Functionally identical to the initializer for this class.
func initCleanState() {
let tab = Editor()
self.activeEditor = tab
self.activeEditorHistory.prepend { [weak tab] in tab }
self.editorLayout = .horizontal(.init(.horizontal, editorLayouts: [.one(tab)]))
self.isF... | @@ -68,6 +79,16 @@ class EditorManager: ObservableObject {
}
}
+ /// Returns and array of flattened splitviews.
+ func getFlattened() -> [Editor] {
+ if case .horizontal(let data) = editorLayout {
+ return data.getFlattened()
+ } else if case .vertical(let data) = editorLa... | CodeEdit/Features/Editor/Models/EditorManager.swift | 26 | Swift | 0.286 | question | 62 | 51 | 51 | false | Navigation style setting and file history navigation improvements | 1,603 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/Models/EditorManager.swift
PR Title: Navigation style setting and file history navigation improvements
BEFORE CODE: /// Functionally identical to the initializer for this class.
func initCleanState() {
let tab = Editor()... | This returns the same thing, can't we use an OR operator here? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return Set(editor.tabs.map { $0.file })
case .vertical(let data), .horizontal(let data):
return data.editorLayouts.map { $0.gatherOpenFiles() }.reduce(into: []) { $0.formUnion($1) }
}
}
/// Flattens the splitviews.
mutating func flatten(parent: SplitViewData) {
... | Why is mutating used here? Seems like there is no reassigning of self variables | return Set(editor.tabs.map { $0.file })
case .vertical(let data), .horizontal(let data):
return data.editorLayouts.map { $0.gatherOpenFiles() }.reduce(into: []) { $0.formUnion($1) }
}
}
/// Flattens the splitviews.
mutating func flatten(parent: SplitViewData) {
... | @@ -89,6 +89,24 @@ enum EditorLayout: Equatable {
}
}
+ /// Gets flattened splitviews.
+ mutating func getFlattened(parent: SplitViewData) -> [Editor] { | CodeEdit/Features/Editor/Models/EditorLayout.swift | 26 | Swift | 0.286 | question | 79 | 51 | 51 | false | Navigation style setting and file history navigation improvements | 1,603 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/Models/EditorLayout.swift
PR Title: Navigation style setting and file history navigation improvements
BEFORE CODE: return Set(editor.tabs.map { $0.file })
case .vertical(let data), .horizontal(let data):
... | Why is mutating used here? Seems like there is no reassigning of self variables | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// Initializes the editor manager's state to the "initial" state.
///
/// Functionally identical to the initializer for this class.
func initCleanState() {
let tab = Editor()
self.activeEditor = tab
self.activeEditorHistory.prepend { [weak tab] in tab }
self.editorLayou... | Calling this function "flatten" is a bit weird. `editorManager.flatten()` kind of reads like this function flattens the manager |
// MARK: - Init
init() {
let tab = Editor()
self.activeEditor = tab
self.activeEditorHistory.prepend { [weak tab] in tab }
self.editorLayout = .horizontal(.init(.horizontal, editorLayouts: [.one(tab)]))
self.isFocusingActiveEditor = false
switchToActiveEditor()
... | @@ -61,10 +72,21 @@ class EditorManager: ObservableObject {
/// Flattens the splitviews.
func flatten() { | CodeEdit/Features/Editor/Models/EditorManager.swift | 26 | Swift | 0.5 | suggestion | 127 | 51 | 51 | false | Navigation style setting and file history navigation improvements | 1,603 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | austincondiff | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Editor/Models/EditorManager.swift
PR Title: Navigation style setting and file history navigation improvements
BEFORE CODE:
/// Initializes the editor manager's state to the "initial" state.
///
/// Functionally identical to the in... | Calling this function "flatten" is a bit weird. `editorManager.flatten()` kind of reads like this function flattens the manager | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
AreaTabBar(items: $model.tabItems, selection: $selection, position: .side)
Divider()
.overlay(Color(nsColor: colorScheme == .dark ? .black : .clear))
}
}
.overlay(alignment: .bottomTrailing) {
HStack(spacing: 5) {
... | ```suggestion
.buttonStyle(.icon(isActive: model.isMaximized, size: 24))
}
}
.colorScheme(
model.selectedTerminals.isEmpty
? colorScheme
: matchAppearance && darkAppearance
? themeModel.se... | Text("Tab not found")
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
.safeAreaInset(edge: .leading, spacing: 0) {
HStack(spacing: 0) {
AreaTabBar(items: $model.tabItems, selection: $selection, position: .side)
... | @@ -39,8 +41,17 @@ struct UtilityAreaView: View {
model.isMaximized.toggle()
} label: {
Image(systemName: "arrowtriangle.up.square")
+ .foregroundColor(
+ model.isMaximized
+ ... | CodeEdit/Features/UtilityArea/Views/UtilityAreaView.swift | 26 | Swift | 0.786 | suggestion | 475 | 40 | 37 | false | fix: maximized button color issue | 1,607 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | phlpsong | Review this pull request change.
Language: Swift
File: CodeEdit/Features/UtilityArea/Views/UtilityAreaView.swift
PR Title: fix: maximized button color issue
BEFORE CODE: AreaTabBar(items: $model.tabItems, selection: $selection, position: .side)
Divider()
.overlay(... | ```suggestion
.buttonStyle(.icon(isActive: model.isMaximized, size: 24))
}
}
.colorScheme(
model.selectedTerminals.isEmpty
? colorScheme
: matchAppearance && darkAppearance
? themeModel.se... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// UtilityAreaView.swift
// CodeEditModules/StatusBar
//
// Created by Lukas Pistrol on 22.03.22.
//
import SwiftUI
struct UtilityAreaView: View {
@Environment(\.colorScheme)
private var colorScheme
@Environment(\.controlActiveState)
private var controlActiveState
@EnvironmentObject private... | ```suggestion
@AppSettings(\.theme.matchAppearance)
private var matchAppearance
@AppSettings(\.terminal.darkAppearance)
private var darkAppearance
@Environment(\.colorScheme)
private var colorScheme
@EnvironmentObject private var model: UtilityAreaViewModel
@StateObject p... | //
// UtilityAreaView.swift
// CodeEditModules/StatusBar
//
// Created by Lukas Pistrol on 22.03.22.
//
import SwiftUI
struct UtilityAreaView: View {
@AppSettings(\.theme.matchAppearance)
private var matchAppearance
@AppSettings(\.terminal.darkAppearance)
private var darkAppearance
@Environme... | @@ -10,6 +10,8 @@ import SwiftUI
struct UtilityAreaView: View {
@Environment(\.colorScheme)
private var colorScheme
+ @Environment(\.controlActiveState)
+ private var controlActiveState | CodeEdit/Features/UtilityArea/Views/UtilityAreaView.swift | 14 | Swift | 0.786 | refactor | 368 | 39 | 39 | false | fix: maximized button color issue | 1,607 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | phlpsong | Review this pull request change.
Language: Swift
File: CodeEdit/Features/UtilityArea/Views/UtilityAreaView.swift
PR Title: fix: maximized button color issue
BEFORE CODE: //
// UtilityAreaView.swift
// CodeEditModules/StatusBar
//
// Created by Lukas Pistrol on 22.03.22.
//
import SwiftUI
struct UtilityAreaView... | ```suggestion
@AppSettings(\.theme.matchAppearance)
private var matchAppearance
@AppSettings(\.terminal.darkAppearance)
private var darkAppearance
@Environment(\.colorScheme)
private var colorScheme
@EnvironmentObject private var model: UtilityAreaViewModel
@StateObject p... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// UtilityAreaView.swift
// CodeEditModules/StatusBar
//
// Created by Lukas Pistrol on 22.03.22.
//
import SwiftUI
struct UtilityAreaView: View {
@Environment(\.colorScheme)
private var colorScheme
@EnvironmentObject private var model: UtilityAreaViewModel
@State var selection: UtilityAreaTab... | ```suggestion
.colorScheme(
model.selectedTerminals.isEmpty ?
colorScheme :
(matchAppearance && darkAppearance ?
(themeModel.selectedDarkTheme?.appearance == .dark ? .dark : .light) :
(themeModel.selectedTheme... | .safeAreaInset(edge: .leading, spacing: 0) {
HStack(spacing: 0) {
AreaTabBar(items: $model.tabItems, selection: $selection, position: .side)
Divider()
.overlay(Color(nsColor: colorScheme == .dark ? .black : .clear))
}
}
... | @@ -43,6 +51,13 @@ struct UtilityAreaView: View {
.buttonStyle(.icon(isActive: model.isMaximized, size: 24))
}
}
+ .colorScheme(
+ model.selectedTerminals.isEmpty
+ ? colorScheme
+ : matchAppearance && darkAppeara... | CodeEdit/Features/UtilityArea/Views/UtilityAreaView.swift | 26 | Swift | 0.857 | refactor | 443 | 52 | 33 | false | fix: maximized button color issue | 1,607 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | phlpsong | Review this pull request change.
Language: Swift
File: CodeEdit/Features/UtilityArea/Views/UtilityAreaView.swift
PR Title: fix: maximized button color issue
BEFORE CODE: //
// UtilityAreaView.swift
// CodeEditModules/StatusBar
//
// Created by Lukas Pistrol on 22.03.22.
//
import SwiftUI
struct UtilityAreaView... | ```suggestion
.colorScheme(
model.selectedTerminals.isEmpty ?
colorScheme :
(matchAppearance && darkAppearance ?
(themeModel.selectedDarkTheme?.appearance == .dark ? .dark : .light) :
(themeModel.selectedTheme... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// TextEditingPreferences.swift
// CodeEditModules/Settings
//
// Created by Nanashi Li on 2022/04/08.
//
import AppKit.NSFont
import Foundation
extension SettingsData {
/// The global settings for text editing
struct TextEditingSettings: Codable, Hashable, SearchableSettingsPage {
var searchK... | No need to import the specific NSFont module there's no benefit, remove this diff to keep the imports simpler. | //
// TextEditingPreferences.swift
// CodeEditModules/Settings
//
// Created by Nanashi Li on 2022/04/08.
//
import AppKit
import Foundation
extension SettingsData {
/// The global settings for text editing
struct TextEditingSettings: Codable, Hashable, SearchableSettingsPage {
var searchKeys: [S... | @@ -5,7 +5,7 @@
// Created by Nanashi Li on 2022/04/08.
//
-import AppKit
+import AppKit.NSFont | CodeEdit/Features/Settings/Pages/TextEditingSettings/Models/TextEditingSettings.swift | 8 | Swift | 0.429 | refactor | 110 | 33 | 33 | false | Font Improvement | 1,608 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | ibrahimcetin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/TextEditingSettings/Models/TextEditingSettings.swift
PR Title: Font Improvement
BEFORE CODE: //
// TextEditingPreferences.swift
// CodeEditModules/Settings
//
// Created by Nanashi Li on 2022/04/08.
//
import AppKit.NSFont
i... | No need to import the specific NSFont module there's no benefit, remove this diff to keep the imports simpler. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// TerminalPreferences.swift
// CodeEditModules/Settings
//
// Created by Nanashi Li on 2022/04/08.
//
import AppKit.NSFont
import Foundation
extension SettingsData {
/// The global settings for the terminal emulator
struct TerminalSettings: Codable, Hashable, SearchableSettingsPage {
/// The ... | No need to import the specific NSFont module there's no benefit, remove this diff to keep the imports simpler. | //
// TerminalPreferences.swift
// CodeEditModules/Settings
//
// Created by Nanashi Li on 2022/04/08.
//
import AppKit
import Foundation
extension SettingsData {
/// The global settings for the terminal emulator
struct TerminalSettings: Codable, Hashable, SearchableSettingsPage {
/// The search ... | @@ -5,6 +5,7 @@
// Created by Nanashi Li on 2022/04/08.
//
+import AppKit.NSFont | CodeEdit/Features/Settings/Pages/TerminalSettings/Models/TerminalSettings.swift | 8 | Swift | 0.429 | refactor | 110 | 33 | 33 | false | Font Improvement | 1,608 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | ibrahimcetin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Pages/TerminalSettings/Models/TerminalSettings.swift
PR Title: Font Improvement
BEFORE CODE: //
// TerminalPreferences.swift
// CodeEditModules/Settings
//
// Created by Nanashi Li on 2022/04/08.
//
import AppKit.NSFont
import Fou... | No need to import the specific NSFont module there's no benefit, remove this diff to keep the imports simpler. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import SwiftUI
struct MonospacedFontPicker: View {
var title: String
@Binding var selectedFontName: String
@State private var recentFonts: [String]
@State private var monospacedFontFamilyNames: [String] = []
@State private var otherFontFamilyNames: [String] = []
init(title: String, selectedFo... | You're on the right track, but adding `nonisolated` and `aysnc` to this function doesn't make it do it's work on a different thread. `nonisolated` also doesn't do anything to this function because it's not declared on an actor and isn't being called in an isolated context. Instead this should be done in a task group li... |
import SwiftUI
struct MonospacedFontPicker: View {
var title: String
@Binding var selectedFontName: String
@State private var recentFonts: [String]
@State private var monospacedFontFamilyNames: [String] = []
@State private var otherFontFamilyNames: [String] = []
init(title: String, selectedFo... | @@ -29,29 +29,41 @@ struct MonospacedFontPicker: View {
UserDefaults.standard.set(recentFonts, forKey: "recentFonts")
}
- func getFonts() {
- DispatchQueue.global(qos: .userInitiated).async {
- let availableFontFamilies = NSFontManager.shared.availableFontFamilies
+ nonisolated f... | CodeEdit/Features/Settings/Views/MonospacedFontPicker.swift | 26 | Swift | 1 | refactor | 2,611 | 51 | 51 | false | Font Improvement | 1,608 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | ibrahimcetin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Views/MonospacedFontPicker.swift
PR Title: Font Improvement
BEFORE CODE:
import SwiftUI
struct MonospacedFontPicker: View {
var title: String
@Binding var selectedFontName: String
@State private var recentFonts: [String]... | You're on the right track, but adding `nonisolated` and `aysnc` to this function doesn't make it do it's work on a different thread. `nonisolated` also doesn't do anything to this function because it's not declared on an actor and isn't being called in an isolated context. Instead this should be done in a task group li... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// MonospacedFontPicker.swift
// CodeEdit
//
// Created by Austin Condiff on 4/22/23.
//
import SwiftUI
struct MonospacedFontPicker: View {
var title: String
@Binding var selectedFontName: String
@State private var recentFonts: [String]
@State private var monospacedFontFamilyNames: [String] = []... | To fix the issue Austin mentioned the `Picker` needs to be replaced with a `Menu` on lines 94-100. The slow loading issue is caused by the Picker evaluating it's view immediately when loaded instead of only when opening that picker. I wrote it up quick because it's a little unrelated but if you can include it with thes... | //
// MonospacedFontPicker.swift
// CodeEdit
//
// Created by Austin Condiff on 4/22/23.
//
import SwiftUI
struct MonospacedFontPicker: View {
var title: String
@Binding var selectedFontName: String
@State private var recentFonts: [String]
@State private var monospacedFontFamilyNames: [String] = []... | CodeEdit/Features/Settings/Views/MonospacedFontPicker.swift | 1 | Swift | 0.857 | performance | 969 | 26 | 26 | false | Font Improvement | 1,608 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | ibrahimcetin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Settings/Views/MonospacedFontPicker.swift
PR Title: Font Improvement
BEFORE CODE: //
// MonospacedFontPicker.swift
// CodeEdit
//
// Created by Austin Condiff on 4/22/23.
//
import SwiftUI
struct MonospacedFontPicker: View {
var title... | To fix the issue Austin mentioned the `Picker` needs to be replaced with a `Menu` on lines 94-100. The slow loading issue is caused by the Picker evaluating it's view immediately when loaded instead of only when opening that picker. I wrote it up quick because it's a little unrelated but if you can include it with thes... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/// All branches, local and remote
@Published var branches: [GitBranch] = []
/// All remotes
@Published var remotes: [GitRemote] = []
/// All stash ebtrues
@Published var stashEntries: [GitStashEntry] = []
/// Number of unsynced commits with remote in current branch
@Published var nu... | ```suggestion
var orderedLocalBranches: [GitBranch] {
var orderedBranches: [GitBranch] = [currentBranch].compactMap { $0 }
let otherBranches = branches.filter { $0.isLocal && $0 != currentBranch }
.sorted { $0.name < $1.name }
orderedBranches.append(contentsOf: otherBra... |
/// All branches, local and remote
@Published var branches: [GitBranch] = []
/// All remotes
@Published var remotes: [GitRemote] = []
/// All stash ebtrues
@Published var stashEntries: [GitStashEntry] = []
/// Number of unsynced commits with remote in current branch
@Published var nu... | @@ -38,6 +38,18 @@ final class SourceControlManager: ObservableObject {
@Published var isGitRepository: Bool = false
+ var orderedLocalBranches: [GitBranch] {
+ var orderedBranches: [GitBranch] = []
+ if let currentBranch {
+ orderedBranches.append(currentBranch)
+ }
+ ... | CodeEdit/Features/Git/SourceControlManager.swift | 26 | Swift | 0.857 | suggestion | 413 | 51 | 51 | false | Git branches list order and truncate priority issue | 1,647 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | phlpsong | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Git/SourceControlManager.swift
PR Title: Git branches list order and truncate priority issue
BEFORE CODE:
/// All branches, local and remote
@Published var branches: [GitBranch] = []
/// All remotes
@Published var remotes: [G... | ```suggestion
var orderedLocalBranches: [GitBranch] {
var orderedBranches: [GitBranch] = [currentBranch].compactMap { $0 }
let otherBranches = branches.filter { $0.isLocal && $0 != currentBranch }
.sorted { $0.name < $1.name }
orderedBranches.append(contentsOf: otherBra... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// CommandPaletteView.swift
// CodeEdit
//
// Created by Alex Sinelnikov on 24.05.2022.
//
import SwiftUI
/// Command palette view
struct QuickActionsView: View {
@Environment(\.colorScheme)
private var colorScheme: ColorScheme
@ObservedObject private var state: QuickActionsViewModel
@Observe... | Change this comment to reflect the new name
```suggestion
/// Quick actions view
``` | //
// CommandPaletteView.swift
// CodeEdit
//
// Created by Alex Sinelnikov on 24.05.2022.
//
import SwiftUI
/// Quick actions view
struct QuickActionsView: View {
@Environment(\.colorScheme)
private var colorScheme: ColorScheme
@ObservedObject private var state: QuickActionsViewModel
@ObservedO... | @@ -8,12 +8,12 @@
import SwiftUI
/// Command palette view | CodeEdit/Features/Commands/Views/QuickActionsView.swift | 10 | Swift | 0.643 | suggestion | 87 | 35 | 35 | false | Rename CommandPalleteView and CommandPalleteViewModel classes | 1,655 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | dklaver15 | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Commands/Views/QuickActionsView.swift
PR Title: Rename CommandPalleteView and CommandPalleteViewModel classes
BEFORE CODE: //
// CommandPaletteView.swift
// CodeEdit
//
// Created by Alex Sinelnikov on 24.05.2022.
//
import SwiftUI
/// Co... | Change this comment to reflect the new name
```suggestion
/// Quick actions view
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
//
// ServiceType.swift
// CodeEdit
//
// Created by Abe Malla on 4/3/24.
//
enum ServiceType {
/// Returns a new singleton on the first call, then returns a cached one every other time
case singleton
/// Creates a new singleton reference each time and caches it, returning the newer singleton
case n... | ```suggestion
/// Defines the type of service instantiation strategy.
enum ServiceType {
``` | //
// ServiceType.swift
// CodeEdit
//
// Created by Abe Malla on 4/3/24.
//
/// Defines the type of service instantiation strategy.
enum ServiceType {
/// Returns a new singleton on the first call, then returns a cached one every other time
case singleton
/// Creates a new singleton reference each time... | @@ -0,0 +1,15 @@
+//
+// ServiceType.swift
+// CodeEdit
+//
+// Created by Abe Malla on 4/3/24.
+//
+
+enum ServiceType { | CodeEdit/Utils/DependencyInjection/ServiceType.swift | 8 | Swift | 0.714 | suggestion | 97 | 16 | 17 | false | Added dependency injection | 1,662 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | FastestMolasses | Review this pull request change.
Language: Swift
File: CodeEdit/Utils/DependencyInjection/ServiceType.swift
PR Title: Added dependency injection
BEFORE CODE: //
// ServiceType.swift
// CodeEdit
//
// Created by Abe Malla on 4/3/24.
//
enum ServiceType {
/// Returns a new singleton on the first call, then re... | ```suggestion
/// Defines the type of service instantiation strategy.
enum ServiceType {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Created by Wouter Hennen on 02/02/2023.
//
import SwiftUI
import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
i... | Add a space between function declarations | // Created by Wouter Hennen on 02/02/2023.
//
import SwiftUI
import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
i... | @@ -25,6 +26,20 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
_selection = .init(initialValue: Set(projectsURL.prefix(1)))
_recentProjects = .init(initialValue: projectsURL)
+ donateSearchableItems()
+ } | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.071 | suggestion | 41 | 51 | 51 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE: // Created by Wouter Hennen on 02/02/2023.
//
import SwiftUI
import CoreSpotlight
struct RecentProjectsListView: View {
@Stat... | Add a space between function declarations | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @escaping () -> Void) {
self.openDocument = openDocument
self.dismissWindow = dismissWindow
let recentProjectPaths: [String] = UserDefaults.standard.array(
... | `indexSearchableItems` can also take in a completion handler. Add a closure so we can check for errors if the indexing failed. For now, we can just print out a message if there's an error. | private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @escaping () -> Void) {
self.openDocument = openDocument
self.dismissWindow = dismissWindow
let recentProjectPaths: [String] = UserDefaults.standard.array(
... | @@ -25,6 +26,20 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
_selection = .init(initialValue: Set(projectsURL.prefix(1)))
_recentProjects = .init(initialValue: projectsURL)
+ donateSearchableItems()
+ }
+ func donateSearc... | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.643 | bug | 188 | 51 | 51 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE: private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @esc... | `indexSearchableItems` can also take in a completion handler. Add a closure so we can check for errors if the indexing failed. For now, we can just print out a message if there's an error. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import SwiftUI
import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping ()... | Remove the `CSSearchableItem` type. The `recentProjects` variable is a `[URL]`. |
import SwiftUI
import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping ()... | @@ -25,6 +26,20 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
_selection = .init(initialValue: Set(projectsURL.prefix(1)))
_recentProjects = .init(initialValue: projectsURL)
+ donateSearchableItems()
+ }
+ func donateSearc... | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.571 | suggestion | 79 | 51 | 51 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE:
import SwiftUI
import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State va... | Remove the `CSSearchableItem` type. The `recentProjects` variable is a `[URL]`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Voi... | `entity.lastPathComponent` is already a String, no need to cast | import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Voi... | @@ -25,6 +26,20 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
_selection = .init(initialValue: Set(projectsURL.prefix(1)))
_recentProjects = .init(initialValue: projectsURL)
+ donateSearchableItems()
+ }
+ func donateSearc... | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.5 | suggestion | 63 | 51 | 51 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE: import CoreSpotlight
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects... | `entity.lastPathComponent` is already a String, no need to cast | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @es... | `entity.path()` is already a String, no need to cast |
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @es... | @@ -25,6 +26,20 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
_selection = .init(initialValue: Set(projectsURL.prefix(1)))
_recentProjects = .init(initialValue: projectsURL)
+ donateSearchableItems()
+ }
+ func donateSearc... | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.5 | suggestion | 52 | 51 | 51 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE:
struct RecentProjectsListView: View {
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private ... | `entity.path()` is already a String, no need to cast | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @escaping () -> Void) {
self.openD... | `entity.path()` is already a String, no need to cast |
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -> Void) -> Void
private let dismissWindow: () -> Void
init(openDocument: @escaping (URL?, @escaping () -> Void) -> Void, dismissWindow: @escaping () -> Void) {
self.openD... | @@ -25,6 +26,20 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
_selection = .init(initialValue: Set(projectsURL.prefix(1)))
_recentProjects = .init(initialValue: projectsURL)
+ donateSearchableItems()
+ }
+ func donateSearc... | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.5 | suggestion | 52 | 51 | 51 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE:
@State private var selection: Set<URL>
@State var recentProjects: [URL]
private let openDocument: (URL?, @escaping () -... | `entity.path()` is already a String, no need to cast | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
recentProjects = projectsURL
}
func updateRecentProjects() {
let recentProjectPaths: [String] = UserDefaults.standard.array(
forKey: "recentProjectPaths"
) as? [String] ?? []
let projectsURL = rec... | No need for a success message. The message for the error will eventually be integrated into a better logging solution for the application. | let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
recentProjects = projectsURL
}
func updateRecentProjects() {
let recentProjectPaths: [String] = UserDefaults.standard.array(
forKey: "recentProjectPaths"
) as? [String] ?? []
let projectsURL = rec... | @@ -118,4 +120,23 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
recentProjects = projectsURL
}
+ public func donateSearchableItems() {
+ let searchableItems = recentProjects.map { entity in
+ let attributeSet = CSSearc... | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.571 | suggestion | 138 | 32 | 31 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE: let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
recentProjects = projectsURL
}
func updateRec... | No need for a success message. The message for the error will eventually be integrated into a better logging solution for the application. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
listEmptyView
}
}
}
}
func removeRecentProjects(_ items: Set<URL>) {
var recentProjectPaths: [String] = UserDefaults.standard.array(
forKey: "recentProjectPaths"
) as? [String] ?? []
items.forEach { url in
r... | Needs a space between function declarations | listEmptyView
}
}
}
}
func removeRecentProjects(_ items: Set<URL>) {
var recentProjectPaths: [String] = UserDefaults.standard.array(
forKey: "recentProjectPaths"
) as? [String] ?? []
items.forEach { url in
r... | @@ -118,4 +120,23 @@ struct RecentProjectsListView: View {
let projectsURL = recentProjectPaths.map { URL(filePath: $0) }
recentProjects = projectsURL
} | CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift | 26 | Swift | 0.071 | suggestion | 43 | 47 | 46 | false | All recent projects searchable in Spotlight | 1,680 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/Welcome/Views/RecentProjectsListView.swift
PR Title: All recent projects searchable in Spotlight
BEFORE CODE: listEmptyView
}
}
}
}
func removeRecentProjects(_ items: Set<URL>) {... | Needs a space between function declarations | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/// - file: The file or folder to delete
/// - Authors: Paul Ebose
public func trash(file: CEWorkspaceFile) {
let message: String
if !file.isFolder || file.isEmptyFolder { // if its a file or an empty folder, call it by its name
message = file.name
} else {
... | Can we just print the error instead of throwing a fatal error? We will eventually move to a proper logging solution. | /// - file: The file or folder to delete
/// - Authors: Paul Ebose
public func trash(file: CEWorkspaceFile) {
let message: String
if !file.isFolder || file.isEmptyFolder { // if its a file or an empty folder, call it by its name
message = file.name
} else {
... | @@ -88,29 +88,73 @@ extension CEWorkspaceFileManager {
)
}
- /// This function deletes the item or folder from the current project
+ /// This function deletes the item or folder from the current project by moving to Trash
+ /// - Parameters:
+ /// - file: The file or folder to delete
+ ... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift | 26 | Swift | 0.571 | question | 116 | 51 | 51 | false | fix: distinguish between Move to Trash and Delete Immediately when right clicking a file or folder. | 1,694 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | plbstl | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift
PR Title: fix: distinguish between Move to Trash and Delete Immediately when right clicking a file or folder.
BEFORE CODE: /// - file: The file or folder to delete
/// - ... | Can we just print the error instead of throwing a fatal error? We will eventually move to a proper logging solution. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
}
/// This function deletes the item or folder from the current project by moving to Trash
/// - Parameters:
/// - file: The file or folder to delete
/// - Authors: Paul Ebose
public func trash(file: CEWorkspaceFile) {
if fileManager.fileExists(atPath: file.url.path) {
... | Should this variable be renamed to `fileName`? | )
}
/// This function deletes the item or folder from the current project by moving to Trash
/// - Parameters:
/// - file: The file or folder to delete
/// - Authors: Paul Ebose
public func trash(file: CEWorkspaceFile) {
if fileManager.fileExists(atPath: file.url.path) {
... | @@ -129,30 +110,11 @@ extension CEWorkspaceFileManager {
public func delete(file: CEWorkspaceFile, confirmDelete: Bool = true) {
// This function also has to account for how the
// - file system can change outside of the editor
- let messageText: String
- let informativeText: String... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift | 26 | Swift | 0.286 | question | 46 | 51 | 51 | false | delete warning message uses enumerator instead of shallow search | 1,699 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | knotbin | Review this pull request change.
Language: Swift
File: CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift
PR Title: delete warning message uses enumerator instead of shallow search
BEFORE CODE: )
}
/// This function deletes the item or folder from the current project b... | Should this variable be renamed to `fileName`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.