Skip to content

Commit 0bb4c2f

Browse files
committed
Merge branch 'main' into feat/lsp-semantic-highlighter
2 parents 359872f + c887249 commit 0bb4c2f

File tree

75 files changed

+1551
-566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1551
-566
lines changed

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 98 additions & 33 deletions
Large diffs are not rendered by default.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1620"
4+
wasCreatedForAppExtension = "YES"
5+
version = "2.0">
6+
<BuildAction
7+
parallelizeBuildables = "YES"
8+
buildImplicitDependencies = "YES"
9+
buildArchitectures = "Automatic">
10+
<BuildActionEntries>
11+
<BuildActionEntry
12+
buildForTesting = "YES"
13+
buildForRunning = "YES"
14+
buildForProfiling = "YES"
15+
buildForArchiving = "YES"
16+
buildForAnalyzing = "YES">
17+
<BuildableReference
18+
BuildableIdentifier = "primary"
19+
BlueprintIdentifier = "2BE487EB28245162003F3F64"
20+
BuildableName = "OpenWithCodeEdit.appex"
21+
BlueprintName = "OpenWithCodeEdit"
22+
ReferencedContainer = "container:CodeEdit.xcodeproj">
23+
</BuildableReference>
24+
</BuildActionEntry>
25+
<BuildActionEntry
26+
buildForTesting = "YES"
27+
buildForRunning = "YES"
28+
buildForProfiling = "YES"
29+
buildForArchiving = "YES"
30+
buildForAnalyzing = "YES">
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
34+
BuildableName = "CodeEdit.app"
35+
BlueprintName = "CodeEdit"
36+
ReferencedContainer = "container:CodeEdit.xcodeproj">
37+
</BuildableReference>
38+
</BuildActionEntry>
39+
</BuildActionEntries>
40+
</BuildAction>
41+
<TestAction
42+
buildConfiguration = "Debug"
43+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
44+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
45+
shouldUseLaunchSchemeArgsEnv = "YES"
46+
shouldAutocreateTestPlan = "YES">
47+
</TestAction>
48+
<LaunchAction
49+
buildConfiguration = "Debug"
50+
selectedDebuggerIdentifier = ""
51+
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
52+
launchStyle = "0"
53+
askForAppToLaunch = "Yes"
54+
useCustomWorkingDirectory = "NO"
55+
ignoresPersistentStateOnLaunch = "NO"
56+
debugDocumentVersioning = "YES"
57+
debugServiceExtension = "internal"
58+
allowLocationSimulation = "YES"
59+
launchAutomaticallySubstyle = "2">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
65+
BuildableName = "CodeEdit.app"
66+
BlueprintName = "CodeEdit"
67+
ReferencedContainer = "container:CodeEdit.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</LaunchAction>
71+
<ProfileAction
72+
buildConfiguration = "Release"
73+
shouldUseLaunchSchemeArgsEnv = "YES"
74+
savedToolIdentifier = ""
75+
useCustomWorkingDirectory = "NO"
76+
debugDocumentVersioning = "YES"
77+
askForAppToLaunch = "Yes"
78+
launchAutomaticallySubstyle = "2">
79+
<BuildableProductRunnable
80+
runnableDebuggingMode = "0">
81+
<BuildableReference
82+
BuildableIdentifier = "primary"
83+
BlueprintIdentifier = "B658FB2B27DA9E0F00EA4DBD"
84+
BuildableName = "CodeEdit.app"
85+
BlueprintName = "CodeEdit"
86+
ReferencedContainer = "container:CodeEdit.xcodeproj">
87+
</BuildableReference>
88+
</BuildableProductRunnable>
89+
</ProfileAction>
90+
<AnalyzeAction
91+
buildConfiguration = "Debug">
92+
</AnalyzeAction>
93+
<ArchiveAction
94+
buildConfiguration = "Release"
95+
revealArchiveInOrganizer = "YES">
96+
</ArchiveAction>
97+
</Scheme>

CodeEdit/Features/ActivityViewer/ActivityViewer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,7 @@ struct ActivityViewer: View {
5959
.opacity(0.1)
6060
}
6161
}
62+
.accessibilityElement(children: .contain)
63+
.accessibilityLabel("Activity Viewer")
6264
}
6365
}

CodeEdit/Features/ActivityViewer/Notifications/CECircularProgressView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ struct CECircularProgressView: View {
5050
.font(.caption)
5151
}
5252
}
53+
.accessibilityElement()
54+
.accessibilityAddTraits(.updatesFrequently)
55+
.accessibilityValue(
56+
progress != nil ? Text(progress!, format: .percent) : Text("working")
57+
)
5358
}
5459
}
5560

CodeEdit/Features/ActivityViewer/Notifications/TaskNotificationView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import SwiftUI
99

