Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
bbf5dc0
Merge tag '0.21.0' into develop
intitni Aug 9, 2023
3a34444
Make OverrideChatGPTConfiguration non-generic
intitni Aug 11, 2023
930177e
Add function calling fallback when the bot is calling a function not …
intitni Aug 11, 2023
e1360a2
Merge branch 'feature/function-calling-fallback' into develop
intitni Aug 11, 2023
e7834c6
Add settings key suggestionDisplayCompactMode
intitni Aug 11, 2023
63737ca
Support hiding buttons in suggestion panel
intitni Aug 11, 2023
ae454a1
Merge branch 'feature/compact-suggestion' into develop
intitni Aug 11, 2023
63e25a2
Fix padding
intitni Aug 11, 2023
626622b
Support opening web page in new tab
intitni Aug 11, 2023
ba1c738
Fix command+w to close tab
intitni Aug 11, 2023
e587cda
Support opening new tab from chat tab
intitni Aug 11, 2023
93734f3
Merge branch 'feature/handle-blank-link-browser-tab' into develop
intitni Aug 11, 2023
f6177b7
Bump highlight.js version
intitni Aug 11, 2023
f10bdae
Remove Splash
intitni Aug 11, 2023
d43798c
Merge branch 'feature/bump-highlightjs-version' into develop
intitni Aug 11, 2023
106417c
Merge tag '0.21.1' into develop
intitni Aug 13, 2023
ba53c27
Allow generating restorable tab data
intitni Aug 11, 2023
ac3f944
Migrate chat tab to a more maintainable structure
intitni Aug 12, 2023
dc32492
Fix menu not updating
intitni Aug 12, 2023
f2674dc
Adjust restore to return builder
intitni Aug 12, 2023
72e81ac
Add CoreData
intitni Aug 13, 2023
a965b79
Connect GUI to ChatTabPersistent
intitni Aug 13, 2023
7efe060
Adjust implementation of restore
intitni Aug 13, 2023
ff94f17
Fix typo
intitni Aug 13, 2023
b539596
Support restoring chat tabs
intitni Aug 13, 2023
e9fe64d
Make ChatGPTChatTab persistable
intitni Aug 13, 2023
98b464f
Make store loading async
intitni Aug 14, 2023
6a24743
Merge branch 'feature/persisted-chat' into develop
intitni Aug 14, 2023
fe04f9d
Use I instead of the user when talking to the bot
intitni Aug 14, 2023
efd5c7b
Merge tag 'allow-disabling-function-calling' into develop
intitni Aug 14, 2023
4219f3c
Merge tag '0.21.2' into develop
intitni Aug 14, 2023
b29247e
Add Tool/Workspace
intitni Aug 14, 2023
d9e230c
Update
intitni Aug 16, 2023
19d0608
Adjust Tool/Workspace
intitni Aug 16, 2023
dee703a
Replace the Workspace with the one from Tool
intitni Aug 16, 2023
824ad01
Add Service singleton to handle all other singletons in Service target
intitni Aug 16, 2023
29afe7e
Update tests
intitni Aug 16, 2023
e837f9d
Remove PresentInCommentSuggestionPresenter
intitni Aug 16, 2023
3a25e7a
Merge branch 'feature/move-workspace-to-tool' into develop
intitni Aug 16, 2023
360f3b8
Adjust Workspace
intitni Aug 16, 2023
1e8b157
Move CGEventObserver to Tool
intitni Aug 16, 2023
44ecf40
Support accepting suggestion with tab
intitni Aug 16, 2023
f0634b9
Adjust interface of Service
intitni Aug 16, 2023
ad167e7
Adjust API of ActiveApplicationMonitor
intitni Aug 16, 2023
1016380
Update
intitni Aug 16, 2023
46b817c
Move DependencyUpdater().update() to start
intitni Aug 16, 2023
4a1b47e
Add tab to accept suggestion settings
intitni Aug 17, 2023
8a562a4
Update
intitni Aug 17, 2023
947c9a6
Fix WithFeatureEnabled
intitni Aug 17, 2023
4098389
Update README.md
intitni Aug 17, 2023
58e90f0
Merge branch 'feature/tab-to-accept-suggestion' into develop
intitni Aug 17, 2023
2051e64
Display widget animation when it's hidden
intitni Aug 17, 2023
07f0064
Adjust animation
intitni Aug 17, 2023
b21001a
Make widget smaller
intitni Aug 17, 2023
3cfc193
Adjust padding
intitni Aug 17, 2023
6a75f10
Merge branch 'feature/circular-widget-animation-when-hidden' into dev…
intitni Aug 17, 2023
418fdd8
Tweak widget transition
intitni Aug 17, 2023
64728cd
Support processing text in shadow dom
intitni Aug 17, 2023
32bfe94
Bump version to 0.22.0
intitni Aug 17, 2023
993963b
Update
intitni Aug 17, 2023
0fe6bd8
Update README.md
intitni Aug 17, 2023
011596d
Update
intitni Aug 18, 2023
f37bc13
Add current time to system prompt
intitni Aug 18, 2023
e6ec55a
Fix
intitni Aug 18, 2023
6a3d377
Update appcast.xml
intitni Aug 18, 2023
9da3656
Add advanced settings for debug
intitni Aug 18, 2023
5cf302b
Update appcast.xml
intitni Aug 18, 2023
a31256a
Merge tag '0.22.0' into develop
intitni Aug 18, 2023
44f5614
Merge branch 'release/0.22.0'
intitni Aug 18, 2023
071fa16
Fix that browser tabs cancelling observations of other browser tabs
intitni Aug 18, 2023
c305d78
Bump version to 0.22.1
intitni Aug 18, 2023
0469045
Update appcast.xml
intitni Aug 18, 2023
4d19c55
Merge branch 'release/0.22.1'
intitni Aug 18, 2023
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
Update tests
  • Loading branch information
