Skip to content

Commit

Permalink
Pre-release 0.25.83
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 11, 2024
1 parent 1b8224d commit baf6492
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 87 deletions.

This file was deleted.

Binary file not shown.
29 changes: 14 additions & 15 deletions Core/Sources/HostApp/GeneralView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct AppInfoView: View {
var body: some View {
VStack(alignment: .leading) {
HStack(alignment: .center, spacing: 16) {
Image("copilotIcon")
Image(nsImage: NSImage(named: "AppIcon") ?? NSImage())
.resizable()
.frame(width: 110, height: 110)
VStack(alignment: .leading) {
Expand Down Expand Up @@ -168,21 +168,20 @@ struct GeneralSettingsView: View {
.padding(8)

Divider()
HStack {
VStack(alignment: .leading) {
Text(StringConstants.extensionPermission)
.font(.body)
Text("""
Check for GitHub Copilot in Xcode's Editor menu. \
Restart Xcode if greyed out.
""")
.font(.footnote)
Link(destination: URL(string: "x-apple.systempreferences:com.apple.ExtensionsPreferences")!) {
HStack {
VStack(alignment: .leading) {
Text(StringConstants.extensionPermission)
.font(.body)
Text("""
Check for GitHub Copilot in Xcode's Editor menu. \
Restart Xcode if greyed out.
""")
.font(.footnote)
}
Spacer()
Image(systemName: "chevron.right")
}
Spacer()
Image(systemName: "chevron.right")
}
.onTapGesture {
shouldPresentExtensionPermissionAlert = true
}
.foregroundStyle(.primary)
.padding(.horizontal, 8)
Expand Down
1 change: 0 additions & 1 deletion Core/Sources/SuggestionWidget/ChatPanelWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ final class ChatPanelWindow: NSWindow {
.transient,
.fullScreenPrimary,
.fullScreenAllowsTiling,
.canJoinAllSpaces
]
hasShadow = true
contentView = NSHostingView(
Expand Down
8 changes: 4 additions & 4 deletions Server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"description": "Package for downloading @github/copilot-language-server",
"private": true,
"dependencies": {
"@github/copilot-language-server": "^1.237.0"
"@github/copilot-language-server": "^1.238.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ public class GitHubCopilotBaseService {
in: .userDomainMask
).first?.appendingPathComponent(
Bundle.main
.object(forInfoDictionaryKey: "APPLICATION_SUPPORT_FOLDER") as! String
.object(forInfoDictionaryKey: "APPLICATION_SUPPORT_FOLDER") as? String
?? "com.github.CopilotForXcode"
) else {
throw CancellationError()
}
Expand Down
13 changes: 10 additions & 3 deletions Tool/Sources/SharedUIComponents/AsyncCodeBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ public struct AsyncCodeBlock: View {
.fixedSize()
}

@ViewBuilder
func lineBackgroundShape(_ multiLine: Bool) -> some View {
let color = currentLineBackgroundColor ?? backgroundColor
switch multiLine {
case true: HalfCapsule().fill(color)
case false: Rectangle().fill(color)
}
}

@ScaledMetric var iconPadding: CGFloat = 9.0
@ScaledMetric var iconSpacing: CGFloat = 6.0
@ScaledMetric var optionPadding: CGFloat = 0.5
Expand Down Expand Up @@ -199,9 +208,7 @@ public struct AsyncCodeBlock: View {
}
}
.frame(height: lineHeight)
.background(
HalfCapsule().fill(currentLineBackgroundColor ?? backgroundColor)
)
.background(lineBackgroundShape(lines.count > 1))
.padding(.leading, firstLineIndent)
.onHover { hovering in
guard hovering != isHovering else { return }
Expand Down
122 changes: 72 additions & 50 deletions Tool/Sources/SharedUIComponents/CopilotIntroSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct CopilotIntroItem: View {
image
.resizable()
.renderingMode(.template)
.foregroundColor(Color(red: 0.0353, green: 0.4118, blue: 0.8549))
.foregroundColor(.blue)
.scaledToFit()
.frame(width: 28, height: 28)
VStack(alignment: .leading, spacing: 5) {
Expand All @@ -39,6 +39,66 @@ struct CopilotIntroItem: View {
}
}

struct CopilotIntroContent: View {
let hideIntro: Binding<Bool>
let continueAction: () -> Void

var body: some View {
VStack {
let appImage = if let nsImage = NSImage(named: "AppIcon") {
Image(nsImage: nsImage)
} else {
Image(systemName: "app")
}
appImage
.resizable()
.scaledToFit()
.frame(width: 64, height: 64)
.padding(.bottom, 24)
Text("Welcome to Copilot for Xcode!")
.font(.title.bold())
.padding(.bottom, 38)

VStack(alignment: .leading, spacing: 20) {
CopilotIntroItem(
imageName: "CopilotLogo",
heading: "In-line Code Suggestions",
text: "Copilot's code suggestions and text completion now available in Xcode. Press Tab ⇥ to accept a suggestion."
)

CopilotIntroItem(
systemImage: "option",
heading: "Full Suggestion",
text: "Press Option ⌥ key to display the full suggestion. Only the first line of suggestions are shown inline."
)

CopilotIntroItem(
imageName: "GitHubMark",
heading: "GitHub Context",
text: "Copilot utilizes project context to deliver smarter code suggestions relevant to your unique codebase."
)
}
.padding(.bottom, 64)

VStack(spacing: 8) {
Button(action: continueAction) {
Text("Continue")
.padding(.horizontal, 80)
.padding(.vertical, 6)
}
.buttonStyle(.borderedProminent)

Toggle("Don't show again", isOn: hideIntro)
.toggleStyle(.checkbox)
}
}
.padding(.horizontal, 56)
.padding(.top, 48)
.padding(.bottom, 16)
.frame(width: 560)
}
}

public struct CopilotIntroSheet<Content: View>: View {
let content: Content
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
Expand All @@ -48,58 +108,13 @@ public struct CopilotIntroSheet<Content: View>: View {

public var body: some View {
content.sheet(isPresented: $isPresented) {
VStack {
Image(nsImage: NSImage(named: "AppIcon") ?? NSImage())
.resizable()
.scaledToFit()
.frame(width: 64, height: 64)
.padding(.bottom, 24)
Text("Welcome to Copilot for Xcode!")
.font(.title)
.padding(.bottom, 45)

VStack(alignment: .leading, spacing: 25) {
CopilotIntroItem(
imageName: "CopilotLogo",
heading: "In-line Code Suggestions",
text: "Copilot's code suggestions and text completion now available in Xcode. Just press Tab ⇥ to accept a suggestion."
)

CopilotIntroItem(
systemImage: "option",
heading: "Full Suggestion",
text: "Press Option ⌥ key to display the full suggestion. Only the first line of suggestions are shown inline."
)

CopilotIntroItem(
imageName: "GitHubMark",
heading: "GitHub Context",
text: "Copilot utilizes GitHub and project context to deliver smarter completions and personalized code suggestions relevant to your unique codebase."
)
}

Spacer()

VStack(spacing: 8) {
Button(action: { isPresented = false }) {
Text("Continue")
.padding(.horizontal, 80)
.padding(.vertical, 6)
}
.buttonStyle(.borderedProminent)

Toggle("Don't show again", isOn: $hideIntro)
.toggleStyle(.checkbox)
}
CopilotIntroContent(hideIntro: $hideIntro) {
isPresented = false
}
.padding(EdgeInsets(top: 50, leading: 50, bottom: 16, trailing: 50))
.frame(width: 560, height: 528)
}
.task {
let neverShown = introLastShownVersion.isEmpty
isPresented = neverShown || !hideIntro
if isPresented {
hideIntro = neverShown ? true : hideIntro // default to hidden on first time
if hideIntro == false {
isPresented = true
introLastShownVersion = appVersion
}
}
Expand All @@ -111,3 +126,10 @@ public extension View {
CopilotIntroSheet(content: self)
}
}


// MARK: - Preview
@available(macOS 14.0, *)
#Preview(traits: .sizeThatFitsLayout) {
CopilotIntroContent(hideIntro: .constant(false)) { }
}

0 comments on commit baf6492

Please sign in to comment.