Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
437105f
Merge tag '0.31.3' into develop
intitni Mar 29, 2024
c407edd
Add suggestion service configuration
intitni Mar 4, 2024
998d413
Update
intitni Mar 21, 2024
7e358e5
Update
intitni Mar 21, 2024
9db5e00
Udate
intitni Mar 27, 2024
d2cd089
Bump version of Swift async algorithms
intitni Apr 2, 2024
c374beb
Update
intitni Apr 2, 2024
c410167
Update
intitni Apr 2, 2024
d0924ae
Merge branch 'feature/passing-relevant-snippets-to-suggestion-service…
intitni Apr 2, 2024
5b88887
Disable snippets from opened file when not needed
intitni Apr 2, 2024
d16d1c7
Pass scenario to highlighter
intitni Apr 3, 2024
d5caace
Support storing codable object in UserDefaults
intitni Apr 4, 2024
6447b3c
Add preference keys for theme
intitni Apr 4, 2024
adaac4f
Apply theme to UI components
intitni Apr 4, 2024
5ca085c
Tweak the behavior of theme change in chat
intitni Apr 4, 2024
1c4f3fe
Merge branch 'feature/xcode-theme' into develop
intitni Apr 4, 2024
7118062
Update
intitni Apr 4, 2024
a77ee20
Update
intitni Apr 4, 2024
efed398
Merge tag '0.32.0.beta' into develop
intitni Apr 4, 2024
2b70557
Display the error description of a language server error in the host app
intitni Apr 5, 2024
7d16b3c
Merge branch 'feature/display-github-copilot-error-in-host-app' into …
intitni Apr 5, 2024
e9b9cd2
Fix typo
intitni Apr 5, 2024
71ce6d5
Lower minimum debounce
intitni Apr 5, 2024
f315e0b
Merge tag 'use-cloudflare-domain-name-for-validation' into develop
intitni Apr 7, 2024
8e11ca2
Add preference keys for fonts
intitni Apr 7, 2024
e9525da
Add font picker
intitni Apr 7, 2024
b8433c1
Support changing code font of suggestion, chat and prompt to code
intitni Apr 7, 2024
abcaaec
Add terminal font preference key
intitni Apr 7, 2024
cef6d05
Merge branch 'feature/font-picker' into develop
intitni Apr 7, 2024
bead740
Merge tag 'fix-auto-check-update-toggle-not-updating' into develop
intitni Apr 7, 2024
d891b79
Update
intitni Apr 7, 2024
40fcb26
Support changing base URL of Google Generative AI
intitni Apr 8, 2024
e02a1f5
Fix endpoint of Google Generative AI
intitni Apr 8, 2024
3e7c947
Merge branch 'feature/google-generative-ai-custom-baseurl' into develop
intitni Apr 8, 2024
d4fb901
Move refreshUpdateTime calls to Workspace
intitni Apr 10, 2024
e6e6eeb
Rename to lastUpdateTime
intitni Apr 10, 2024
44ab963
Make lastUpdateTime publicly readable
intitni Apr 10, 2024
133b659
Support getting int value from AXUIElement
intitni Apr 10, 2024
f873f33
Update
intitni Apr 10, 2024
40c1a1e
Add CloseIdleTabsCommand
intitni Apr 10, 2024
37fde45
Add settings for closing idle tabs
intitni Apr 10, 2024
0b10b54
Update
intitni Apr 10, 2024
630646e
Merge branch 'feature/auto-close-tabs' into develop
intitni Apr 10, 2024
58bb038
Fix default value
intitni Apr 10, 2024
f6c6488
Update to also use title changed event to detect file change
intitni Apr 10, 2024
e17ce5a
Allow all file types to have a filespace
intitni Apr 10, 2024
1eed5bb
Move filespace creation on editor change to Service
intitni Apr 10, 2024
a3f6695
Merge tag '0.32.0.beta.2' into develop
intitni Apr 11, 2024
5fa427e
Fix bugs in idle tab closing
intitni Apr 11, 2024
75f5b0f
Update idle tab closing
intitni Apr 11, 2024
6249d12
Update UI
intitni Apr 14, 2024
47086c6
Support setting Google AI api version
intitni Apr 14, 2024
374194a
Add new OpenAI models
intitni Apr 14, 2024
e49b703
Update idle tab closing
intitni Apr 15, 2024
548d8e3
Update
intitni Apr 15, 2024
a904b59
Bump version
intitni Apr 11, 2024
5627c03
Update appcast.xml
intitni Apr 15, 2024
a8c1bd0
Merge branch 'release/0.32.0'
intitni Apr 15, 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
Prev Previous commit
Next Next commit
Pass scenario to highlighter
  • Loading branch information
