Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Tasks #1798

Merged
merged 36 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e12672b
Tasks basics
tom-ludwig Jun 25, 2024
d4c810c
Merge branch 'main' into feat/268/tasks
tom-ludwig Jun 26, 2024
721f2fe
Improve code readability
tom-ludwig Jun 26, 2024
27e7e49
Add taskManager environmentObject to WorksapceView
tom-ludwig Jun 26, 2024
35c4ced
Cleaned up CEActiveTask and Improved Debug Area View
tom-ludwig Jun 28, 2024
bc0dc0b
WIP: Savepoint A1
tom-ludwig Jul 1, 2024
1edef9e
Deleted old, non-working code
tom-ludwig Jul 2, 2024
832c07d
Fix: CEWorkspaceSettings
tom-ludwig Jul 2, 2024
d27fbc3
Fix: Double initialisation of workspace settings
tom-ludwig Jul 3, 2024
e133c6c
Simpler way to create tasks by only needing to specify command and name
tom-ludwig Jul 5, 2024
cde3386
Fix: Lint
tom-ludwig Jul 5, 2024
ccc55c0
[test] Add tests for TaskShell, CEActiveTask and TaskManager
tom-ludwig Jul 8, 2024
48dcc84
Merge branch 'main' into feat/268/tasks
tom-ludwig Jul 8, 2024
bf1835f
fix linter
tom-ludwig Jul 8, 2024
987fa2d
fix linter
tom-ludwig Jul 8, 2024
a9e4e40
fix linter
tom-ludwig Jul 8, 2024
b8aa8f2
fix merge conflicts
tom-ludwig Jul 8, 2024
9c7bcb1
fix: leading sidebar resizing
tom-ludwig Jul 9, 2024
fa00586
tests: add resume and suspend tests
tom-ludwig Jul 12, 2024
5bf5943
Add help modifiers for TaskOutput Buttons
tom-ludwig Jul 12, 2024
483175a
Update SchemeDropDownView.swift
tom-ludwig Jul 12, 2024
bd027b7
Merge TaskShell and Shell
tom-ludwig Jul 12, 2024
d81d4a2
tests: add shell tests
tom-ludwig Jul 12, 2024
d771735
Make taskStatus a function instead of a computed property
tom-ludwig Jul 12, 2024
70af266
make handleProcessFinished async
tom-ludwig Jul 12, 2024
7f9e0ab
Check if task is running before suspending
tom-ludwig Jul 12, 2024
8206123
Update CEActiveTask.swift
tom-ludwig Jul 12, 2024
46f72de
Handle terminationStatus 15
tom-ludwig Jul 12, 2024
d6e9e41
Fixed beachball :smiley:
tom-ludwig Jul 12, 2024
918a904
Removed redundant detached task
tom-ludwig Jul 12, 2024
5f3826c
Update project.pbxproj
tom-ludwig Jul 12, 2024
c286ef5
Selected task updates on delete
tom-ludwig Jul 18, 2024
8bd7fad
Merge branch 'main' into feat/268/tasks
thecoolwinter Jul 27, 2024
99f4828
Clean Up Merge
thecoolwinter Jul 27, 2024
6ccc8a0
Tests Compile
thecoolwinter Jul 27, 2024
3ac6d34
Pass Tests
thecoolwinter Jul 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
246 changes: 168 additions & 78 deletions CodeEdit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "f3dd40f19b32a2b522dee7a1e94ceb60afbdb1a028938883adffc7328ef9d804",
"originHash" : "a33fcca819dee4c816b1474e19017510b1d62b170c921187042e0675d3f4b0b3",
"pins" : [
{
"identity" : "anycodable",
Expand All @@ -13,7 +13,7 @@
{
"identity" : "codeeditkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditKit.git",
"location" : "https://github.com/CodeEditApp/CodeEditKit",
"state" : {
"revision" : "ad28213a968586abb0cb21a8a56a3587227895f1",
"version" : "0.1.2"
Expand All @@ -31,7 +31,7 @@
{
"identity" : "codeeditsourceeditor",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditSourceEditor.git",
"location" : "https://github.com/CodeEditApp/CodeEditSourceEditor",
"state" : {
"revision" : "cf85789d527d569e94edfd674c5ac8071b244dd9",
"version" : "0.7.3"
Expand Down
37 changes: 30 additions & 7 deletions CodeEdit/Features/ActivityViewer/ActivityViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,33 @@ struct ActivityViewer: View {
@Environment(\.colorScheme)
var colorScheme

var workspaceFileManager: CEWorkspaceFileManager?

@ObservedObject var taskNotificationHandler: TaskNotificationHandler
@ObservedObject var workspaceSettingsManager: CEWorkspaceSettingsManager

// TODO: try to get this from the envrionment
@ObservedObject var taskManager: TaskManager

init(
workspaceFileManager: CEWorkspaceFileManager?,
workspaceSettingsManager: CEWorkspaceSettingsManager,
taskNotificationHandler: TaskNotificationHandler,
taskManager: TaskManager
) {
self.workspaceFileManager = workspaceFileManager
self.workspaceSettingsManager = workspaceSettingsManager
self.taskNotificationHandler = taskNotificationHandler
self.taskManager = taskManager
}
var body: some View {
HStack(spacing: 0) {
// This is only a placeholder for the task popover(coming in the next pr)
Rectangle()
.frame(height: 22)
.hidden()
.fixedSize()
SchemeDropDownView(
workspaceSettingsManager: workspaceSettingsManager,
workspaceFileManager: workspaceFileManager
)

TaskDropDownView(taskManager: taskManager)

Spacer(minLength: 0)

Expand All @@ -30,8 +48,13 @@ struct ActivityViewer: View {
.fixedSize(horizontal: false, vertical: false)
.padding(.horizontal, 10)
.background {
RoundedRectangle(cornerRadius: 5)
.opacity(0.1)
if colorScheme == .dark {
RoundedRectangle(cornerRadius: 5)
.opacity(0.10)
} else {
RoundedRectangle(cornerRadius: 5)
.opacity(0.1)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ struct TaskNotificationView: View {
} else {
if taskNotificationHandler.notifications.count > 1 {
Text("\(taskNotificationHandler.notifications.count)")
.font(.caption)
.padding(5)
.background(
Circle()
.foregroundStyle(.gray)
.opacity(0.3)
)
.padding(-5)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// DropdownMenuItemStyleModifier.swift
// CodeEdit
//
// Created by Tommy Ludwig on 24.06.24.
//

import SwiftUI

struct DropdownMenuItemStyleModifier: ViewModifier {
@State private var isHovering = false

func body(content: Content) -> some View {
content
.background(isHovering ? Color(NSColor.systemBlue) : .clear)
.foregroundColor(isHovering ? Color(NSColor.white) : .primary)
.onHover(perform: { hovering in
self.isHovering = hovering
})
}
}
32 changes: 32 additions & 0 deletions CodeEdit/Features/ActivityViewer/Tasks/OptionMenuItemView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// OptionMenuItemView.swift
// CodeEdit
//
// Created by Tommy Ludwig on 24.06.24.
//

import SwiftUI

struct OptionMenuItemView: View {
var label: String
var action: () -> Void
var body: some View {
HStack {
Text(label)
Spacer()
}
.padding(.vertical, 5)
.padding(.horizontal, 28)
.modifier(DropdownMenuItemStyleModifier())
.clipShape(RoundedRectangle(cornerRadius: 5))
.onTapGesture {
action()
}
}
}

#Preview {
OptionMenuItemView(label: "Tst") {
print("test")
}
}
100 changes: 100 additions & 0 deletions CodeEdit/Features/ActivityViewer/Tasks/SchemeDropDownView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//
// SchemeDropDownView.swift
// CodeEdit
//
// Created by Tommy Ludwig on 24.06.24.
//

import SwiftUI

struct SchemeDropDownView: View {
@Environment(\.colorScheme)
private var colorScheme

@State var isSchemePopOverPresented: Bool = false
@State private var isHoveringScheme: Bool = false

@ObservedObject var workspaceSettingsManager: CEWorkspaceSettingsManager
var workspaceFileManager: CEWorkspaceFileManager?

var body: some View {
HStack(spacing: 5) {
Image(systemName: "folder.badge.gearshape")
.imageScale(.medium)

Group {
if workspaceSettingsManager.settings.project.projectName.isEmpty {
Text(workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
} else {
Text(workspaceSettingsManager.settings.project.projectName)
}
}.font(.subheadline)
}
.font(.caption)
.padding(.trailing, 9)
.padding(5)
.background {
Color(nsColor: colorScheme == .dark ? .white : .black)
.opacity(isHoveringScheme || isSchemePopOverPresented ? 0.05 : 0)
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 4, height: 4)))
HStack {
Spacer()
if isHoveringScheme || isSchemePopOverPresented {
chevronDown
.padding(.trailing, 3)
} else {
chevron
.padding(.trailing, 3)
}
}
}
.onHover(perform: { hovering in
self.isHoveringScheme = hovering
})
.popover(isPresented: $isSchemePopOverPresented, arrowEdge: .bottom) {
VStack(alignment: .leading, spacing: 0) {
WorkspaceMenuItemView(
workspaceFileManager: workspaceFileManager,
item: workspaceFileManager?.workspaceItem
)

Divider()
.padding(.vertical, 5)
Group {
OptionMenuItemView(label: "Add Folder..") {
// TODO: Implment Add Folder
print("NOT IMPLMENTED")
}
OptionMenuItemView(label: "Workspace Settings...") {
NSApp.sendAction(
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
)
}
}
}
.padding(5)
}.onTapGesture {
self.isSchemePopOverPresented.toggle()
}
}

private var chevron: some View {
Image(systemName: "chevron.compact.right")
.font(.system(size: 9, weight: .medium, design: .default))
.foregroundStyle(.secondary)
.scaleEffect(x: 1.30, y: 1.0, anchor: .center)
.imageScale(.large)
}

private var chevronDown: some View {
VStack(spacing: 1) {
Image(systemName: "chevron.down")
}
.font(.system(size: 8, weight: .bold, design: .default))
.padding(.top, 0.5)
}
}

// #Preview {
// SchemeDropDownMenuView()
// }
Loading