before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
/// 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) {
do {
... | We should put quotes around the file name. Make sure to use left quote and right quote characters. | /// 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) {
do {
... | @@ -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 | suggestion | 98 | 51 | 51 | false | delete warning message uses enumerator instead of shallow search | 1,699 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | knotbin |
//
// Created by Pavel Kasila on 20.03.22.
//
import AppKit
import AVKit
import CodeEditSourceEditor
import SwiftUI
struct EditorAreaFileView: View {
@EnvironmentObject private var editorManager: EditorManager
@EnvironmentObject private var editor: Editor
@Environment(\.edgeInsets)
private var edge... | Instead of reading the entire file into memory like this, would it work the same way to just check the document's `content` property for `isEmpty`? That would be a much more efficient operation, as this would potentially read a large file into memory quite often. | //
// Created by Pavel Kasila on 20.03.22.
//
import AppKit
import AVKit
import CodeEditSourceEditor
import SwiftUI
struct EditorAreaFileView: View {
@EnvironmentObject private var editorManager: EditorManager
@EnvironmentObject private var editor: Editor
@Environment(\.edgeInsets)
private var edge... | @@ -26,7 +26,7 @@ struct EditorAreaFileView: View {
@ViewBuilder var editorAreaFileView: some View {
if let document = file.fileDocument {
- if let utType = document.utType, utType.conforms(to: .text) {
+ if let fileURL = document.fileURL, (try? String(contentsOf: fileURL)) != nil ... | CodeEdit/Features/Editor/Views/EditorAreaFileView.swift | 26 | Swift | 0.786 | performance | 263 | 51 | 51 | false | Allow text files to be edited even when empty | 1,724 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | plbstl |
@State private var bracketPairHighlight: BracketPairHighlight? = {
let theme = ThemeModel.shared.selectedTheme ?? ThemeModel.shared.themes.first!
let color = Settings[\.textEditing].bracketHighlight.useCustomColor
? Settings[\.textEditing].bracketHighlight.color.nsColor
: theme.edit... | What do you think about this approach? Then we will don't need this `sourceEditorText` anymore
```swift
CodeEditSourceEditor(
Binding(
get: { codeFile.content ?? "" },
set: { codeFile.content = $0 }
)
}
``` | return .flash
case .bordered:
return .bordered(color: color)
case .underline:
return .underline(color: color)
}
}()
@Environment(\.edgeInsets)
private var edgeInsets
@EnvironmentObject private var editor: Editor
var body: some View {
... | @@ -109,7 +115,7 @@ struct CodeFileView: View {
var body: some View {
CodeEditSourceEditor(
- $codeFile.content,
+ sourceEditorText, | CodeEdit/Features/Editor/Views/CodeFileView.swift | 26 | Swift | 0.786 | question | 255 | 51 | 51 | false | Allow text files to be edited even when empty | 1,724 | CodeEditApp/CodeEdit | 18,361 | Swift | markgravity | plbstl |
//
// KeyValueTable.swift
// CodeEdit
//
// Created by Abe Malla on 5/16/24.
//
import SwiftUI
struct KeyValueItem: Identifiable {
var id: String { key }
let key: String
let value: String
}
private struct NewListTableItemView: View {
@State private var key = ""
@State private var value = ""
... | Could we use a `UUID` instead? | //
// KeyValueTable.swift
// CodeEdit
//
// Created by Abe Malla on 5/16/24.
//
import SwiftUI
struct KeyValueItem: Identifiable, Equatable {
let id = UUID()
let key: String
let value: String
}
private struct NewListTableItemView: View {
@Environment(\.dismiss)
var dismiss
@State private ... | @@ -0,0 +1,92 @@
+//
+// KeyValueTable.swift
+// CodeEdit
+//
+// Created by Abe Malla on 5/16/24.
+//
+
+import SwiftUI
+
+struct KeyValueItem: Identifiable {
+ var id: String { key } | CodeEdit/Features/CodeEditUI/Views/KeyValueTable.swift | 11 | Swift | 0.286 | question | 30 | 36 | 36 | false | Developer settings menu | 1,733 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | FastestMolasses |
Text("Enter new key-value pair")
TextField("Key", text: $key)
.textFieldStyle(.roundedBorder)
TextField("Value", text: $value)
.textFieldStyle(.roundedBorder)
Button("Add") {
if !key.isEmpty && !value.isEmpty {
... | Could we use something more descriptive than `Key` and `Value`? | let keyColumnName: String
let valueColumnName: String
let newItemInstruction: String
let headerView: AnyView?
var completion: (String, String) -> Void
init(
_ keyColumnName: String,
_ valueColumnName: String,
_ newItemInstruction: String,
headerView: AnyView? = n... | @@ -0,0 +1,92 @@
+//
+// KeyValueTable.swift
+// CodeEdit
+//
+// Created by Abe Malla on 5/16/24.
+//
+
+import SwiftUI
+
+struct KeyValueItem: Identifiable {
+ var id: String { key }
+ let key: String
+ let value: String
+}
+
+private struct NewListTableItemView: View {
+ @State private var key = ""
+ ... | CodeEdit/Features/CodeEditUI/Views/KeyValueTable.swift | 26 | Swift | 0.429 | question | 63 | 51 | 51 | false | Developer settings menu | 1,733 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | FastestMolasses |
SettingsPage(
.search,
baseColor: .blue,
icon: .system("magnifyingglass")
)
),
.init(
SettingsPage(
.sourceControl,
baseColor: .blue,
icon: .symbol("vault")
)
... | The flask reminds me more of tests or experimental settings. Could we use something different? As a side note, this shouldn't block the PR, just something to keep in mind. | .init(
SettingsPage(
.search,
baseColor: .blue,
icon: .system("magnifyingglass")
)
),
.init(
SettingsPage(
.sourceControl,
baseColor: .blue,
icon: .symbol("vault")
... | @@ -84,6 +84,14 @@ struct SettingsView: View {
baseColor: .green,
icon: .system("externaldrive.fill")
)
+ ),
+ // TODO: REMOVE THIS SECTION WHEN WE HAVE A SOLUTION FOR GETTING LSP BINARIES
+ .init(
+ SettingsPage(
+ .developer... | CodeEdit/Features/Settings/SettingsView.swift | 26 | Swift | 0.429 | suggestion | 171 | 51 | 51 | false | Developer settings menu | 1,733 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | FastestMolasses |
//
// KeyValueTable.swift
// CodeEdit
//
// Created by Abe Malla on 5/16/24.
//
import SwiftUI
struct KeyValueItem: Identifiable {
var id: String { key }
let key: String
let value: String
}
private struct NewListTableItemView: View {
@State private var key = ""
@State private var value = ""
... | Could you provide better instructions on what to enter into the text fields, e.g., `path`? | //
// KeyValueTable.swift
// CodeEdit
//
// Created by Abe Malla on 5/16/24.
//
import SwiftUI
struct KeyValueItem: Identifiable, Equatable {
let id = UUID()
let key: String
let value: String
}
private struct NewListTableItemView: View {
@Environment(\.dismiss)
var dismiss
@State private ... | @@ -0,0 +1,92 @@
+//
+// KeyValueTable.swift
+// CodeEdit
+//
+// Created by Abe Malla on 5/16/24.
+//
+
+import SwiftUI
+
+struct KeyValueItem: Identifiable {
+ var id: String { key }
+ let key: String
+ let value: String
+}
+
+private struct NewListTableItemView: View {
+ @State private var key = ""
+ ... | CodeEdit/Features/CodeEditUI/Views/KeyValueTable.swift | 23 | Swift | 0.429 | question | 90 | 48 | 48 | false | Developer settings menu | 1,733 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | FastestMolasses |
let command = "remote -v"
let output = try await run(command)
let remotes = parseGitRemotes(from: output)
return remotes
}
/// Add existing remote to local git
/// - Parameter name: Name for remote
/// - Parameter location: URL string for remote location
func addRem... | I'm definitely open to comments on this function. A few things I'm not 100% on:
1. Is my approach idiomatic Swift? Would a seasoned Swift programmer do it differently? (I am not a seasoned Swift programmer!) For example, the explicit `do / catch` construct feels a bit old skool; maybe you'd prefer `guard let remote ... | let command = "remote -v"
let output = try await run(command)
let remotes = parseGitRemotes(from: output)
return remotes
}
/// Add existing remote to local git
/// - Parameter name: Name for remote
/// - Parameter location: URL string for remote location
func addRem... | @@ -31,6 +31,20 @@ extension GitClient {
func removeRemote(name: String) async throws {
_ = try await run("remote rm \(name)")
}
+
+ /// Get the URL of the remote
+ /// > Note: If a git repository has multiple remotes, by default the `origin` remote
+ /// > will be used, unless there’s an up... | CodeEdit/Features/Git/Client/GitClient+Remote.swift | 26 | Swift | 0.643 | suggestion | 743 | 51 | 51 | false | Show Git history in the History Inspector, even when a remote is not configured | 1,744 | CodeEditApp/CodeEdit | 18,361 | Swift | simonwhitaker | simonwhitaker |
/// The weight of the custom font
var weight: NSFont.Weight = .medium
/// Default initializer
init() {}
/// Explicit decoder init for setting default values when key is not present in `JSON`
init(from decoder: Decoder) throws {
let container = try decoder.co... | Could you move these extensions to a separate file? Maybe call it `NSFont+WithWeight.swift` | //
// 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... | @@ -175,14 +179,66 @@ extension SettingsData {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.size = try container.decodeIfPresent(Double.self, forKey: .size) ?? size
self.name = try container.decodeIfPresent(String.self, forKey: .name) ?? name
+ s... | CodeEdit/Features/Settings/Pages/TextEditingSettings/Models/TextEditingSettings.swift | 26 | Swift | 0.429 | question | 91 | 51 | 195 | false | Added font weight pickers to text editing and terminal settings | 1,758 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | austincondiff |
//
// QuickSearchResultLabel.swift
// CodeEdit
//
// Copyright © 2024-present Paul Ebose. All rights reserved.
//
import SwiftUI
/// Implementation of command palette entity. While swiftui does not allow to use NSMutableAttributeStrings,
/// the only way to fallback to UIKit and have NSViewRepresentable to be a br... | Due to the license of the project, we cannot include copyrighted code. Can we ask you resubmit a new implementation or a version without the notice? It needs to replace this commit entirely otherwise it will still be in the commit history. | //
// QuickSearchResultLabel.swift
// CodeEdit
//
// Created by Paul Ebose on 2024/7/2.
//
import SwiftUI
/// Implementation of command palette entity. While swiftui does not allow to use NSMutableAttributeStrings,
/// the only way to fallback to UIKit and have NSViewRepresentable to be a bridge between UIKit and ... | @@ -0,0 +1,52 @@
+//
+// QuickSearchResultLabel.swift
+// CodeEdit
+//
+// Copyright © 2024-present Paul Ebose. All rights reserved. | CodeEdit/Features/Search/Views/QuickSearchResultLabel.swift | 5 | Swift | 0.5 | suggestion | 239 | 30 | 30 | false | highlight search query in 'Open Quickly' results | 1,790 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | plbstl |
/// Highlights currently entered text query
struct QuickSearchResultLabel: NSViewRepresentable {
let labelName: String
let charactersToHighlight: [NSRange]
var nsLabelName: NSAttributedString?
public func makeNSView(context: Context) -> some NSTextField {
let label = NSTextField(wrappingLabelWi... | ```suggestion
attribText.addAttribute(.foregroundColor, value: NSColor.controlTextColor, range: range)
``` | /// Highlights currently entered text query
struct QuickSearchResultLabel: NSViewRepresentable {
let labelName: String
let charactersToHighlight: [NSRange]
var nsLabelName: NSAttributedString?
public func makeNSView(context: Context) -> some NSTextField {
let label = NSTextField(wrappingLabelWi... | @@ -0,0 +1,47 @@
+//
+// QuickSearchResultLabel.swift
+// CodeEdit
+//
+// Created by Paul Ebose on 2024/7/2.
+//
+
+import SwiftUI
+
+/// Implementation of command palette entity. While swiftui does not allow to use NSMutableAttributeStrings,
+/// the only way to fallback to UIKit and have NSViewRepresentable to be... | CodeEdit/Features/Search/Views/QuickSearchResultLabel.swift | 26 | Swift | 0.714 | suggestion | 120 | 37 | 41 | false | highlight search query in 'Open Quickly' results | 1,790 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | plbstl |
let label = NSTextField(wrappingLabelWithString: labelName)
label.translatesAutoresizingMaskIntoConstraints = false
label.drawsBackground = false
label.textColor = .labelColor
label.isEditable = false
label.isSelectable = false
label.font = .labelFont(ofSize: 13)
... | ```suggestion
nsView.textColor = if nsLabelName == nil && charactersToHighlight.isEmpty {
.controlTextColor
} else {
.secondaryLabelColor
}
``` | let label = NSTextField(wrappingLabelWithString: labelName)
label.translatesAutoresizingMaskIntoConstraints = false
label.drawsBackground = false
label.textColor = .labelColor
label.isEditable = false
label.isSelectable = false
label.font = .labelFont(ofSize: 13)
... | @@ -0,0 +1,47 @@
+//
+// QuickSearchResultLabel.swift
+// CodeEdit
+//
+// Created by Paul Ebose on 2024/7/2.
+//
+
+import SwiftUI
+
+/// Implementation of command palette entity. While swiftui does not allow to use NSMutableAttributeStrings,
+/// the only way to fallback to UIKit and have NSViewRepresentable to be... | CodeEdit/Features/Search/Views/QuickSearchResultLabel.swift | 26 | Swift | 0.714 | suggestion | 197 | 30 | 34 | false | highlight search query in 'Open Quickly' results | 1,790 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | plbstl |
/// They can, however, be created standalone when necessary. Creating a standalone ``CEWorkspaceFile`` is useful if
/// loading all intermediate subdirectories (from the nearest cached parent to the file) has not been done yet and doing
/// so would be unnecessary.
///
/// An example of this is in the ``OpenQuicklyView... | This is not very efficient in my opinion... Instead of using `hasPrefix(".")`, we check `fileName.first == "."`. This is faster as it only checks the first character. | /// They can, however, be created standalone when necessary. Creating a standalone ``CEWorkspaceFile`` is useful if
/// loading all intermediate subdirectories (from the nearest cached parent to the file) has not been done yet and doing
/// so would be unnecessary.
///
/// An example of this is in the ``OpenQuicklyView... | @@ -42,7 +42,19 @@ final class CEWorkspaceFile: Codable, Comparable, Hashable, Identifiable, Editor
var name: String { url.lastPathComponent.trimmingCharacters(in: .whitespacesAndNewlines) }
/// Returns the extension of the file or an empty string if no extension is present.
- var type: FileIcon.FileType... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFile.swift | 26 | Swift | 0.571 | performance | 167 | 51 | 51 | false | Fix: Validate filenames consisting solely of extensions | 1,802 | CodeEditApp/CodeEdit | 18,361 | Swift | nanashili | LeonardoLarranaga |
self.tabs = []
self.parent = parent
files.forEach { openTab(file: $0) }
self.selectedTab = selectedTab ?? (files.isEmpty ? nil : Tab(file: files.first!))
self.temporaryTab = temporaryTab
}
init(
files: OrderedSet<Tab> = [],
selectedTab: Tab? = nil,
... | Which part in this function writes the changes to the file on disk? |
init(
files: OrderedSet<Tab> = [],
selectedTab: Tab? = nil,
temporaryTab: Tab? = nil,
parent: SplitViewData? = nil
) {
self.tabs = []
self.parent = parent
files.forEach { openTab(file: $0.file) }
self.selectedTab = selectedTab ?? tabs.first
... | @@ -106,22 +100,26 @@ final class Editor: ObservableObject, Identifiable {
/// Closes a tab in the editor.
/// This will also write any changes to the file on disk and will add the tab to the tab history. | CodeEdit/Features/Editor/Models/Editor.swift | 26 | Swift | 0.286 | question | 67 | 51 | 51 | false | Fix Navigator Key Navigation Explosion | 1,803 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | thecoolwinter |
selectedTab = change.first
} else {
// Selected file was removed
if let selectedTab, change.contains(selectedTab) {
if let oldIndex = oldValue.firstIndex(of: selectedTab), oldIndex - 1 < tabs.count, !tabs.isEmpty {
s... | It would be awesome to use private(set) or fileprivate(set) here to keep things encapsulated, but since the extension is in a different file, it's not possible... | selectedTab = change.first
} else {
// Selected file was removed
if let selectedTab, change.contains(selectedTab) {
if let oldIndex = oldValue.firstIndex(of: selectedTab), oldIndex - 1 < tabs.count, !tabs.isEmpty {
s... | @@ -35,22 +35,16 @@ final class Editor: ObservableObject, Identifiable {
}
/// The current offset in the history list.
+ /// When set, updates the ``selectedTab`` to the tab indicated by the offset.
+ /// See the ``historyOffsetDidChange()`` method for more details.
@Published var historyOffset: ... | CodeEdit/Features/Editor/Models/Editor.swift | 26 | Swift | 0.429 | suggestion | 162 | 51 | 51 | false | Fix Navigator Key Navigation Explosion | 1,803 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter |
}
}
}
@IBAction func openQuickly(_ sender: Any?) {
if let workspace, let state = workspace.openQuicklyViewModel {
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
return
... | I don't think it's good practice to add child variables of an object to an environment?
Besides, you can always access them via the workspace environment variable.
Lastly, you're force unwrapping these variables, if they are `nil` for some reason, CodeEdit will fatally crash. | if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
return
} else {
window?.addChildWindow(quickOpenPanel, ordered: .above)
quickOpenPanel.makeKeyAndOrderFront(self)
... | @@ -151,7 +151,10 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
panel.close()
} openFile: { file in
workspace.editorManager?.openTab(item: file)
- }.environmentObject(workspace)
+ }
+ ... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | bug | 282 | 51 | 51 | false | Correctly view non-text files in single file window and Open Quickly | 1,820 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | plbstl |
if contentType.conforms(to: .image), let imageReps = NSImage(contentsOf: url)?.representations.first {
let dimensions = ImageDimensions(width: imageReps.pixelsWide, height: imageReps.pixelsHigh)
return ComputedStatusBarInfo(fileSize: fileSize, dimensions: dimensions)
} else { // ... | I don't know if we want this modifier applicable to every `View`
@thecoolwinter @Wouter01 Your opinion on this? | if contentType.conforms(to: .image), let imageReps = NSImage(contentsOf: fileURL)?.representations.first {
let dimensions = ImageDimensions(width: imageReps.pixelsWide, height: imageReps.pixelsHigh)
return ComputedStatusBarInfo(fileSize: fileSize, dimensions: dimensions)
} else {... | @@ -61,3 +65,9 @@ struct UpdateStatusBarInfo: ViewModifier {
}
}
+
+extension View { | CodeEdit/Features/StatusBar/ViewModifiers/UpdateStatusBarInfo.swift | 26 | Swift | 0.5 | question | 114 | 31 | 29 | false | Correctly view non-text files in single file window and Open Quickly | 1,820 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | plbstl |
//
// WindowCodeFileView.swift
// CodeEdit
//
// Created by Khan Winter on 3/19/23.
//
import Foundation
import SwiftUI
/// View that fixes [#1158](https://github.com/CodeEditApp/CodeEdit/issues/1158)
/// # Should **not** be used other than in a single file window.
struct WindowCodeFileView: View {
var codeFil... | For other reviewers, I remember these being used to avoid an endless loading screen for large files but can't reproduce it anymore. Might be CETV changes or changes related here but I think this change is fine. | //
// WindowCodeFileView.swift
// CodeEdit
//
// Created by Khan Winter on 3/19/23.
//
import Foundation
import SwiftUI
/// View that fixes [#1158](https://github.com/CodeEditApp/CodeEdit/issues/1158)
/// # Should **not** be used other than in a single file window.
struct WindowCodeFileView: View {
var codeFil... | CodeEdit/Features/Editor/Views/WindowCodeFileView.swift | 1 | Swift | 0.5 | suggestion | 210 | 26 | 24 | false | Correctly view non-text files in single file window and Open Quickly | 1,820 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | plbstl | |
Button {
// TODO: #1874
} label: {
Text("Export All Custom Themes...")
}.disabled(true)
}
})
... | I'm getting a crash here whenever deleting a theme while searching. For example deleting the theme here without clearing the search field.

| Button {
// TODO: #1874
} label: {
Text("Export All Custom Themes...")
}.disabled(true)
}
})
... | @@ -18,85 +18,127 @@ struct ThemeSettingsView: View {
var useDarkTerminalAppearance
@State private var listView: Bool = false
+ @State private var themeSearchQuery: String = ""
+ @State private var filteredThemes: [Theme] = []
var body: some View {
- SettingsForm {
- Section {... | CodeEdit/Features/Settings/Pages/ThemeSettings/ThemeSettingsView.swift | 26 | Swift | 0.5 | bug | 264 | 51 | 51 | false | feat(themes): Add fuzzy search for filtering and sorting themes in settings | 1,849 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | tom-ludwig |
/// - Parameter events: An array of events that occurred.
private func fileSystemEventReceived(events: [DirectoryEventStream.Event]) {
DispatchQueue.main.async {
var files: Set<CEWorkspaceFile> = []
for event in events {
// Event returns file/folder that was chang... | ```suggestion
self.logger.error(
"Failed to rebuild files for event: \(event.eventType.rawValue), path: \(event.path, privacy: .sensitive)"
)
``` | /// This method may be called on a background thread, but all work done by this function will be queued on the main
/// thread.
/// - Parameter events: An array of events that occurred.
private func fileSystemEventReceived(events: [DirectoryEventStream.Event]) {
DispatchQueue.main.async {
... | @@ -220,7 +222,12 @@ final class CEWorkspaceFileManager {
// TODO: Handle workspace root changing.
continue
case .itemCreated, .itemCloned, .itemRemoved, .itemRenamed:
- try? self.rebuildFiles(fromItem: parentItem)
+ do {
+... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager.swift | 26 | Swift | 0.929 | bug | 229 | 51 | 51 | false | Rebuild Cached Files After Rename, Git Status Label | 1,866 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter |
//
// CodeEditWindowController.swift
// CodeEdit
//
// Created by Pavel Kasila on 18.03.22.
//
import Cocoa
import SwiftUI
import Combine
final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, ObservableObject, NSWindowDelegate {
@Published var navigatorCollapsed = false
@Published va... | You might call this "panelOpen".
```suggestion
private var panelOpen = false
``` | //
// CodeEditWindowController.swift
// CodeEdit
//
// Created by Pavel Kasila on 18.03.22.
//
import Cocoa
import SwiftUI
import Combine
final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, ObservableObject, NSWindowDelegate {
@Published var navigatorCollapsed = false
@Published va... | @@ -14,6 +14,8 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
@Published var inspectorCollapsed = false
@Published var toolbarCollapsed = false
+ private var modalOpen = false | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 17 | Swift | 0.571 | suggestion | 89 | 42 | 42 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
let navigatorModel = NavigatorSidebarViewModel()
navigatorSidebarViewModel = navigatorModel
self.listenToDocumentEdited(workspace: workspace)
return CodeEditSplitViewController(
workspace: workspace,
navigatorViewModel: navigatorModel,
windowRef: windo... | ```suggestion
self.panelOpen = false
``` | let navigatorModel = NavigatorSidebarViewModel()
navigatorSidebarViewModel = navigatorModel
self.listenToDocumentEdited(workspace: workspace)
return CodeEditSplitViewController(
workspace: workspace,
navigatorViewModel: navigatorModel,
windowRef: windo... | @@ -109,20 +111,26 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let commandPalettePanel {
if commandPalettePanel.isKeyWindow {
commandPalettePanel.close()
+ self.modalOpen = false | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 62 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
)
}
private func getSelectedCodeFile() -> CodeFileDocument? {
workspace?.editorManager?.activeEditor.selectedTab?.file.fileDocument
}
@IBAction func saveDocument(_ sender: Any) {
guard let codeFile = getSelectedCodeFile() else { return }
codeFile.save(sender)
wo... | ```suggestion
self.panelOpen = true
``` | )
}
private func getSelectedCodeFile() -> CodeFileDocument? {
workspace?.editorManager?.activeEditor.selectedTab?.file.fileDocument
}
@IBAction func saveDocument(_ sender: Any) {
guard let codeFile = getSelectedCodeFile() else { return }
codeFile.save(sender)
wo... | @@ -109,20 +111,26 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let commandPalettePanel {
if commandPalettePanel.isKeyWindow {
commandPalettePanel.close()
+ self.modalOpen = false
state.r... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 61 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
@IBAction func saveDocument(_ sender: Any) {
guard let codeFile = getSelectedCodeFile() else { return }
codeFile.save(sender)
workspace?.editorManager?.activeEditor.temporaryTab = nil
}
@IBAction func openCommandPalette(_ sender: Any) {
if let workspace, let state = workspac... | ```suggestion
self.panelOpen = false
``` | @IBAction func saveDocument(_ sender: Any) {
guard let codeFile = getSelectedCodeFile() else { return }
codeFile.save(sender)
workspace?.editorManager?.activeEditor.temporaryTab = nil
}
@IBAction func openCommandPalette(_ sender: Any) {
if let workspace, let state = workspac... | @@ -109,20 +111,26 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let commandPalettePanel {
if commandPalettePanel.isKeyWindow {
commandPalettePanel.close()
+ self.modalOpen = false
state.r... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 62 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
@IBAction func openCommandPalette(_ sender: Any) {
if let workspace, let state = workspace.commandsPaletteState {
if let commandPalettePanel {
if commandPalettePanel.isKeyWindow {
commandPalettePanel.close()
self.modalOpen = false
... | ```suggestion
self.panelOpen = true
``` |
@IBAction func openCommandPalette(_ sender: Any) {
if let workspace, let state = workspace.commandsPaletteState {
if let commandPalettePanel {
if commandPalettePanel.isKeyWindow {
commandPalettePanel.close()
self.panelOpen = false
... | @@ -109,20 +111,26 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let commandPalettePanel {
if commandPalettePanel.isKeyWindow {
commandPalettePanel.close()
+ self.modalOpen = false
state.r... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 57 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
state.reset()
window?.addChildWindow(commandPalettePanel, ordered: .above)
commandPalettePanel.makeKeyAndOrderFront(self)
self.modalOpen = true
}
} else {
let panel = SearchPanel()
... | ```suggestion
self.panelOpen = false
``` | state.reset()
window?.addChildWindow(commandPalettePanel, ordered: .above)
commandPalettePanel.makeKeyAndOrderFront(self)
self.panelOpen = true
}
} else {
let panel = SearchPanel()
... | @@ -132,29 +140,34 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
+ self.modalOpen = false | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 62 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
} else {
let panel = SearchPanel()
self.commandPalettePanel = panel
let contentView = QuickActionsView(state: state) {
panel.close()
self.modalOpen = false
}
panel.contentView = NSHostingV... | ```suggestion
self.panelOpen = true
``` | } else {
let panel = SearchPanel()
self.commandPalettePanel = panel
let contentView = QuickActionsView(state: state) {
panel.close()
self.panelOpen = false
}
panel.contentView = NSHostingV... | @@ -132,29 +140,34 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
+ self.modalOpen = false
return
... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 61 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
window?.addChildWindow(panel, ordered: .above)
panel.makeKeyAndOrderFront(self)
self.modalOpen = true
}
}
}
@IBAction func openQuickly(_ sender: Any?) {
if let workspace, let state = workspace.openQuicklyViewModel {
if let ... | ```suggestion
self.panelOpen = false
``` | window?.addChildWindow(panel, ordered: .above)
panel.makeKeyAndOrderFront(self)
self.panelOpen = true
}
}
}
@IBAction func openQuickly(_ sender: Any?) {
if let workspace, let state = workspace.openQuicklyViewModel {
if let ... | @@ -132,29 +140,34 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
+ self.modalOpen = false
return
... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 62 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
if let workspace, let state = workspace.openQuicklyViewModel {
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
self.modalOpen = false
return
} else {
window?... | ```suggestion
self.panelOpen = true
``` | if let workspace, let state = workspace.openQuicklyViewModel {
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
self.panelOpen = false
return
} else {
window?... | @@ -132,29 +140,34 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
+ self.modalOpen = false
return
... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 57 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
} else {
window?.addChildWindow(quickOpenPanel, ordered: .above)
quickOpenPanel.makeKeyAndOrderFront(self)
self.modalOpen = true
}
} else {
let panel = SearchPanel()
self.quickOpenPane... | ```suggestion
if self.panelOpen { return }
``` | } else {
window?.addChildWindow(quickOpenPanel, ordered: .above)
quickOpenPanel.makeKeyAndOrderFront(self)
self.panelOpen = true
}
} else {
let panel = SearchPanel()
self.quickOpenPane... | @@ -132,29 +140,34 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate, Obs
if let quickOpenPanel {
if quickOpenPanel.isKeyWindow {
quickOpenPanel.close()
+ self.modalOpen = false
return
... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 26 | Swift | 0.571 | suggestion | 56 | 51 | 51 | false | Closing tabs while Open Quickly or Command Palette is open is no longer allowed. | 1,868 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | scaredcr6w |
/// Terminates running language servers. Used during app termination to ensure resources are freed.
private func terminateLanguageServers() {
Task {
await withTaskGroup(of: Void.self) { group in
await lspService.languageClients.forEach { (key, value) in
g... | All tasks should be terminated, not just the active one. `stopAllTasks()` currently sends a `SIGINT`, but we should consider sending a `SIGTERM`.
```suggestion
workspace.taskManager?.stopAllTasks()
``` |
/// Terminates running language servers. Used during app termination to ensure resources are freed.
private func terminateLanguageServers() {
Task {
await lspService.stopAllServers()
await MainActor.run {
NSApplication.shared.reply(toApplicationShouldTerminate: t... | @@ -224,7 +245,38 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
@objc
func documentController(_ docController: NSDocumentController, didCloseAll: Bool, contextInfo: Any) {
- NSApplication.shared.reply(toApplicationShouldTerminate: didCloseAll)
+ if didCloseAll... | CodeEdit/AppDelegate.swift | 26 | Swift | 0.857 | suggestion | 216 | 42 | 32 | false | Clean Up Child Processes | 1,885 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter |
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
self?.checkForFilesToOpen()
}
}
/// Enable window size restoring on app relaunch after quitting.
private func enableWindowSizeSaveOnQuit() {
// This enables window restoring on normal quit (instead of o... | The LSP Service already has a function to stop all the language servers | DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
self?.checkForFilesToOpen()
}
}
/// Enable window size restoring on app relaunch after quitting.
private func enableWindowSizeSaveOnQuit() {
// This enables window restoring on normal quit (instead of o... | @@ -224,7 +245,38 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
@objc
func documentController(_ docController: NSDocumentController, didCloseAll: Bool, contextInfo: Any) {
- NSApplication.shared.reply(toApplicationShouldTerminate: didCloseAll)
+ if didCloseAll... | CodeEdit/AppDelegate.swift | 26 | Swift | 0.214 | suggestion | 71 | 51 | 51 | false | Clean Up Child Processes | 1,885 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | thecoolwinter |
import Foundation
extension WorkspaceDocument {
final class SearchState: ObservableObject {
enum IndexStatus: Equatable {
case none
case indexing(progress: Double)
case done
}
enum FindNavigatorStatus: Equatable {
case none
case ... | ```suggestion
/// Stores the user's input, shown when no files are found, and persists across navigation items.
``` |
import Foundation
extension WorkspaceDocument {
final class SearchState: ObservableObject {
enum IndexStatus: Equatable {
case none
case indexing(progress: Double)
case done
}
enum FindNavigatorStatus: Equatable {
case none
case ... | @@ -29,6 +29,7 @@ extension WorkspaceDocument {
@Published var searchResultsCount: Int = 0
/// searchQuery stands for the last search query that corresponds to the search results
/// At the time it's only purpose is to show the query if no files could be found
+ /// searchQuery persist... | CodeEdit/Features/Documents/WorkspaceDocument/WorkspaceDocument+SearchState.swift | 26 | Swift | 0.786 | suggestion | 125 | 51 | 51 | false | Fix search text disappearance on changing navigation item | 1,889 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | karan0046 |
self.temporaryTab = temporaryTab
}
/// Closes the editor.
func close() {
parent?.closeEditor(with: id)
}
/// Gets the editor layout.
func getEditorLayout() -> EditorLayout? {
return parent?.getEditorLayout(with: id)
}
/// Set the selected tab. Loads the file's ... | ```suggestion
do { // Ignore this error for simpler API usage.
| self.temporaryTab = temporaryTab
}
/// Closes the editor.
func close() {
parent?.closeEditor(with: id)
}
/// Gets the editor layout.
func getEditorLayout() -> EditorLayout? {
return parent?.getEditorLayout(with: id)
}
/// Set the selected tab. Loads the file's ... | @@ -98,6 +98,26 @@ final class Editor: ObservableObject, Identifiable {
return parent?.getEditorLayout(with: id)
}
+ /// Set the selected tab. Loads the file's contents if it hasn't already been opened.
+ /// - Parameter file: The file to set as the selected tab.
+ func setSelectedTab(_ file: C... | CodeEdit/Features/Editor/Models/Editor.swift | 26 | Swift | 0.714 | suggestion | 77 | 51 | 51 | false | EditorManager Always Opens Files | 1,892 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter |
//
// WorkspaceDocument.swift
// CodeEdit
//
// Created by Pavel Kasila on 17.03.22.
//
import AppKit
import SwiftUI
import Combine
import Foundation
import LanguageServerProtocol
@objc(WorkspaceDocument)
final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {
@Published var sortFolder... | This should be renamed to something a little more descriptive. Maybe `fileFilter`? Also a doc comment here explaining that this is for the project navigator would make this okay. | //
// WorkspaceDocument.swift
// CodeEdit
//
// Created by Pavel Kasila on 17.03.22.
//
import AppKit
import SwiftUI
import Combine
import Foundation
import LanguageServerProtocol
@objc(WorkspaceDocument)
final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {
@Published var sortFolder... | @@ -14,6 +14,7 @@ import LanguageServerProtocol
@objc(WorkspaceDocument)
final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {
@Published var sortFoldersOnTop: Bool = true
+ @Published var filter: String = "" | CodeEdit/Features/Documents/WorkspaceDocument/WorkspaceDocument.swift | 17 | Swift | 0.571 | suggestion | 178 | 42 | 42 | false | Project navigator file filtering | 1,896 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
//
// StandardTableViewCell.swift
// CodeEdit
//
// Created by TAY KAI QUAN on 17/8/22.
//
import SwiftUI
class StandardTableViewCell: NSTableCellView {
weak var secondaryLabel: NSTextField?
var workspace: WorkspaceDocument?
var secondaryLabelRightAligned: Bool = true {
didSet {
r... | Leaving out `weak` here worries me. I don't think this view should need to strongly reference the workspace object. | //
// StandardTableViewCell.swift
// CodeEdit
//
// Created by TAY KAI QUAN on 17/8/22.
//
import SwiftUI
class StandardTableViewCell: NSTableCellView {
weak var secondaryLabel: NSTextField?
weak var workspace: WorkspaceDocument?
var secondaryLabelRightAligned: Bool = true {
didSet {
... | @@ -10,7 +10,7 @@ import SwiftUI
class StandardTableViewCell: NSTableCellView {
weak var secondaryLabel: NSTextField?
- weak var workspace: WorkspaceDocument?
+ var workspace: WorkspaceDocument? | CodeEdit/Features/NavigatorArea/OutlineView/StandardTableViewCell.swift | 13 | Swift | 0.571 | suggestion | 115 | 38 | 38 | false | Project navigator file filtering | 1,896 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
}
func outlineViewSelectionDidChange(_ notification: Notification) {
guard let outlineView = notification.object as? NSOutlineView else { return }
let selectedIndex = outlineView.selectedRow
guard let item = outlineView.item(atRow: selectedIndex) as? CEWorkspaceFile else { return }
... | I notice you use the `workspace.filter` property over the navigator's `filter` property. Why don't we remove the navigator's filter property and just use the workspace one.
The publisher would also allow for adding a throttle to the filter changes which might help responsiveness.
```swift
private var filterListene... | }
func outlineViewSelectionDidChange(_ notification: Notification) {
guard let outlineView = notification.object as? NSOutlineView else { return }
let selectedIndex = outlineView.selectedRow
guard let item = outlineView.item(atRow: selectedIndex) as? CEWorkspaceFile else { return }
... | @@ -49,8 +54,14 @@ extension ProjectNavigatorViewController: NSOutlineViewDelegate {
}
func outlineViewItemDidExpand(_ notification: Notification) {
- guard let id = workspace?.editorManager?.activeEditor.selectedTab?.file.id,
- let item = workspace?.workspaceFileManager?.getFile(id, cre... | CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController+NSOutlineViewDelegate.swift | 26 | Swift | 1 | nitpick | 617 | 51 | 51 | false | Project navigator file filtering | 1,896 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
/// Expand or collapse the folder on double click
@objc
private func onItemDoubleClicked() {
guard let item = outlineView.item(atRow: outlineView.clickedRow) as? CEWorkspaceFile else { return }
if item.isFolder {
if outlineView.isItemExpanded(item) {
outlineView.... | One more thing for the expanded state, if the user closes the app before the expanded state can be restored, all folders will now be expanded when the user opens the app again.
We should disable expansion state restoration when the filter is active, just using `outlineView.autosaveExpandedItems = false/true`. That s... | if item.isFolder {
if outlineView.isItemExpanded(item) {
outlineView.collapseItem(item)
} else {
outlineView.expandItem(item)
}
} else if Settings[\.navigation].navigationStyle == .openInTabs {
workspace?.editorManager?.acti... | @@ -155,5 +186,78 @@ final class ProjectNavigatorViewController: NSViewController {
}
}
- // TODO: File filtering
+ private func handleFilterChange() {
+ filteredContentChildren.removeAll()
+ outlineView.reloadData()
+ | CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift | 26 | Swift | 0.643 | suggestion | 435 | 51 | 51 | false | Project navigator file filtering | 1,896 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
/// - frameRect: The frame of the cell.
/// - item: The file item the cell represents.
/// - isEditable: Set to true if the user should be able to edit the file name.
init(frame frameRect: NSRect, item: CEWorkspaceFile?, isEditable: Bool = true, workspace: WorkspaceDocument?) {
super.init(... | This cell class is used outside of the project navigator. Instead of grabbing the filter from the workspace, lets add an optional filter property and set it from the project navigator. That'll prevent the filter style from leaking into other UI elements like the search list. | /// - Parameters:
/// - frameRect: The frame of the cell.
/// - item: The file item the cell represents.
/// - isEditable: Set to true if the user should be able to edit the file name.
/// - navigatorFilter: An optional string use to filter the navigator area.
/// (U... | @@ -40,7 +40,52 @@ class FileSystemTableViewCell: StandardTableViewCell {
fileItem = item
imageView?.image = item.nsIcon
imageView?.contentTintColor = color(for: item)
- textField?.stringValue = item.labelFileName()
+
+ let fileName = item.labelFileName()
+
+ // Apply bol... | CodeEdit/Features/NavigatorArea/OutlineView/FileSystemTableViewCell.swift | 26 | Swift | 0.643 | suggestion | 275 | 51 | 51 | false | Project navigator file filtering | 1,896 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
func addIcon(item: CEWorkspaceFile) {
fileItem = item
imageView?.image = item.nsIcon
imageView?.contentTintColor = color(for: item)
let fileName = item.labelFileName()
// Apply bold style if the filename matches the workspace filter
if let filter = workspace?.filter... | ```suggestion
.foregroundColor: NSColor.labelColor
```
Fixes this selection color bug:


label.delegate = self
}
func addIcon(item: CEWorkspaceFile) {
fileItem = item
imageView?.image = item.nsIcon
imageView?.contentTintColor = color(for: item)
let fileName = item.labelFileName()
guard... | @@ -40,7 +40,52 @@ class FileSystemTableViewCell: StandardTableViewCell {
fileItem = item
imageView?.image = item.nsIcon
imageView?.contentTintColor = color(for: item)
- textField?.stringValue = item.labelFileName()
+
+ let fileName = item.labelFileName()
+
+ // Apply bol... | CodeEdit/Features/NavigatorArea/OutlineView/FileSystemTableViewCell.swift | 26 | Swift | 1 | bug | 337 | 51 | 51 | false | Project navigator file filtering | 1,896 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
let deleteConfirmation = NSAlert()
deleteConfirmation.messageText = "Do you want to delete “\(fileName)”?"
deleteConfirmation.informativeText = "This item will be deleted immediately. You can't undo this action."
deleteConfirmation.alertStyle = .critical
deleteConfirmation.addBut... | This is what Finder says when you try to delete multiple items immediately (I couldn't figure out how to delete files immediately in Xocde).
```suggestion
deleteConfirmation.messageText = "Are you sure you want to delete the \(files.count) selected items?"
deleteConfirmation.informativeText = "\(file... | let deleteConfirmation = NSAlert()
deleteConfirmation.messageText = "Do you want to delete “\(fileName)”?"
deleteConfirmation.informativeText = "This item will be deleted immediately. You can't undo this action."
deleteConfirmation.alertStyle = .critical
deleteConfirmation.addBut... | @@ -141,6 +141,29 @@ extension CEWorkspaceFileManager {
}
}
+ /// This function deletes multiple files or folders from the current project by erasing immediately.
+ /// - Parameters:
+ /// - files: The files to delete
+ /// - confirmDelete: True to present an alert to confirm the delete.... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift | 26 | Swift | 0.857 | suggestion | 398 | 51 | 51 | false | Select multiple files in the project navigator | 1,906 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | LeonardoLarranaga |
}
reloadData()
sender.outlineView.expandItem(item.isFolder ? item : item.parent)
}
// TODO: allow custom folder names
/// Action that creates a new untitled folder
@objc
func newFolder() {
guard let item else { return }
workspace?.workspaceFileManager?.addFol... | ```suggestion
var newFolderURL = parent.url.appendingPathComponent("New Folder With Items", conformingTo: .folder)
``` | }
reloadData()
sender.outlineView.expandItem(item.isFolder ? item : item.parent)
}
// TODO: allow custom folder names
/// Action that creates a new untitled folder
@objc
func newFolder() {
guard let item else { return }
workspace?.workspaceFileManager?.addFol... | @@ -0,0 +1,184 @@
+//
+// ProjectNavigatorMenuActions.swift
+// CodeEdit
+//
+// Created by Leonardo Larrañaga on 10/11/24.
+//
+
+import AppKit
+
+extension ProjectNavigatorMenu {
+ /// - Returns: the currently selected `CEWorkspaceFile` items in the outline view.
+ func selectedItems() -> Set<CEWorkspaceFile... | CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorMenuActions.swift | 26 | Swift | 0.714 | suggestion | 128 | 51 | 51 | false | Select multiple files in the project navigator | 1,906 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | LeonardoLarranaga |
// TODO: allow custom folder names
/// Action that creates a new untitled folder
@objc
func newFolder() {
guard let item else { return }
workspace?.workspaceFileManager?.addFolder(folderName: "untitled", toFile: item)
reloadData()
sender.outlineView.expandItem(item)
... | ```suggestion
newFolderURL = parent.url.appendingPathComponent("New Folder With Items \(folderNumber)")
``` |
// TODO: allow custom folder names
/// Action that creates a new untitled folder
@objc
func newFolder() {
guard let item else { return }
workspace?.workspaceFileManager?.addFolder(folderName: "untitled", toFile: item)
reloadData()
sender.outlineView.expandItem(item)
... | @@ -0,0 +1,184 @@
+//
+// ProjectNavigatorMenuActions.swift
+// CodeEdit
+//
+// Created by Leonardo Larrañaga on 10/11/24.
+//
+
+import AppKit
+
+extension ProjectNavigatorMenu {
+ /// - Returns: the currently selected `CEWorkspaceFile` items in the outline view.
+ func selectedItems() -> Set<CEWorkspaceFile... | CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorMenuActions.swift | 26 | Swift | 0.714 | suggestion | 121 | 51 | 51 | false | Select multiple files in the project navigator | 1,906 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | LeonardoLarranaga |
} catch {
fatalError(error.localizedDescription)
}
}
}
}
/// This function deletes multiple files or folders from the current project by erasing immediately.
/// - Parameters:
/// - files: The files to delete
/// - confirmD... | This will close the application. Just print out the error for now until we have better logging. | } catch {
fatalError(error.localizedDescription)
}
}
}
}
/// This function deletes multiple files or folders from the current project by erasing immediately.
/// - Parameters:
/// - files: The files to delete
/// - confirmD... | @@ -141,6 +141,30 @@ extension CEWorkspaceFileManager {
}
}
+ /// This function deletes multiple files or folders from the current project by erasing immediately.
+ /// - Parameters:
+ /// - files: The files to delete
+ /// - confirmDelete: True to present an alert to confirm the delete.... | CodeEdit/Features/CEWorkspace/Models/CEWorkspaceFileManager+FileManagement.swift | 26 | Swift | 0.429 | suggestion | 96 | 51 | 51 | false | Select multiple files in the project navigator | 1,906 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | LeonardoLarranaga |
/// Is entire tab being pressed.
@State private var isPressing: Bool = false
/// Is close button being pressed.
@State private var isPressingClose: Bool = false
/// A bool state for going-in animation.
///
/// By default, this value is `false`. When the root view is appeared, it turns `tru... | Might be an idea to rename this to something more descriptive? | /// Is entire tab being pressed.
@State private var isPressing: Bool = false
/// Is close button being pressed.
@State private var isPressingClose: Bool = false
/// A bool state for going-in animation.
///
/// By default, this value is `false`. When the root view is appeared, it turns `tru... | @@ -57,7 +60,7 @@ struct EditorTabView: View {
/// The item associated with the current tab.
///
/// You can get tab-related information from here, like `label`, `icon`, etc.
- private var item: CEWorkspaceFile
+ private let item: CEWorkspaceFile | CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabView.swift | 26 | Swift | 0.286 | question | 62 | 51 | 51 | false | Add indication for externally deleted files | 1,999 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | pro100filipp |
//
// EditorTabFileObserver.swift
// CodeEdit
//
// Created by Filipp Kuznetsov on 25.02.2025.
//
import Foundation
import SwiftUI
/// Observer ViewModel for tracking file deletion
final class EditorTabFileObserver: ObservableObject, CEWorkspaceFileManagerObserver {
@Published private(set) var isDeleted = fals... | I believe this can be simplified, and I’m fairly certain it should be updated on the main thread as well
```suggestion
func fileManagerUpdated(updatedItems: Set<CEWorkspaceFile>) {
if let parent = item.parent, updatedItems.contains(parent) {
isDeleted = item.doesExist == false
}
... | //
// EditorTabFileObserver.swift
// CodeEdit
//
// Created by Filipp Kuznetsov on 25.02.2025.
//
import Foundation
import SwiftUI
/// Observer ViewModel for tracking file deletion
@MainActor
final class EditorTabFileObserver: ObservableObject,
CEWorkspaceFileManagerObserver {
@Published private(set) var i... | @@ -0,0 +1,30 @@
+//
+// EditorTabFileObserver.swift
+// CodeEdit
+//
+// Created by Filipp Kuznetsov on 25.02.2025.
+//
+
+import Foundation
+import SwiftUI
+
+/// Observer ViewModel for tracking file deletion
+final class EditorTabFileObserver: ObservableObject, CEWorkspaceFileManagerObserver {
+ @Published pri... | CodeEdit/Features/Editor/TabBar/Tabs/Tab/Models/EditorTabFileObserver.swift | 26 | Swift | 1 | suggestion | 326 | 31 | 31 | false | Add indication for externally deleted files | 1,999 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | pro100filipp |
/// Copies the absolute path of the given `FileItem`
/// - Parameter item: The `FileItem` to use.
private func copyPath(item: CEWorkspaceFile) {
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(item.url.standardizedFileURL.path, forType: .string)
}
func moveToNewS... | I updated the previous implementation for relative path to avoid array shifting | /// Copies the absolute path of the given `FileItem`
/// - Parameter item: The `FileItem` to use.
private func copyPath(item: CEWorkspaceFile) {
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(item.url.standardizedFileURL.path, forType: .string)
}
func moveToNewS... | @@ -149,24 +149,21 @@ struct EditorTabBarContextMenu: ViewModifier {
guard let rootPath = workspace.workspaceFileManager?.folderUrl else {
return
}
- // Calculate the relative path
- var rootComponents = rootPath.standardizedFileURL.pathComponents
- var destinationCom... | CodeEdit/Features/Editor/TabBar/Views/EditorTabBarContextMenu.swift | 26 | Swift | 0.286 | suggestion | 79 | 42 | 39 | false | Added copy path and copy relative path options in project navigator menu | 2,013 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | FastestMolasses |
guard let workspace else { return }
/// If the filter is empty, show all items and restore the expanded state.
if workspace.sourceControlFilter || !filterIsEmpty {
outlineView.autosaveExpandedItems = false
/// Expand all items for search.
outlineView.expandI... | The double negation is hard to read. Can you simplify it to: `sourceControlFilter || !filterIsEmpty` |
guard let workspace else { return }
/// If the filter is empty, show all items and restore the expanded state.
if workspace.sourceControlFilter || !filterIsEmpty {
outlineView.autosaveExpandedItems = false
/// Expand all items for search.
outlineView.expandI... | @@ -213,16 +217,24 @@ final class ProjectNavigatorViewController: NSViewController {
}
/// Checks if the given filter matches the name of the item or any of its children.
- func fileSearchMatches(_ filter: String, for item: CEWorkspaceFile) -> Bool {
- guard !filter.trimmingCharacters(in: .whitesp... | CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift | 26 | Swift | 0.571 | refactor | 100 | 51 | 51 | false | Source Control Filter | 2,024 | CodeEditApp/CodeEdit | 18,361 | Swift | FastestMolasses | LeonardoLarranaga |
if newValue != iconColor {
outlineView?.reloadData()
}
}
}
var fileExtensionsVisibility: SettingsData.FileExtensionsVisibility = .showAll
var shownFileExtensions: SettingsData.FileExtensions = .default
var hiddenFileExtensions: SettingsData.FileExtensions... | ```suggestion
workspace?.navigatorFilter.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true
``` | if newValue != iconColor {
outlineView?.reloadData()
}
}
}
var fileExtensionsVisibility: SettingsData.FileExtensionsVisibility = .showAll
var shownFileExtensions: SettingsData.FileExtensions = .default
var hiddenFileExtensions: SettingsData.FileExtensions... | @@ -64,6 +64,10 @@ final class ProjectNavigatorViewController: NSViewController {
/// to open the file a second time.
var shouldSendSelectionUpdate: Bool = true
+ var filterIsEmpty: Bool {
+ workspace?.navigatorFilter.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty | CodeEdit/Features/NavigatorArea/ProjectNavigator/OutlineView/ProjectNavigatorViewController.swift | 26 | Swift | 0.714 | suggestion | 118 | 51 | 51 | false | Source Control Filter | 2,024 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | LeonardoLarranaga |
//
// Created by TAY KAI QUAN on 23/7/22.
//
import SwiftUI
struct ProjectNavigatorToolbarBottom: View {
@Environment(\.controlActiveState)
private var activeState
@Environment(\.colorScheme)
private var colorScheme
@EnvironmentObject var workspace: WorkspaceDocument
@EnvironmentObject var ... | I tried modifying the `FilterDropDownIconButton` to have a Picker, but couldn't figure out how to remove the selected value label from it. | //
// Created by TAY KAI QUAN on 23/7/22.
//
import SwiftUI
struct ProjectNavigatorToolbarBottom: View {
@Environment(\.controlActiveState)
private var activeState
@Environment(\.colorScheme)
private var colorScheme
@EnvironmentObject var workspace: WorkspaceDocument
@EnvironmentObject var ... | @@ -27,10 +27,20 @@ struct ProjectNavigatorToolbarBottom: View {
text: $workspace.navigatorFilter,
leadingAccessories: {
FilterDropDownIconButton(menu: { | CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift | 26 | Swift | 0.571 | suggestion | 138 | 51 | 51 | false | Sort alphabetically - Folders on top | 2,028 | CodeEditApp/CodeEdit | 18,361 | Swift | LeonardoLarranaga | LeonardoLarranaga |
@State var recentsFilter: Bool = false
var body: some View {
HStack(spacing: 5) {
addNewFileButton
PaneTextField(
"Filter",
text: $workspace.navigatorFilter,
leadingAccessories: {
FilterDropDownIconButton(menu: ... | A little uglier in code but this would work to get the better checkmark in that menu
```suggestion
FilterDropDownIconButton(
menu: {
Toggle(
"Folder on top",
isOn: Binding(
... | @State var recentsFilter: Bool = false
var body: some View {
HStack(spacing: 5) {
addNewFileButton
PaneTextField(
"Filter",
text: $workspace.navigatorFilter,
leadingAccessories: {
FilterDropDownIconButton(menu: ... | @@ -27,10 +27,20 @@ struct ProjectNavigatorToolbarBottom: View {
text: $workspace.navigatorFilter,
leadingAccessories: {
FilterDropDownIconButton(menu: {
- Button {
- workspace.sortFoldersOnTop.toggle()
- ... | CodeEdit/Features/NavigatorArea/ProjectNavigator/ProjectNavigatorToolbarBottom.swift | 26 | Swift | 0.857 | suggestion | 1,581 | 51 | 51 | false | Sort alphabetically - Folders on top | 2,028 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | LeonardoLarranaga |
//
// RecentProjectsUtil.swift
// CodeEdit
//
// Created by Khan Winter on 10/22/24.
//
import AppKit
import CoreSpotlight
/// Helper methods for managing the recent projects list and donating list items to CoreSpotlight.
///
/// Limits the number of remembered projects to 100 items.
///
/// If a UI element needs ... | ```suggestion
static let shared = RecentProjectsStore()
```
In Swift, singleton objects are typically named using conventions like `shared` or `standard`. | //
// RecentProjectsUtil.swift
// CodeEdit
//
// Created by Khan Winter on 10/22/24.
//
import AppKit
import CoreSpotlight
import OSLog
/// Helper methods for managing the recent projects list and donating list items to CoreSpotlight.
///
/// Limits the number of remembered projects to 100 items.
///
/// If a UI e... | @@ -14,20 +14,50 @@ import CoreSpotlight
///
/// If a UI element needs to listen to changes in this list, listen for the
/// ``RecentProjectsStore/didUpdateNotification`` notification.
-enum RecentProjectsStore {
- private static let defaultsKey = "recentProjectPaths"
+class RecentProjectsStore {
+ /// The def... | CodeEdit/Features/Welcome/Model/RecentProjectsStore.swift | 19 | Swift | 0.714 | suggestion | 161 | 44 | 44 | false | Separated files and folders in the "Open Recent" sub-menu | 2,039 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | atsrus |
init() {
let defaults = UserDefaults(suiteName: #file)!
store = RecentProjectsStore(defaults: defaults)
}
deinit {
try? FileManager.default.removeItem(atPath: #file + ".plist")
}
@Test
func newStoreEmpty() {
#expect(store.recentURLs().isEmpty)
}
@Test
... | ```suggestion
for idx in 0..<101 {
```
| class RecentProjectsTests {
let store: RecentProjectsStore
init() {
let defaults = UserDefaults(suiteName: #file)!
defaults.removeSuite(named: #file)
store = RecentProjectsStore(defaults: defaults)
}
deinit {
try? FileManager.default.removeItem(atPath: #file + ".plist")... | @@ -0,0 +1,50 @@
+//
+// RecentProjectsTests.swift
+// CodeEditTests
+//
+// Created by Khan Winter on 5/27/25.
+//
+
+import Testing
+import Foundation
+@testable import CodeEdit
+
+class RecentProjectsTests {
+ let store: RecentProjectsStore
+
+ init() {
+ let defaults = UserDefaults(suiteName: #file)... | CodeEditTests/Features/Welcome/RecentProjectsTests.swift | 26 | Swift | 0.429 | suggestion | 50 | 38 | 51 | false | Separated files and folders in the "Open Recent" sub-menu | 2,039 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | atsrus |
import AppKit
import CoreSpotlight
/// Helper methods for managing the recent projects list and donating list items to CoreSpotlight.
///
/// Limits the number of remembered projects to 100 items.
///
/// If a UI element needs to listen to changes in this list, listen for the
/// ``RecentProjectsStore/didUpdateNotifi... | Shouldn't the constructor be private since this class is meant to be used as a singleton?
Is there a reason to use something other than `UserDefaults.standard` in this case? |
import AppKit
import CoreSpotlight
import OSLog
/// Helper methods for managing the recent projects list and donating list items to CoreSpotlight.
///
/// Limits the number of remembered projects to 100 items.
///
/// If a UI element needs to listen to changes in this list, listen for the
/// ``RecentProjectsStore/di... | @@ -14,20 +14,50 @@ import CoreSpotlight
///
/// If a UI element needs to listen to changes in this list, listen for the
/// ``RecentProjectsStore/didUpdateNotification`` notification.
-enum RecentProjectsStore {
- private static let defaultsKey = "recentProjectPaths"
+class RecentProjectsStore {
+ /// The def... | CodeEdit/Features/Welcome/Model/RecentProjectsStore.swift | 26 | Swift | 0.571 | question | 174 | 51 | 51 | false | Separated files and folders in the "Open Recent" sub-menu | 2,039 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | atsrus |
display displayDocument: Bool,
completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void
) {
super.openDocument(withContentsOf: url, display: displayDocument) { document, documentWasAlreadyOpen, error in
if let document {
self.addDocument(document)
... | Are all opened documents stored in `documents`, or only those within opened workspaces? If it’s the former, this could lead to performance issues when working with multiple large projects, and then trying to open a file. | display displayDocument: Bool,
completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void
) {
guard !openFileInExistingWorkspace(url: url) else {
return
}
super.openDocument(withContentsOf: url, display: displayDocument) { document, documentWasAlreadyOpen, ... | @@ -73,6 +76,28 @@ final class CodeEditDocumentController: NSDocumentController {
}
}
+ /// Attempt to open the file URL in an open workspace, finding the nearest workspace to open it in if possible.
+ /// - Parameter url: The file URL to open.
+ /// - Returns: True, if the document was opened ... | CodeEdit/Features/Documents/Controllers/CodeEditDocumentController.swift | 26 | Swift | 0.786 | performance | 220 | 51 | 51 | false | Open New Files in Workspace | 2,043 | CodeEditApp/CodeEdit | 18,361 | Swift | tom-ludwig | thecoolwinter |
@EnvironmentObject private var utilityAreaViewModel: UtilityAreaViewModel
internal var body: some View {
Button {
utilityAreaViewModel.togglePanel()
} label: {
Image(systemName: "square.bottomthird.inset.filled")
}
.buttonStyle(.icon)
.keyboardSho... | I'm not sure this should be a user-facing command, it looks odd in the commands panel with the "Toggle Utility Area" command.

| @EnvironmentObject private var utilityAreaViewModel: UtilityAreaViewModel
internal var body: some View {
Button {
utilityAreaViewModel.togglePanel()
} label: {
Image(systemName: "square.bottomthird.inset.filled")
}
.buttonStyle(.icon)
.keyboardSho... | @@ -31,6 +31,12 @@ internal struct StatusBarToggleUtilityAreaButton: View {
id: "open.drawer",
command: { [weak utilityAreaViewModel] in utilityAreaViewModel?.togglePanel() }
)
+ CommandManager.shared.addCommand(
+ name: "Toggl... | CodeEdit/Features/StatusBar/Views/StatusBarItems/StatusBarToggleUtilityAreaButton.swift | 26 | Swift | 0.5 | refactor | 251 | 45 | 33 | false | Hide interface | 2,044 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | SimonKudsk |
}
var fileItems: [CEWorkspaceFile] {
var treePath: [CEWorkspaceFile] = []
var currentFile: CEWorkspaceFile? = file
while let currentFileLoop = currentFile {
treePath.insert(currentFileLoop, at: 0)
currentFile = currentFileLoop.parent
}
return tr... | ```suggestion
)
.frame(maxHeight: .infinity)
```
This doesn't fill it's available vertical space with the GeometryReader, adding a larger height fixes it. | }
var fileItems: [CEWorkspaceFile] {
var treePath: [CEWorkspaceFile] = []
var currentFile: CEWorkspaceFile? = file
while let currentFileLoop = currentFile {
treePath.insert(currentFileLoop, at: 0)
currentFile = currentFileLoop.parent
}
return tr... | @@ -50,25 +56,60 @@ struct EditorJumpBarView: View {
}
var body: some View {
- ScrollView(.horizontal, showsIndicators: false) {
- HStack(spacing: 0) {
- if file == nil {
- Text("No Selection")
- .font(.system(size: 11, weight: .regu... | CodeEdit/Features/Editor/JumpBar/Views/EditorJumpBarView.swift | 26 | Swift | 0.786 | suggestion | 216 | 51 | 51 | false | Jump Bar Overflow Accordion Effect | 2,045 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | swiftlysingh |
}
}
var body: some View {
NSPopUpButtonView(selection: $selection) {
guard let fileManager = workspace.workspaceFileManager else { return NSPopUpButton() }
button.menu = EditorJumpBarMenu(
fileItems: siblings,
fileManager: fileManager,
... | Correct me if I'm wrong but I think the gradient should disable when hovering too.
```suggestion
stops: truncatedCrumbWidth == nil || isHovering ?
``` | }
}
var body: some View {
NSPopUpButtonView(selection: $selection) {
guard let fileManager = workspace.workspaceFileManager else { return NSPopUpButton() }
button.menu = EditorJumpBarMenu(
fileItems: siblings,
fileManager: fileManager,
... | @@ -65,6 +68,28 @@ struct EditorJumpBarComponent: View {
return button
}
+ .frame(
+ maxWidth: isHovering || isLastItem ? nil : truncatedCrumbWidth,
+ alignment: .leading
+ )
+ .mask(
+ LinearGradient(
+ gradient: Gradient(
+ ... | CodeEdit/Features/Editor/JumpBar/Views/EditorJumpBarComponent.swift | 26 | Swift | 0.786 | bug | 173 | 51 | 51 | false | Jump Bar Overflow Accordion Effect | 2,045 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | swiftlysingh |
}
}
.frame(height: Self.height, alignment: .center)
.opacity(activeState == .inactive ? 0.8 : 1.0)
.grayscale(isActiveEditor ? 0.0 : 1.0)
}
private func resize() {
let minWidth: CGFloat = 20
let snapThreshold: CGFloat = 30
let maxWidth: CGFloa... | ```suggestion
if betweenWidth > snapThreshold || crumbWidth == nil {
```
I noticed that the first crumb _always_ has the overlay gradient, except when other crumbs are being truncated and the first item hasn't begun truncating yet. This fixes that, but please let me know if I'm misunderstanding the variabl... | EditorTabBarTrailingAccessories(codeFile: $codeFile)
}
}
.frame(height: Self.height, alignment: .center)
.opacity(activeState == .inactive ? 0.8 : 1.0)
.grayscale(isActiveEditor ? 0.0 : 1.0)
}
private func resize() {
let minWidth: CGFloat = 20... | @@ -86,4 +127,40 @@ struct EditorJumpBarView: View {
.opacity(activeState == .inactive ? 0.8 : 1.0)
.grayscale(isActiveEditor ? 0.0 : 1.0)
}
+
+ private func resize() {
+ let minWidth: CGFloat = 20
+ let snapThreshold: CGFloat = 30
+ let maxWidth: CGFloat = textWidth / CGF... | CodeEdit/Features/Editor/JumpBar/Views/EditorJumpBarView.swift | 26 | Swift | 0.857 | suggestion | 531 | 44 | 45 | false | Jump Bar Overflow Accordion Effect | 2,045 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | swiftlysingh |
let pipe = Pipe()
process.standardOutput = pipe
do {
try process.run()
process.waitUntilExit()
return process.terminationStatus == 0
} catch {
return false
}
}
/// Check if clipboard contains git url
func checkClipboard... | ```suggestion
alertMsg: "Git installation not found.",
infoText: "Ensure Git is installed on your system and try again."
``` | let pipe = Pipe()
process.standardOutput = pipe
do {
try process.run()
process.waitUntilExit()
return process.terminationStatus == 0
} catch {
return false
}
}
/// Check if clipboard contains git url
func checkClipboard... | @@ -43,6 +59,13 @@ class GitCloneViewModel: ObservableObject {
/// Clone repository
func cloneRepository(completionHandler: @escaping (URL) -> Void) {
+ if !isGitInstalled() {
+ showAlert(
+ alertMsg: "Git installation not found",
+ infoText: "Ensure Git is in... | CodeEdit/Features/SourceControl/Clone/ViewModels/GitCloneViewModel.swift | 26 | Swift | 0.714 | suggestion | 159 | 51 | 51 | false | Added check for git installation presence | 2,047 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | rustemd02 |
EditorTabDivider()
.opacity((isActive || inHoldingState) ? 0.0 : 1.0)
}
.foregroundColor(
isActive && isActiveEditor
? (
colorScheme != .dark
? Color(nsColor: .controlAccentColor)
: .primary
)... | One small thing with this is that this local monitor does not get cleaned up automatically. Can we add a `@State` reference to it and clean it up with the `onDisappear`? | : isActive ? 0.6 : 0.4
)
EditorTabDivider()
.opacity((isActive || inHoldingState) ? 0.0 : 1.0)
}
.foregroundColor(
isActive && isActiveEditor
? (
colorScheme != .dark
? Color(nsColor: .control... | @@ -193,6 +193,16 @@ struct EditorTabView: View {
}
}
}
+ .onAppear {
+ NSEvent.addLocalMonitorForEvents(matching: .otherMouseDown) { event in | CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabView.swift | 26 | Swift | 0.5 | question | 169 | 51 | 51 | false | Added closing tabs with middle click | 2,127 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | myaumura |
//
// SideBar.swift
// CodeEdit
//
// Created by Lukas Pistrol on 17.03.22.
//
import SwiftUI
import WorkspaceClient
struct NavigatorSidebar: View {
@ObservedObject var workspace: WorkspaceDocument
var windowController: NSWindowController
@State private var selection: Int = 0
var body: some View {
... | No issues found. | //
// SideBar.swift
// CodeEdit
//
// Created by Lukas Pistrol on 17.03.22.
//
import SwiftUI
import WorkspaceClient
struct NavigatorSidebar: View {
@ObservedObject var workspace: WorkspaceDocument
var windowController: NSWindowController
@State private var selection: Int = 0
var body: some View {
... | @@ -8,7 +8,7 @@
import SwiftUI
import WorkspaceClient
-struct SideBar: View {
+struct NavigatorSidebar: View {
@ObservedObject var workspace: WorkspaceDocument
var windowController: NSWindowController
@State private var selection: Int = 0
@@ -21,7 +21,7 @@ struct SideBar: View {
For... | CodeEdit/NavigatorSidebar/NavigatorSidebar.swift | 0 | Swift | 1 | none | 16 | 43 | 43 | true | Placeholder Inspector Sidebar | 141 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | |
pasteboard.clearContents()
pasteboard.setString(copyString, forType: .string)
}
public var body: some View {
ZStack(alignment: .topLeading) {
VStack(spacing: 8) {
Spacer().frame(height: 12)
Image(nsImage: NSApp.applicationIconImage)
... | No issues found. | pasteboard.clearContents()
pasteboard.setString(copyString, forType: .string)
}
public var body: some View {
ZStack(alignment: .topLeading) {
VStack(spacing: 8) {
Spacer().frame(height: 12)
Image(nsImage: NSApp.applicationIconImage)
... | @@ -9,9 +9,11 @@ import SwiftUI
import AppKit
import Foundation
import AppPreferences
+import GitClone
public struct WelcomeView: View {
@Environment(\.colorScheme) var colorScheme
+ @State var showGitClone = false
@State var isHovering: Bool = false
@State var isHoveringClose: Bool = false
... | CodeEditModules/Modules/WelcomeModule/src/WelcomeView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add functionality for cloning from git in welcome view | 232 | CodeEditApp/CodeEdit | 18,361 | Swift | Pythonen | |
case large
}
}
public extension AppPreferences {
/// A dictionary containing the keys and associated ``Theme/Attributes`` of overridden properties
///
/// ```json
/// {
/// "editor" : {
/// "background" : {
/// "color" : "#123456"
/// },
/// ...
... | No issues found. | case large
}
}
public extension AppPreferences {
/// A dictionary containing the keys and associated ``Theme/Attributes`` of overridden properties
///
/// ```json
/// {
/// "editor" : {
/// "background" : {
/// "color" : "#123456"
/// },
/// ...
... | @@ -61,6 +61,9 @@ public extension AppPreferences {
/// The reopen behavior of the app
public var reopenBehavior: ReopenBehavior = .welcome
+ /// The size of the project navigators rows.
+ public var projectNavigatorSize: ProjectNavigatorSize = .medium
+
/// Default initialize... | CodeEditModules/Modules/AppPreferences/src/Model/AppPreferences.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | `Project Navigator`: Implemented Setting for changing Item Size | 418 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | |
PreferencesSection("Author Name", hideLabels: false) {
TextField("Git Author Name", text: $prefs.preferences.sourceControl.git.authorName)
.frame(width: inputWidth)
}
PreferencesSection("Author Email", hideLabels: false) {
TextFiel... | No issues found. | PreferencesSection("Author Name", hideLabels: false) {
TextField("Git Author Name", text: $prefs.preferences.sourceControl.git.authorName)
.frame(width: inputWidth)
}
PreferencesSection("Author Email", hideLabels: false) {
TextFiel... | @@ -10,6 +10,8 @@ import CodeEditUI
struct SourceControlGitView: View {
+ private let inputWidth: Double = 280
+
@State var ignoredFileSelection: IgnoredFiles.ID?
@StateObject
@@ -19,12 +21,12 @@ struct SourceControlGitView: View {
VStack {
PreferencesSection("Author Name", hid... | CodeEditModules/Modules/AppPreferences/src/Sections/SourceControlPreferences/SourceControlGitView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Preferences: Add Comparison View and Source Control Navigator | 453 | CodeEditApp/CodeEdit | 18,361 | Swift | Angelk90 | |
internal let shellClient: ShellClient
@Binding internal var isPresented: Bool
@Binding internal var repoPath: String
// TODO: This has to be derived from git
@State internal var selectedBranch = "main"
public init(isPresented: Binding<Bool>,
repoPath: Binding<String>,
... | No issues found. | internal let shellClient: ShellClient
@Binding internal var isPresented: Bool
@Binding internal var repoPath: String
// TODO: This has to be derived from git
@State internal var selectedBranch = "main"
public init(isPresented: Binding<Bool>,
repoPath: Binding<String>,
... | @@ -0,0 +1,76 @@
+//
+// CheckoutBranchView.swift
+//
+//
+// Created by Aleksi Puttonen on 14.4.2022.
+//
+
+import Foundation
+import SwiftUI
+import GitClient
+import ShellClient
+
+public struct CheckoutBranchView: View {
+ internal let shellClient: ShellClient
+ @Binding internal var isPresented: Bool
+ ... | CodeEditModules/Modules/GitClone/src/CheckoutBranchView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Branch checkout after cloning | 460 | CodeEditApp/CodeEdit | 18,361 | Swift | Pythonen | |
),
],
targets: [
.target(
name: "WorkspaceClient",
path: "Modules/WorkspaceClient/src"
),
.testTarget(
name: "WorkspaceClientTests",
dependencies: [
"WorkspaceClient",
],
path: "Modules/Worksp... | No issues found. | ),
],
targets: [
.target(
name: "WorkspaceClient",
path: "Modules/WorkspaceClient/src"
),
.testTarget(
name: "WorkspaceClientTests",
dependencies: [
"WorkspaceClient",
],
path: "Modules/Worksp... | @@ -228,6 +228,7 @@ let package = Package(
"CodeEditUI",
"GitAccounts",
"CodeEditUtils",
+ "CodeEditSymbols",
],
path: "Modules/AppPreferences/src"
), | CodeEditModules/Package.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Line Gutter & Accounts: Put the correct font and width size, also added vault icons | 469 | CodeEditApp/CodeEdit | 18,361 | Swift | nanashili | |
@StateObject
private var prefs: AppPreferencesModel = .shared
var body: some View {
HStack(alignment: .center, spacing: 0) {
// Tab bar navigation control.
// TODO: Real functionality of tab bar navigation control and their stated foreground color.
HStack(spacing... | No issues found. | @StateObject
private var prefs: AppPreferencesModel = .shared
var body: some View {
HStack(alignment: .center, spacing: 0) {
// Tab bar navigation control.
// TODO: Real functionality of tab bar navigation control and their stated foreground color.
HStack(spacing... | @@ -87,6 +87,8 @@ struct TabBar: View {
NSVisualEffectView.Material.titlebar,
blendingMode: NSVisualEffectView.BlendingMode.withinWindow
)
+ .background(Color(nsColor: .controlBackgroundColor))
+ .edgesIgnoringSafeArea(.top)
... | CodeEdit/TabBar/TabBar.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Fix Tab Color Issue in Native Style | 483 | CodeEditApp/CodeEdit | 18,361 | Swift | lilingxi01 | |
? Color(nsColor: colorScheme == .dark ? .white : .black)
.opacity(0.12)
: Color(nsColor: colorScheme == .dark ? .white : .black)
.opacity(colorScheme == .dark ? 0.08 : 0.12)
)
}
}
/// The top border for tab bar (between tab bar and... | No issues found. | ? Color(nsColor: colorScheme == .dark ? .white : .black)
.opacity(0.12)
: Color(nsColor: colorScheme == .dark ? .white : .black)
.opacity(colorScheme == .dark ? 0.08 : 0.12)
)
}
}
/// The top border for tab bar (between tab bar and... | @@ -0,0 +1,104 @@
+//
+// TabBarDivider.swift
+// CodeEdit
+//
+// Created by Lingxi Li on 4/22/22.
+//
+
+import SwiftUI
+import AppPreferences
+import CodeEditUI
+
+/// The vertical divider between tab bar items.
+struct TabDivider: View {
+ @Environment(\.colorScheme)
+ var colorScheme
+
+ @StateObject
+... | CodeEdit/TabBar/TabBarDivider.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Fix Inactive Color Issues and Spacing Issues at Tabs and Breadcrumbs | 528 | CodeEditApp/CodeEdit | 18,361 | Swift | lilingxi01 | |
self.init(hex: Int(int))
}
/// Initializes a `Color` from an Int (e.g.: 0x112233)
init(hex: Int) {
let red = (hex >> 16) & 0xFF
let green = (hex >> 8) & 0xFF
let blue = hex & 0xFF
self.init(.sRGB, red: Double(red) / 255, green: Double(green) / 255, blue: Double(blue)... | No issues found. | self.init(hex: Int(int))
}
/// Initializes a `Color` from an Int (e.g.: 0x112233)
init(hex: Int) {
let red = (hex >> 16) & 0xFF
let green = (hex >> 8) & 0xFF
let blue = hex & 0xFF
self.init(.sRGB, red: Double(red) / 255, green: Double(green) / 255, blue: Double(blue)... | @@ -0,0 +1,82 @@
+//
+// Color+HEX.swift
+//
+//
+// Created by Lukas Pistrol on 23.03.22.
+//
+
+import SwiftUI
+
+public extension Color {
+
+ /// Initializes a `Color` from a HEX String (e.g.: #112233)
+ init(hex: String) {
+ let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
... | CodeEditModules/Modules/CodeEditUtils/src/Extensions/Color+HEX.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Editor: Apply Theme Colors | 539 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | |
private let color: Color
public var body: some View {
HStack(spacing: 8) {
ForEach(options.indices, id: \.self) { index in
SegmentedControlItem(
label: options[index],
active: preselectedIndex == index,
action: {
... | No issues found. |
private let color: Color
public var body: some View {
HStack(spacing: 8) {
ForEach(options.indices, id: \.self) { index in
SegmentedControlItem(
label: options[index],
active: preselectedIndex == index,
action: {
... | @@ -9,10 +9,6 @@ import SwiftUI
/// A view that creates a segmented control from an array of text labels.
public struct SegmentedControl: View {
-
- @Environment(\.colorScheme)
- private var colorScheme
-
/// A view that creates a segmented control from an array of text labels.
/// - Parameters:
... | CodeEditModules/Modules/CodeEditUI/src/SegmentedControl.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Added hover, push, and inactive states for mini tabs. | 551 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | |
// TODO: Implement reflecting Show Live Issues preference and remove disabled modifier
var showLiveIssuesSection: some View {
PreferencesSection("", hideLabels: false, align: .center) {
Toggle(isOn: $prefs.preferences.general.showLiveIssues) {
Text("Show Live Issues")
... | No issues found. | // TODO: Implement reflecting Show Live Issues preference and remove disabled modifier
var showLiveIssuesSection: some View {
PreferencesSection("", hideLabels: false, align: .center) {
Toggle(isOn: $prefs.preferences.general.showLiveIssues) {
Text("Show Live Issues")
... | @@ -19,62 +19,173 @@ public struct GeneralPreferencesView: View {
public var body: some View {
PreferencesContent {
- PreferencesSection("Appearance") {
- Picker("Appearance:", selection: $prefs.preferences.general.appAppearance) {
- Text("System")
- ... | CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | [WIP] Add missing general preferences | 560 | CodeEditApp/CodeEdit | 18,361 | Swift | drucelweisse | |
.frame(width: inputWidth)
Toggle("Show Live Issues", isOn: $prefs.preferences.general.showLiveIssues)
.toggleStyle(.checkbox)
}
.disabled(true)
}
// TODO: Implement reflecting File Extensions preference and remove disabled modifier
var fileExtensions... | No issues found. | .frame(width: inputWidth)
Toggle("Show Live Issues", isOn: $prefs.preferences.general.showLiveIssues)
.toggleStyle(.checkbox)
}
.disabled(true)
}
// TODO: Implement reflecting File Extensions preference and remove disabled modifier
var fileExtensions... | @@ -142,7 +142,6 @@ private extension GeneralPreferencesView {
}
}
- // TODO: Implement reflecting Find Navigator Detail preference and remove disabled modifier
var findNavigatorDetailSection: some View {
PreferencesSection("Find Navigator Detail") {
Picker("Find Navigator ... | CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add Find Navigator Result reflect general preference "Find Navigator Detail" | 581 | CodeEditApp/CodeEdit | 18,361 | Swift | drucelweisse | |
if let mountedVolumes = FileManager.default.mountedVolumeURLs(
includingResourceValuesForKeys: nil,
options: [.skipHiddenVolumes]) {
finderSync.directoryURLs = Set<URL>(mountedVolumes)
}
// Monitor volumes
let notificationCenter = NSWorkspace.shared.no... | No issues found. | if let mountedVolumes = FileManager.default.mountedVolumeURLs(
includingResourceValuesForKeys: nil,
options: [.skipHiddenVolumes]) {
finderSync.directoryURLs = Set<URL>(mountedVolumes)
}
// Monitor volumes
let notificationCenter = NSWorkspace.shared.no... | @@ -0,0 +1,91 @@
+//
+// FinderSync.swift
+// openInCodeEdit
+//
+// Created by Wesley de Groot on 03/05/2022.
+//
+
+/**
+ * For anyone working on this file.
+ * print does not output to the console, use NSLog.
+ * open "console.app" to debug,
+ */
+
+import Cocoa
+import FinderSync
+
+class CEOpenWith: FIFinderSyn... | OpenWithCodeEdit/FinderSync.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Open in CodeEdit | #559 | 597 | CodeEditApp/CodeEdit | 18,361 | Swift | 0xWDG | |
/// If it is a `.codeedit` folder this will return `"folder.fill.badge.gearshape"`.
/// If it has children this will return `"folder.fill"` otherwise `"folder"`.
private func folderIcon(_ children: [FileItem]) -> String {
if parent == nil {
return "square.dashed.inset... | No issues found. | /// If it is a `.codeedit` folder this will return `"folder.fill.badge.gearshape"`.
/// If it has children this will return `"folder.fill"` otherwise `"folder"`.
private func folderIcon(_ children: [FileItem]) -> String {
if parent == nil {
return "square.dashed.inset... | @@ -110,6 +110,11 @@ public extension WorkspaceClient {
url.pathExtension
}
+ /// Returns the file name with optional extension (e.g.: `Package.swift`)
+ public func fileName(typeHidden: Bool) -> String {
+ typeHidden ? url.deletingPathExtension().lastPathComponent : fil... | CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add ProjectNavigator OutlineTableViewCell to display file extensions | 598 | CodeEditApp/CodeEdit | 18,361 | Swift | drucelweisse | |
public var body: some View {
VStack(spacing: 0) {
bar
if model.isExpanded {
StatusBarDrawer(model: model)
.transition(.move(edge: .bottom))
}
}
.disabled(controlActive == .inactive)
// removes weird light gray ba... | No issues found. | public var body: some View {
VStack(spacing: 0) {
bar
if model.isExpanded {
StatusBarDrawer(model: model)
.transition(.move(edge: .bottom))
}
}
.disabled(controlActive == .inactive)
// removes weird light gray ba... | @@ -68,11 +68,11 @@ public struct StatusBarView: View {
.padding(.horizontal, 10)
}
.overlay(alignment: .top) {
- Divider()
+ PanelDivider()
}
.overlay(alignment: .bottom) {
if model.isExpanded {
- Divider()
+ ... | CodeEditModules/Modules/StatusBar/src/StatusBar.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Fixed Statusbar Divider Color | 606 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | |
public class StatusBarModel: ObservableObject {
// TODO: Implement logic for updating values
// TODO: Add @Published vars for indentation, encoding, linebreak
/// The selected tab in the main section.
/// - **0**: Terminal
/// - **1**: Debugger
/// - **2**: Output
@Published
public var... | No issues found. | public class StatusBarModel: ObservableObject {
// TODO: Implement logic for updating values
// TODO: Add @Published vars for indentation, encoding, linebreak
/// The selected tab in the main section.
/// - **0**: Terminal
/// - **1**: Debugger
/// - **2**: Output
@Published
public var... | @@ -5,57 +5,27 @@
// Created by Lukas Pistrol on 20.03.22.
//
-import Git
import SwiftUI
-import ShellClient
-
-public enum StatusBarTab: String, CaseIterable, Identifiable {
- case terminal
- case debugger
- case output
-
- public var id: String { return self.rawValue }
- public static var allOpti... | CodeEditModules/Modules/StatusBar/src/Model/StatusBarModel.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | StatusBar: Cleanup & Tests | 608 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | |
: .secondary.opacity(0.80)
)
} else {
Image(systemName: "xmark")
.font(.system(size: 9.5, weight: .medium, design: .rounded))
.frame(wid... | No issues found. | : .secondary.opacity(0.80)
)
} else {
Image(systemName: "xmark")
.font(.system(size: 9.5, weight: .medium, design: .rounded))
.frame(wid... | @@ -48,6 +48,8 @@ struct TabBarItem: View {
private var windowController: NSWindowController
+ private var isTemporary: Bool
+
var isActive: Bool {
item.tabID == workspace.selectionState.selectedId
}
@@ -80,6 +82,7 @@ struct TabBarItem: View {
self.item = item
self.windo... | CodeEdit/TabBar/TabBarItem.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add Temporary Tab | 620 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | |
Button("Close Other Tabs") {
withAnimation {
workspace.closeTab(where: { $0 != item.tabID })
}
}
Button("Close Tabs to the Right") {
withAnimation {
workspace.close... | No issues found. | Button("Close Other Tabs") {
withAnimation {
workspace.closeTab(where: { $0 != item.tabID })
}
}
Button("Close Tabs to the Right") {
withAnimation {
workspace.close... | @@ -0,0 +1,140 @@
+//
+// TabBarContextMenu.swift
+// CodeEdit
+//
+// Created by Khan Winter on 6/4/22.
+//
+
+import Foundation
+import SwiftUI
+import WorkspaceClient
+import TabBar
+
+extension View {
+ func tabBarContextMenu(item: TabBarItemRepresentable,
+ workspace: WorkspaceDocum... | CodeEdit/TabBar/TabBarContextMenu.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add Tab right-click Actions | 648 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | |
return "folder.fill.badge.gearshape"
}
return children.isEmpty ? "folder" : "folder.fill"
}
/// Returns the file name with optional extension (e.g.: `Package.swift`)
public func fileName(typeHidden: Bool) -> String {
typeHidden ? url.deletingP... | No issues found. | return "folder.fill.badge.gearshape"
}
return children.isEmpty ? "folder" : "folder.fill"
}
/// Returns the file name with optional extension (e.g.: `Package.swift`)
public func fileName(typeHidden: Bool) -> String {
typeHidden ? url.deletingP... | @@ -154,10 +154,27 @@ public extension WorkspaceClient {
NSWorkspace.shared.activateFileViewerSelecting([url])
}
+ /// Allows the user to launch the file or folder as it would be in finder
+ public func openWithExternalEditor() {
+ NSWorkspace.shared.open(url)
+ }... | CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Implement Delete, Create File, Create Folder for the right click menu in ProjectNavigator | 655 | CodeEditApp/CodeEdit | 18,361 | Swift | KaiTheRedNinja | |
//
// String+SHA256.swift
// CodeEdit
//
// Created by Debdut Karmakar on 6/9/22.
//
import Foundation
import CryptoKit
extension String {
/// Returns a SHA256 hash string of a string or nil
var sha256Hash: String? {
guard let data = self.data(using: .utf8) else { return nil }
let hash = SH... | No issues found. | //
// String+SHA256.swift
// CodeEdit
//
// Created by Debdut Karmakar on 6/9/22.
//
import Foundation
import CryptoKit
extension String {
/// Returns a SHA256 hash string of a string or nil
var sha256Hash: String? {
guard let data = self.data(using: .utf8) else { return nil }
let hash = SH... | @@ -0,0 +1,18 @@
+//
+// String+SHA256.swift
+// CodeEdit
+//
+// Created by Debdut Karmakar on 6/9/22.
+//
+
+import Foundation
+import CryptoKit
+
+extension String {
+ /// Returns a SHA256 hash string of a string or nil
+ var sha256Hash: String? {
+ guard let data = self.data(using: .utf8) else { ret... | CodeEdit/Extensions/String+SHA256.swift | 0 | Swift | 1 | none | 16 | 19 | 19 | true | Move UI Workspace configuration from project .codeedit/selection.json to UserDefaults/AppStorage #513 | 656 | CodeEditApp/CodeEdit | 18,361 | Swift | Debdut | |
return item.children?.count ?? 0
}
return content.count
}
func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
if let item = item as? Item,
let children = item.children {
return children[index]
}
... | No issues found. | return item.children?.count ?? 0
}
return content.count
}
func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
if let item = item as? Item,
let children = item.children {
return children[index]
}
... | @@ -210,7 +210,7 @@ extension OutlineViewController: NSOutlineViewDelegate {
}
func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
- rowHeight // This can be changed to 20 to match Xcodes row height.
+ rowHeight // This can be changed to 20 to match Xcode's... | CodeEdit/NavigatorSidebar/ProjectNavigator/OutlineView/OutlineViewController.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Improving comments | 664 | CodeEditApp/CodeEdit | 18,361 | Swift | itsliamdowd | |
Text("Monochrome")
.tag(AppPreferences.FileIconStyle.monochrome)
}
.pickerStyle(.radioGroup)
}
}
var tabBarStyleSection: some View {
PreferencesSection("Tab Bar Style") {
Picker("Tab Bar Style:", selection: $prefs.preferenc... | No issues found. | Text("Monochrome")
.tag(AppPreferences.FileIconStyle.monochrome)
}
.pickerStyle(.radioGroup)
}
}
var tabBarStyleSection: some View {
PreferencesSection("Tab Bar Style") {
Picker("Tab Bar Style:", selection: $prefs.preferenc... | @@ -49,6 +49,7 @@ public struct GeneralPreferencesView: View {
Group {
openInCodeEditToggle
revealFileOnFocusChangeToggle
+ shellCommandSection
}
}
}
@@ -208,6 +209,73 @@ private extension GeneralPreferencesView {
.disable... | CodeEditModules/Modules/AppPreferences/src/Sections/GeneralPreferences/GeneralPreferencesView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Implement Basic CLI (#17) | 667 | CodeEditApp/CodeEdit | 18,361 | Swift | benkoska | |
if lineContainsSearchTerm(line: noSpaceLine, term: textToCompare) {
if fileAddedFlag {
searchResult.append(SearchResultModel(
file: fileItem,
lineNumber: nil,
... | No issues found. | if lineContainsSearchTerm(line: noSpaceLine, term: textToCompare) {
if fileAddedFlag {
searchResult.append(SearchResultModel(
file: fileItem,
lineNumber: nil,
... | @@ -12,59 +12,146 @@ import WorkspaceClient
extension WorkspaceDocument {
final class SearchState: ObservableObject {
var workspace: WorkspaceDocument
+ var selectedMode: [SearchModeModel] = [
+ .Find,
+ .Text,
+ .Containing
+ ]
@Published var searc... | CodeEdit/Documents/WorkspaceDocument+Search.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Find navigator improvements | 678 | CodeEditApp/CodeEdit | 18,361 | Swift | KaiTheRedNinja | |
//
// OtherFileView.swift
//
//
// Created by Shibo Tong on 10/7/2022.
//
import SwiftUI
import QuickLookUI
/// A SwiftUI Wrapper for `QLPreviewView`
/// Mainly used for other unsupported files
/// ## Usage
/// ```swift
/// OtherFileView(otherFile)
/// ```
public struct OtherFileView: NSViewRepresentable {
p... | No issues found. | //
// OtherFileView.swift
//
//
// Created by Shibo Tong on 10/7/2022.
//
import SwiftUI
import QuickLookUI
/// A SwiftUI Wrapper for `QLPreviewView`
/// Mainly used for other unsupported files
/// ## Usage
/// ```swift
/// OtherFileView(otherFile)
/// ```
public struct OtherFileView: NSViewRepresentable {
p... | @@ -0,0 +1,45 @@
+//
+// OtherFileView.swift
+//
+//
+// Created by Shibo Tong on 10/7/2022.
+//
+
+import SwiftUI
+import QuickLookUI
+
+/// A SwiftUI Wrapper for `QLPreviewView`
+/// Mainly used for other unsupported files
+/// ## Usage
+/// ```swift
+/// OtherFileView(otherFile)
+/// ```
+public struct OtherFile... | CodeEditModules/Modules/CodeFile/src/Other/OtherFileView.swift | 0 | Swift | 1 | none | 16 | 46 | 46 | true | Fix open unsupported Documents, support for open image files | 679 | CodeEditApp/CodeEdit | 18,361 | Swift | shibotong | |
/// Returns a string describing a SFSymbol for folders
///
/// If it is the top-level folder this will return `"square.dashed.inset.filled"`.
/// If it is a `.codeedit` folder this will return `"folder.fill.badge.gearshape"`.
/// If it has children this will return `"folder.fill... | No issues found. |
/// Returns a string describing a SFSymbol for folders
///
/// If it is the top-level folder this will return `"square.dashed.inset.filled"`.
/// If it is a `.codeedit` folder this will return `"folder.fill.badge.gearshape"`.
/// If it has children this will return `"folder.fill... | @@ -33,6 +33,24 @@ public extension WorkspaceClient {
public typealias ID = String
+ public var watcher: DispatchSourceFileSystemObject?
+ static var watcherCode: () -> Void = {}
+
+ public func activateWatcher() -> Bool {
+ let descriptor = open(self.url.path, O_EVTONLY)
+ ... | CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Project sidebar loading optimisation | 686 | CodeEditApp/CodeEdit | 18,361 | Swift | KaiTheRedNinja | |
folderURL: directory,
ignoredFilesAndFolders: []
)
var newFiles: [WorkspaceClient.FileItem] = []
cancellable = client
.getFiles
.sink { files in
newFiles = files
expectation.fulfill()
}
waitFor... | No issues found. | folderURL: directory,
ignoredFilesAndFolders: []
)
var newFiles: [WorkspaceClient.FileItem] = []
cancellable = client
.getFiles
.sink { files in
newFiles = files
expectation.fulfill()
}
waitFor... | @@ -69,8 +69,7 @@ final class WorkspaceClientUnitTests: XCTestCase {
try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
var cancellable: AnyCancellable?
- let expectation = expectation(description: "wait for files")
- expectation.expectedFulfillme... | CodeEditModules/Modules/WorkspaceClient/Tests/UnitTests.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add duplicate file functionality | 736 | CodeEditApp/CodeEdit | 18,361 | Swift | Muhammed9991 | |
// MARK: - Toolbar
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
[
.toggleFirstSidebarItem,
.sidebarTrackingSeparator,
.branchPicker,
.flexibleSpace,
.flexibleSpace,
.toggleLastSidebarIte... | No issues found. |
// MARK: - Toolbar
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
[
.toggleFirstSidebarItem,
.sidebarTrackingSeparator,
.branchPicker,
.flexibleSpace,
.flexibleSpace,
.toggleLastSidebarIte... | @@ -44,20 +44,20 @@ final class CodeEditWindowController: NSWindowController, NSToolbarDelegate {
func registerCommands() {
CommandManager.shared.addCommand(
name: "Quick Open",
- title: "Quick Open",
- id: "quick_open",
- command: ClosureWrapper(closure: {... | CodeEdit/Documents/CodeEditWindowController.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Sparkle updates | 759 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | |
private var cancellables = [AnyCancellable]()
private let editable: Bool
public init(codeFile: CodeFileDocument, editable: Bool = true) {
self.codeFile = codeFile
self.editable = editable
codeFile
.$content
.dropFirst()
.debounce(
... | No issues found. |
private var cancellables = [AnyCancellable]()
private let editable: Bool
public init(codeFile: CodeFileDocument, editable: Bool = true) {
self.codeFile = codeFile
self.editable = editable
codeFile
.$content
.dropFirst()
.debounce(
... | @@ -10,6 +10,7 @@ import Foundation
import SwiftUI
import CodeEditTextView
import AppPreferences
+import Combine
/// CodeFileView is just a wrapper of the `CodeEditor` dependency
public struct CodeFileView: View {
@@ -22,11 +23,34 @@ public struct CodeFileView: View {
@Environment(\.colorScheme)
privat... | CodeEditModules/Modules/CodeFile/src/CodeFileView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add preferences option to toggle auto-save. | 763 | CodeEditApp/CodeEdit | 18,361 | Swift | sk409 | |
/// },
/// ...
/// }
/// }
/// ```
typealias ThemeOverrides = [String: [String: Theme.Attributes]]
/// The global settings for themes
struct ThemePreferences: Codable {
/// The name of the currently selected dark theme
public var selectedDarkTheme: String = "c... | No issues found. | /// },
/// ...
/// }
/// }
/// ```
typealias ThemeOverrides = [String: [String: Theme.Attributes]]
/// The global settings for themes
struct ThemePreferences: Codable {
/// The name of the currently selected dark theme
public var selectedDarkTheme: String = "c... | @@ -32,14 +32,20 @@ public extension AppPreferences {
/// The global settings for themes
struct ThemePreferences: Codable {
+ /// The name of the currently selected dark theme
+ public var selectedDarkTheme: String = "codeedit-xcode-dark"
+
+ /// The name of the currently selected light... | CodeEditModules/Modules/AppPreferences/src/Model/Theme/ThemePreferences.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Fixes 714: Theme does not sync with system appearance | 765 | CodeEditApp/CodeEdit | 18,361 | Swift | matthijseikelenboom | |
if !filemanager.fileExists(atPath: url.path, isDirectory: &isDir) {
try filemanager.createDirectory(at: url, withIntermediateDirectories: true)
}
try loadBundledThemes()
// get all filenames in themes folder that end with `.json`
let content = try filemanager.conten... | No issues found. | if !filemanager.fileExists(atPath: url.path, isDirectory: &isDir) {
try filemanager.createDirectory(at: url, withIntermediateDirectories: true)
}
try loadBundledThemes()
// get all filenames in themes folder that end with `.json`
let content = try filemanager.conten... | @@ -18,6 +18,19 @@ public final class ThemeModel: ObservableObject {
public static let shared: ThemeModel = .init()
+ /// Default instance of the `FileManager`
+ private let filemanager = FileManager.default
+
+ /// The base folder url `~/Library/Application Support/CodeEdit/`
+ private var baseURL... | CodeEditModules/Modules/AppPreferences/src/Sections/ThemePreferences/Model/ThemeModel.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Moved Themes and Preferences to Application Support | 827 | CodeEditApp/CodeEdit | 18,361 | Swift | austincondiff | |
/*
This is the main type of the document.
For example, if the file is end with '.png', it will be an image,
if the file is end with '.py', it will be a text file.
If text content is not empty, return text
If its neither image or text, this could be nil.
*/
public var typeOfFile: UT... | No issues found. |
/*
This is the main type of the document.
For example, if the file is end with '.png', it will be an image,
if the file is end with '.py', it will be a text file.
If text content is not empty, return text
If its neither image or text, this could be nil.
*/
public var typeOfFile: UT... | @@ -57,6 +57,9 @@ public final class CodeFileDocument: NSDocument, ObservableObject, QLPreviewItem
fileURL
}
+ @Published
+ public var cursorPosition = (1, 1)
+
// MARK: - NSDocument
override public class var autosavesInPlace: Bool { | CodeEditModules/Modules/CodeFile/src/CodeFile.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add ability to open files using `codeedit://` URLs. | 840 | CodeEditApp/CodeEdit | 18,361 | Swift | ezraberch | |
func testSplitViewControllerSnappedWhenWidthInAppropriateRange() {
// Given
let position = (260...280).randomElement() ?? .zero
// When
let result = splitViewController.splitView(
splitViewController.splitView,
constrainSplitPosition: .init(position),
... | No issues found. | func testSplitViewControllerSnappedWhenWidthInAppropriateRange() {
// Given
let position = (260...280).randomElement() ?? .zero
// When
let result = splitViewController.splitView(
splitViewController.splitView,
constrainSplitPosition: .init(position),
... | @@ -0,0 +1,111 @@
+//
+// DocumentsUnitTests.swift
+// CodeEditTests
+//
+// Created by YAPRYNTSEV Aleksey on 31.12.2022.
+//
+
+import XCTest
+@testable import CodeEdit
+
+final class DocumentsUnitTests: XCTestCase {
+ // Properties
+ private var splitViewController: CodeEditSplitViewController!
+ private ... | CodeEditTests/Features/Documents/DocumentsUnitTests.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Snap Sidebar To Width | 882 | CodeEditApp/CodeEdit | 18,361 | Swift | yapryntsev | |
import Cocoa
private extension CGFloat {
static let snapWidth: CGFloat = 272
static let minSnapWidth: CGFloat = snapWidth - 10
static let maxSnapWidth: CGFloat = snapWidth + 10
}
final class CodeEditSplitViewController: NSSplitViewController {
// Properties
private(set) var isSnapped: Bool = fal... | No issues found. |
import Cocoa
private extension CGFloat {
static let snapWidth: CGFloat = 272
static let minSnapWidth: CGFloat = snapWidth - 10
static let maxSnapWidth: CGFloat = snapWidth + 10
}
final class CodeEditSplitViewController: NSSplitViewController {
// Properties
private(set) var isSnapped: Bool = fal... | @@ -8,7 +8,7 @@
import Cocoa
private extension CGFloat {
- static let snapWidth: CGFloat = 270
+ static let snapWidth: CGFloat = 272
static let minSnapWidth: CGFloat = snapWidth - 10
static let maxSnapWidth: CGFloat = snapWidth + 10 | CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | fix for icon size | 920 | CodeEditApp/CodeEdit | 18,361 | Swift | Wouter01 | |
return formatter
}
var body: some View {
PreferencesContent {
PreferencesSection("Default Tab Width") {
HStack(spacing: 5) {
TextField("", value: $prefs.preferences.textEditing.defaultTabWidth, formatter: numberFormat)
.mu... | No issues found. |
return formatter
}
var body: some View {
PreferencesContent {
PreferencesSection("Default Tab Width") {
HStack(spacing: 5) {
TextField("", value: $prefs.preferences.textEditing.defaultTabWidth, formatter: numberFormat)
.mu... | @@ -42,6 +42,9 @@ struct TextEditingPreferencesView: View {
autocompleteBraces
enableTypeOverCompletion
}
+ PreferencesSection("Line Wrapping") {
+ wrapLinesToEditorWidth
+ }
}
}
@@ -75,4 +78,12 @@ struct TextEditingPref... | CodeEdit/Features/AppPreferences/Sections/TextEditingPreferences/TextEditingPreferencesView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add preference for text wrapping in editor, add command palette options for text editing prefs | 948 | CodeEditApp/CodeEdit | 18,361 | Swift | ben-p-commits | |
/// A multiplier for setting the line height. Defaults to `1.45`
var lineHeightMultiple: Double = 1.45
/// Default initializer
init() {
self.populateCommands()
}
/// Explicit decoder init for setting default values when key is not present in `JSON`
i... | No issues found. | /// A multiplier for setting the line height. Defaults to `1.45`
var lineHeightMultiple: Double = 1.45
/// Default initializer
init() {
self.populateCommands()
}
/// Explicit decoder init for setting default values when key is not present in `JSON`
i... | @@ -17,13 +17,18 @@ extension AppPreferences {
/// The font to use in editor.
var font: EditorFont = .init()
+ /// A flag indicating whether type-over completion is enabled
var enableTypeOverCompletion: Bool = true
+ /// A flag indicating whether braces are automatically com... | CodeEdit/Features/AppPreferences/Model/Text Editing/TextEditingPreferences.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Add line height multiple option to text editing preferences | 955 | CodeEditApp/CodeEdit | 18,361 | Swift | ben-p-commits | |
//
// AcknowledgementsTests.swift
// CodeEditTests
//
// Created by Lukas Pistrol on 14.01.23.
//
import XCTest
@testable import CodeEdit
final class AcknowledgementsTests: XCTestCase {
var model: AcknowledgementsViewModel!
override func setUpWithError() throws {
model = .init()
}
overri... | No issues found. | //
// AcknowledgementsTests.swift
// CodeEditTests
//
// Created by Lukas Pistrol on 14.01.23.
//
import XCTest
@testable import CodeEdit
final class AcknowledgementsTests: XCTestCase {
var model: AcknowledgementsViewModel!
override func setUpWithError() throws {
model = .init()
}
overri... | @@ -0,0 +1,26 @@
+//
+// AcknowledgementsTests.swift
+// CodeEditTests
+//
+// Created by Lukas Pistrol on 14.01.23.
+//
+
+import XCTest
+@testable import CodeEdit
+
+final class AcknowledgementsTests: XCTestCase {
+
+ var model: AcknowledgementsViewModel!
+
+ override func setUpWithError() throws {
+ ... | CodeEditTests/Features/Acknowledgements/AcknowledgementsTests.swift | 0 | Swift | 1 | none | 16 | 27 | 27 | true | [fix]: Acknowledgements Window | 963 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol | |
}
// MARK: - Toolbar
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
[
.toggleFirstSidebarItem,
.sidebarTrackingSeparator,
.branchPicker,
.flexibleSpace,
.flexibleSpace,
.toggleLastSide... | No issues found. | }
// MARK: - Toolbar
func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] {
[
.toggleFirstSidebarItem,
.sidebarTrackingSeparator,
.branchPicker,
.flexibleSpace,
.flexibleSpace,
.toggleLastSide... | @@ -9,6 +9,8 @@ import Cocoa
import SwiftUI
final class CodeEditWindowController: NSWindowController, NSToolbarDelegate {
+ static let minSidebarWidth: CGFloat = 242
+
private var prefs: AppPreferencesModel = .shared
var workspace: WorkspaceDocument?
@@ -73,7 +75,7 @@ final class CodeEditWindowContro... | CodeEdit/Features/Documents/Controllers/CodeEditWindowController.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Resize inspector | 970 | CodeEditApp/CodeEdit | 18,361 | Swift | thecoolwinter | |
selectionState.openFileItems.remove(at: openFileItemIndex)
removeTab(id: item.tabID)
if openedTabsFromState {
var openTabsInState = self.getFromWorkspaceState(key: openTabsStateName) as? [String] ?? []
if let index = openTabsInState.firstIndex(of: item.url.absoluteString... | No issues found. | selectionState.openFileItems.remove(at: openFileItemIndex)
removeTab(id: item.tabID)
if openedTabsFromState {
var openTabsInState = self.getFromWorkspaceState(key: openTabsStateName) as? [String] ?? []
if let index = openTabsInState.firstIndex(of: item.url.absoluteString... | @@ -22,12 +22,27 @@ import CodeEditKit
@Published var selectionState: WorkspaceSelectionState = .init()
@Published var fileItems: [WorkspaceClient.FileItem] = []
+ var workspaceState: [String: Any] {
+ get {
+ let key = "workspaceState-\(self.fileURL?.absoluteString ?? "")"
+ ... | CodeEdit/Features/Documents/WorkspaceDocument.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Save UI state per Workspace | 984 | CodeEditApp/CodeEdit | 18,361 | Swift | Code-DJ | |
Spacer()
HStack(alignment: .top) {
if let profileURL = contributor.profileURL, profileURL != contributor.gitHubURL {
ActionButton(url: profileURL, image: .init(systemName: "globe"))
}
if let gitHubURL = contributor.gitHubURL {
... | No issues found. | Spacer()
HStack(alignment: .top) {
if let profileURL = contributor.profileURL, profileURL != contributor.gitHubURL {
ActionButton(url: profileURL, image: .init(systemName: "globe"))
}
if let gitHubURL = contributor.gitHubURL {
... | @@ -0,0 +1,104 @@
+//
+// ContributorRowView.swift
+// CodeEdit
+//
+// Created by Lukas Pistrol on 19.01.23.
+//
+
+import SwiftUI
+
+struct ContributorRowView: View {
+
+ let contributor: Contributor
+
+ var body: some View {
+ HStack {
+ userImage
+ VStack(alignment: .leading, s... | CodeEdit/Features/Contributors/ContributorRowView.swift | 0 | Swift | 1 | none | 16 | 51 | 51 | true | Feat/contributors window | 1,002 | CodeEditApp/CodeEdit | 18,361 | Swift | lukepistrol |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.