intitni committed Apr 3, 2024
commit d16d1c7ca18d659c890b10cff6731798307f1744
1 change: 1 addition & 0 deletions Core/Sources/ChatGPTChatTab/ChatPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ struct ChatCodeSyntaxHighlighter: CodeSyntaxHighlighter {
let content = highlightedCodeBlock(
code: content,
language: language ?? "",
scenario: "chat",
brightMode: brightMode,
fontSize: fontSize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ struct CodeBlockSuggestionPanel: View {
CodeBlock(
code: suggestion.code,
language: suggestion.language,
startLineIndex: suggestion.startLineIndex,
startLineIndex: suggestion.startLineIndex,
scenario: "suggestion",
colorScheme: colorScheme,
fontSize: fontSize,
droppingLeadingSpaces: hideCommonPrecedingSpaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ extension PromptToCodePanel {
CodeBlock(
code: viewStore.state.code,
language: viewStore.state.language,
startLineIndex: viewStore.state.startLineIndex,
startLineIndex: viewStore.state.startLineIndex,
scenario: "promptToCode",
colorScheme: colorScheme,
firstLinePrecedingSpaceCount: viewStore.state
.firstLinePrecedingSpaceCount,
Expand Down
2 changes: 1 addition & 1 deletion Pro
Submodule Pro updated from dd5f6c to 7c3e41
2 changes: 1 addition & 1 deletion Tool/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let package = Package(
.package(url: "https://github.com/ChimeHQ/JSONRPC", exact: "0.6.0"),
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.6.0"),
.package(url: "https://github.com/unum-cloud/usearch", from: "0.19.1"),
.package(url: "https://github.com/intitni/Highlightr", branch: "bump-highlight-js-version"),
.package(url: "https://github.com/intitni/Highlightr", branch: "master"),
.package(
url: "https://github.com/pointfreeco/swift-composable-architecture",
from: "0.55.0"
Expand Down
7 changes: 7 additions & 0 deletions Tool/Sources/SharedUIComponents/CodeBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public struct CodeBlock: View {
public let code: String
public let language: String
public let startLineIndex: Int
public let scenario: String
public let colorScheme: ColorScheme
public let commonPrecedingSpaceCount: Int
public let highlightedCode: [NSAttributedString]
Expand All @@ -15,6 +16,7 @@ public struct CodeBlock: View {
code: String,
language: String,
startLineIndex: Int,
scenario: String,
colorScheme: ColorScheme,
firstLinePrecedingSpaceCount: Int = 0,
fontSize: Double,
Expand All @@ -23,6 +25,7 @@ public struct CodeBlock: View {
self.code = code
self.language = language
self.startLineIndex = startLineIndex
self.scenario = scenario
self.colorScheme = colorScheme
self.droppingLeadingSpaces = droppingLeadingSpaces
self.firstLinePrecedingSpaceCount = firstLinePrecedingSpaceCount
Expand All @@ -33,6 +36,7 @@ public struct CodeBlock: View {
let result = Self.highlight(
code: padding + code,
language: language,
scenario: scenario,
colorScheme: colorScheme,
fontSize: fontSize,
droppingLeadingSpaces: droppingLeadingSpaces
Expand Down Expand Up @@ -75,13 +79,15 @@ public struct CodeBlock: View {
static func highlight(
code: String,
language: String,
scenario: String,
colorScheme: ColorScheme,
fontSize: Double,
droppingLeadingSpaces: Bool
) -> (code: [NSAttributedString], commonLeadingSpaceCount: Int) {
return highlighted(
code: code,
language: language,
scenario: scenario,
brightMode: colorScheme != .dark,
droppingLeadingSpaces: droppingLeadingSpaces,
fontSize: fontSize
Expand All @@ -100,6 +106,7 @@ struct CodeBlock_Previews: PreviewProvider {
""",
language: "swift",
startLineIndex: 0,
scenario: "",
colorScheme: .dark,
firstLinePrecedingSpaceCount: 0,
fontSize: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct _CodeBlock: View {
let highlightedCode: AttributedString
let colorScheme: ColorScheme
let droppingLeadingSpaces: Bool
let scenario: String

/// Create a text edit view with a certain text that uses a certain options.
/// - Parameters:
Expand All @@ -23,6 +24,7 @@ struct _CodeBlock: View {
code: String,
language: String,
firstLinePrecedingSpaceCount: Int,
scenario: String,
colorScheme: ColorScheme,
fontSize: Double,
droppingLeadingSpaces: Bool,
Expand All @@ -32,13 +34,15 @@ struct _CodeBlock: View {
self.fontSize = fontSize
self.colorScheme = colorScheme
self.droppingLeadingSpaces = droppingLeadingSpaces
self.scenario = scenario

let padding = firstLinePrecedingSpaceCount > 0
? String(repeating: " ", count: firstLinePrecedingSpaceCount)
: ""
let result = Self.highlight(
code: padding + code,
language: language,
scenario: scenario,
colorScheme: colorScheme,
fontSize: fontSize,
droppingLeadingSpaces: droppingLeadingSpaces
Expand Down Expand Up @@ -68,13 +72,15 @@ struct _CodeBlock: View {
static func highlight(
code: String,
language: String,
scenario: String,
colorScheme: ColorScheme,
fontSize: Double,
droppingLeadingSpaces: Bool
) -> (code: AttributedString, commonLeadingSpaceCount: Int) {
let (lines, commonLeadingSpaceCount) = highlighted(
code: code,
language: language,
language: language,
scenario: scenario,
brightMode: colorScheme != .dark,
droppingLeadingSpaces: droppingLeadingSpaces,
fontSize: fontSize,
Expand Down
13 changes: 11 additions & 2 deletions Tool/Sources/SharedUIComponents/SyntaxHighlighting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import SwiftUI
public func highlightedCodeBlock(
code: String,
language: String,
scenario: String,
brightMode: Bool,
fontSize: Double
) -> NSAttributedString {
Expand All @@ -27,7 +28,13 @@ public func highlightedCodeBlock(
guard let highlighter = Highlightr() else {
return unhighlightedCode()
}
highlighter.setTheme(to: brightMode ? "xcode" : "atom-one-dark")
highlighter.setTheme(to: {
let mode = brightMode ? "light" : "dark"
if scenario.isEmpty {
return mode
}
return "\(scenario)-\(mode)"
}())
highlighter.theme.setCodeFont(.monospacedSystemFont(ofSize: fontSize, weight: .regular))
guard let formatted = highlighter.highlight(code, as: language) else {
return unhighlightedCode()
Expand All @@ -41,14 +48,16 @@ public func highlightedCodeBlock(
public func highlighted(
code: String,
language: String,
scenario: String,
brightMode: Bool,
droppingLeadingSpaces: Bool,
fontSize: Double,
replaceSpacesWithMiddleDots: Bool = true
) -> (code: [NSAttributedString], commonLeadingSpaceCount: Int) {
let formatted = highlightedCodeBlock(
code: code,
language: language,
language: language,
scenario: scenario,
brightMode: brightMode,
fontSize: fontSize
)
Expand Down