intitni committed Aug 16, 2023
commit 29afe7ef75b7c4a362d2f099aa6ee10203a97cc5
36 changes: 10 additions & 26 deletions Core/Tests/ServiceTests/Environment.swift
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
import AppKit
import Client
import SuggestionModel
import GitHubCopilotService
import Environment
import Foundation
import GitHubCopilotService
import SuggestionModel
import Workspace
import XCTest
import XPCShared

@testable import Service

@ServiceActor func clearEnvironment() {
workspaces = [:]

Environment.now = { Date() }

Environment.fetchCurrentProjectRootURLFromXcode = {
URL(fileURLWithPath: "/path/to/project")
}

Environment.fetchCurrentFileURL = {
URL(fileURLWithPath: "/path/to/project/file.swift")
}

Environment.triggerAction = { _ in }

Environment.guessProjectRootURLForFile = { $0 }
}

func completion(text: String, range: CursorRange, uuid: String = "") -> CodeSuggestion {
.init(text: text, position: range.start, uuid: uuid, range: range, displayText: text)
}
Expand All @@ -35,27 +18,27 @@ class MockSuggestionService: GitHubCopilotSuggestionServiceType {
func terminate() async {
fatalError()
}

func cancelRequest() async {
fatalError()
}

func notifyOpenTextDocument(fileURL: URL, content: String) async throws {
fatalError()
}

func notifyChangeTextDocument(fileURL: URL, content: String) async throws {
fatalError()
}

func notifyCloseTextDocument(fileURL: URL) async throws {
fatalError()
}

func notifySaveTextDocument(fileURL: URL) async throws {
fatalError()
}

var completions = [CodeSuggestion]()
var accepted: String?
var rejected: [String] = []
Expand Down Expand Up @@ -85,3 +68,4 @@ class MockSuggestionService: GitHubCopilotSuggestionServiceType {
rejected = completions.map(\.uuid)
}
}

38 changes: 21 additions & 17 deletions Core/Tests/ServiceTests/FilespaceSuggestionInvalidationTests.swift
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import Foundation
import XCTest
import SuggestionModel
import Workspace
import XCTest

@testable import Service

class FilespaceSuggestionInvalidationTests: XCTestCase {
@ServiceActor
@WorkspaceActor
func prepare(suggestionText: String, cursorPosition: CursorPosition) async throws -> Filespace {
let (_, filespace) = try await Workspace
.fetchOrCreateWorkspaceIfNeeded(fileURL: URL(fileURLWithPath: "file/path/to.swift"))
let pool = WorkspacePool()
let (_, filespace) = try await pool
.fetchOrCreateWorkspaceAndFilespace(fileURL: URL(fileURLWithPath: "file/path/to.swift"))
filespace.suggestions = [
.init(
text: suggestionText,
position: cursorPosition,
uuid: "",
range: .outOfScope,
displayText: ""
)
),
]
return filespace
}

func test_text_typing_suggestion_should_be_valid() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -34,7 +36,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNotNil(suggestion)
}

func test_text_typing_suggestion_in_the_middle_should_be_valid() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -48,7 +50,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNotNil(suggestion)
}

func test_text_cursor_moved_to_another_line_should_invalidate() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -62,7 +64,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNil(suggestion)
}

func test_text_cursor_is_invalid_should_invalidate() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -76,7 +78,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNil(suggestion)
}

func test_line_content_does_not_match_input_should_invalidate() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -90,7 +92,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNil(suggestion)
}

func test_line_content_does_not_match_input_should_invalidate_index_out_of_scope() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -104,7 +106,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNil(suggestion)
}

func test_finish_typing_the_whole_single_line_suggestion_should_invalidate() async throws {
let filespace = try await prepare(
suggestionText: "hello man",
Expand All @@ -118,8 +120,9 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNil(suggestion)
}

func test_finish_typing_the_whole_single_line_suggestion_suggestion_is_incomplete_should_invalidate() async throws {

func test_finish_typing_the_whole_single_line_suggestion_suggestion_is_incomplete_should_invalidate(
) async throws {
let filespace = try await prepare(
suggestionText: "hello man",
cursorPosition: .init(line: 1, character: 0)
Expand All @@ -132,7 +135,7 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNil(suggestion)
}

func test_finish_typing_the_whole_multiple_line_suggestion_should_be_valid() async throws {
let filespace = try await prepare(
suggestionText: "hello man\nhow are you?",
Expand All @@ -146,8 +149,9 @@ class FilespaceSuggestionInvalidationTests: XCTestCase {
let suggestion = await filespace.presentingSuggestion
XCTAssertNotNil(suggestion)
}

func test_undo_text_to_a_state_before_the_suggestion_was_generated_should_invalidate() async throws {

func test_undo_text_to_a_state_before_the_suggestion_was_generated_should_invalidate(
) async throws {
let filespace = try await prepare(
suggestionText: "hello man",
cursorPosition: .init(line: 1, character: 5) // generating man from hello
Expand Down