1010
struct TaskNotificationView: View {
11+
@Environment(\.controlActiveState)
12+
private var activeState
13+
1114
@ObservedObject var taskNotificationHandler: TaskNotificationHandler
1215
@State private var isPresented: Bool = false
1316
@State var notification: TaskNotificationModel?
@@ -46,12 +49,14 @@ struct TaskNotificationView: View {
4649
}
4750
}
4851
.transition(.opacity.combined(with: .move(edge: .trailing)))
52+
.opacity(activeState == .inactive ? 0.4 : 1.0)
4953
.padding(3)
5054
.padding(-3)
5155
.padding(.trailing, 3)
5256
.popover(isPresented: $isPresented, arrowEdge: .bottom) {
5357
TaskNotificationsDetailView(taskNotificationHandler: taskNotificationHandler)
54-
}.onTapGesture {
58+
}
59+
.onTapGesture {
5560
self.isPresented.toggle()
5661
}
5762
}

CodeEdit/Features/ActivityViewer/Tasks/OptionMenuItemView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import SwiftUI
1010
struct OptionMenuItemView: View {
1111
var label: String
1212
var action: () -> Void
13+
1314
var body: some View {
1415
HStack {
1516
Text(label)
@@ -22,6 +23,11 @@ struct OptionMenuItemView: View {
2223
.onTapGesture {
2324
action()
2425
}
26+
.accessibilityElement()
27+
.accessibilityAction {
28+
action()
29+
}
30+
.accessibilityLabel(label)
2531
}
2632
}
2733

CodeEdit/Features/ActivityViewer/Tasks/SchemeDropDownView.swift

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ struct SchemeDropDownView: View {
1111
@Environment(\.colorScheme)
1212
private var colorScheme
1313

14+
@Environment(\.controlActiveState)
15+
private var activeState
16+
1417
@State var isSchemePopOverPresented: Bool = false
1518
@State private var isHoveringScheme: Bool = false
1619

@@ -21,16 +24,21 @@ struct SchemeDropDownView: View {
2124
workspaceSettingsManager.settings.project.projectName
2225
}
2326

27+
/// Resolves the name one step further than `workspaceName`.
28+
var workspaceDisplayName: String {
29+
workspaceName.isEmpty
30+
? (workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
31+
: workspaceName
32+
}
33+
2434
var body: some View {
2535
HStack(spacing: 6) {
2636
Image(systemName: "folder.badge.gearshape")
2737
.imageScale(.medium)
28-
Text(
29-
workspaceName.isEmpty
30-
? (workspaceFileManager?.workspaceItem.fileName() ?? "No Project found")
31-
: workspaceName
32-
)
38+
Text(workspaceDisplayName)
39+
.frame(minWidth: 0)
3340
}
41+
.opacity(activeState == .inactive ? 0.4 : 1.0)
3442
.font(.subheadline)
3543
.padding(.trailing, 11.5)
3644
.padding(.horizontal, 2.5)
@@ -54,31 +62,19 @@ struct SchemeDropDownView: View {
5462
self.isHoveringScheme = hovering
5563
})
5664
.instantPopover(isPresented: $isSchemePopOverPresented, arrowEdge: .bottom) {
57-
VStack(alignment: .leading, spacing: 0) {
58-
WorkspaceMenuItemView(
59-
workspaceFileManager: workspaceFileManager,
60-
item: workspaceFileManager?.workspaceItem
61-
)
62-
Divider()
63-
.padding(.vertical, 5)
64-
Group {
65-
OptionMenuItemView(label: "Add Folder...") {
66-
// TODO: Implment Add Folder
67-
print("NOT IMPLEMENTED")
68-
}
69-
OptionMenuItemView(label: "Workspace Settings...") {
70-
NSApp.sendAction(
71-
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
72-
)
73-
}
74-
}
75-
}
76-
.font(.subheadline)
77-
.padding(5)
78-
.frame(minWidth: 215)
65+
popoverContent
7966
}
8067
.onTapGesture {
81-
self.isSchemePopOverPresented.toggle()
68+
isSchemePopOverPresented.toggle()
69+
}
70+
.accessibilityElement(children: .combine)
71+
.accessibilityAddTraits(.isButton)
72+
.accessibilityIdentifier("SchemeDropdown")
73+
.accessibilityValue(workspaceDisplayName)
74+
.accessibilityLabel("Active Scheme")
75+
.accessibilityHint("Open the active scheme menu")
76+
.accessibilityAction {
77+
isSchemePopOverPresented.toggle()
8278
}
8379
}
8480

@@ -97,6 +93,32 @@ struct SchemeDropDownView: View {
9793
.font(.system(size: 8, weight: .semibold, design: .default))
9894
.padding(.top, 0.5)
9995
}
96+
97+
@ViewBuilder var popoverContent: some View {
98+
VStack(alignment: .leading, spacing: 0) {
99+
WorkspaceMenuItemView(
100+
workspaceFileManager: workspaceFileManager,
101+
item: workspaceFileManager?.workspaceItem
102+
)
103+
Divider()
104+
.padding(.vertical, 5)
105+
Group {
106+
OptionMenuItemView(label: "Add Folder...") {
107+
// TODO: Implment Add Folder
108+
print("NOT IMPLEMENTED")
109+
}
110+
.disabled(true)
111+
OptionMenuItemView(label: "Workspace Settings...") {
112+
NSApp.sendAction(
113+
#selector(CodeEditWindowController.openWorkspaceSettings(_:)), to: nil, from: nil
114+
)
115+
}
116+
}
117+
}
118+
.font(.subheadline)
119+
.padding(5)
120+
.frame(minWidth: 215)
121+
}
100122
}
101123

102124
// #Preview {

CodeEdit/Features/ActivityViewer/Tasks/TaskDropDownView.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ struct TaskDropDownView: View {
1111
@Environment(\.colorScheme)
1212
private var colorScheme
1313

14+
@Environment(\.controlActiveState)
15+
private var activeState
16+
1417
@ObservedObject var taskManager: TaskManager
1518

1619
@State private var isTaskPopOverPresented: Bool = false
@@ -28,8 +31,10 @@ struct TaskDropDownView: View {
2831
}
2932
} else {
3033
Text("Create Tasks")
34+
.frame(minWidth: 0)
3135
}
3236
}
37+
.opacity(activeState == .inactive ? 0.4 : 1.0)
3338
.font(.subheadline)
3439
.padding(.trailing, 11.5)
3540
.padding(.horizontal, 2.5)
@@ -38,12 +43,21 @@ struct TaskDropDownView: View {
3843
.onHover { hovering in
3944
self.isHoveringTasks = hovering
4045
}
41-
.instantPopover(isPresented: $isTaskPopOverPresented, arrowEdge: .bottom) {
46+
.instantPopover(isPresented: $isTaskPopOverPresented, arrowEdge: .top) {
4247
taskPopoverContent
4348
}
4449
.onTapGesture {
4550
self.isTaskPopOverPresented.toggle()
4651
}
52+
.accessibilityElement(children: .combine)
53+
.accessibilityAddTraits(.isButton)
54+
.accessibilityIdentifier("TaskDropdown")
55+
.accessibilityValue(taskManager.selectedTask?.name ?? "Create Tasks")
56+
.accessibilityLabel("Active Task")
57+
.accessibilityHint("Open the active task menu")
58+
.accessibilityAction {
59+
isTaskPopOverPresented = true
60+
}
4761
}
4862

4963
private var backgroundColor: some View {
@@ -71,7 +85,9 @@ struct TaskDropDownView: View {
7185
VStack(alignment: .leading, spacing: 0) {
7286
if !taskManager.availableTasks.isEmpty {
7387
ForEach(taskManager.availableTasks, id: \.id) { task in
74-
TasksPopoverMenuItem(taskManager: taskManager, task: task)
88+
TasksPopoverMenuItem(taskManager: taskManager, task: task) {
89+
isTaskPopOverPresented = false
90+
}
7591
}
7692
Divider()
7793
.padding(.vertical, 5)

CodeEdit/Features/ActivityViewer/Tasks/TaskView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct TaskView: View {
1818
HStack(spacing: 5) {
1919
Image(systemName: "gearshape")
2020
Text(task.name)
21+
.frame(minWidth: 0)
2122
Spacer(minLength: 0)
2223
}
2324
.padding(.trailing, 7.5)
@@ -27,5 +28,7 @@ struct TaskView: View {
2728
.frame(width: 5, height: 5)
2829
.padding(.trailing, 2.5)
2930
}
31+
.accessibilityElement()
32+
.accessibilityLabel(task.name)
3033
}
3134
}

CodeEdit/Features/ActivityViewer/Tasks/TasksPopoverMenuItem.swift

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
import SwiftUI
99

10+
/// - Note: This view **cannot** use the `dismiss` environment value to dismiss the sheet. It has to negate the boolean
11+
/// value that presented it initially.
12+
/// See ``SwiftUI/View/instantPopover(isPresented:arrowEdge:content:)``
1013
struct TasksPopoverMenuItem: View {
11-
@Environment(\.dismiss)
12-
private var dismiss
13-
1414
@ObservedObject var taskManager: TaskManager
1515
var task: CETask
16+
var dismiss: () -> Void
1617

1718
var body: some View {
1819
HStack(spacing: 5) {
@@ -22,11 +23,12 @@ struct TasksPopoverMenuItem: View {
2223
.padding(.vertical, 4)
2324
.padding(.horizontal, 8)
2425
.modifier(DropdownMenuItemStyleModifier())
25-
.onTapGesture {
26-
taskManager.selectedTaskID = task.id
27-
dismiss()
28-
}
26+
.onTapGesture(perform: selectAction)
2927
.clipShape(RoundedRectangle(cornerRadius: 5))
28+
.accessibilityElement()
29+
.accessibilityLabel(task.name)
30+
.accessibilityAction(.default, selectAction)
31+
.accessibilityAddTraits(taskManager.selectedTaskID == task.id ? [.isSelected] : [])
3032
}
3133

3234
private var selectionIndicator: some View {
@@ -52,4 +54,9 @@ struct TasksPopoverMenuItem: View {
5254
}
5355
}
5456
}
57+
58+
private func selectAction() {
59+
taskManager.selectedTaskID = task.id
60+
dismiss()
61+
}
5562
}

0 commit comments

Comments
 (0)