Skip to content

Commit c2ac9ae

Browse files
Lint errors, project item location fixes
1 parent 45a3d79 commit c2ac9ae

19 files changed

+373
-179
lines changed

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 143 additions & 85 deletions
Large diffs are not rendered by default.

CodeEdit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 79 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodeEdit/Features/About/Views/AboutView.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,13 @@ public struct AboutView: View {
4444
// if anyone knows of a better way to do this feel free to refactor
4545
.background(.regularMaterial.opacity(0))
4646
.background(EffectView(.popover, blendingMode: .behindWindow).ignoresSafeArea())
47-
// .background {
48-
// Button("") {
49-
// dismiss()
50-
// }
51-
// .keyboardShortcut(.escape, modifiers: [])
52-
// .hidden()
53-
// }
54-
.onExitCommand(perform: {
55-
dismiss()
56-
})
47+
.background {
48+
Button("") {
49+
dismiss()
50+
}
51+
.keyboardShortcut(.escape, modifiers: [])
52+
.hidden()
53+
}
5754
.task {
5855
if let window = NSApp.findWindow(.about) {
5956
window.styleMask = [.closable, .fullSizeContentView, .titled, .nonactivatingPanel]

CodeEdit/Features/Editor/Models/Editor.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,16 @@ final class Editor: ObservableObject, Identifiable {
144144
/// - file: the file to open.
145145
/// - asTemporary: indicates whether the tab should be opened as a temporary tab or a permanent tab.
146146
func openTab(file: CEWorkspaceFile, asTemporary: Bool) {
147-
print("Attempting to open file: \(file.url)")
148147
let item = EditorInstance(file: file)
149148
// Item is already opened in a tab.
150149
guard !tabs.contains(item) || !asTemporary else {
151150
selectedTab = item
152151
history.prepend(item)
153-
print("File already opened!")
154152
return
155153
}
156154

157155
switch (temporaryTab, asTemporary) {
158156
case (.some(let tab), true):
159-
print("Temporary tab 1")
160157
if let index = tabs.firstIndex(of: tab) {
161158
history.removeFirst(historyOffset)
162159
history.prepend(item)
@@ -168,16 +165,13 @@ final class Editor: ObservableObject, Identifiable {
168165
}
169166

170167
case (.some(let tab), false) where tab == item:
171-
print("2")
172168
temporaryTab = nil
173169

174170
case (.none, true):
175-
print("3")
176171
openTab(file: item.file)
177172
temporaryTab = item
178173

179174
case (.none, false):
180-
print("4")
181175
openTab(file: item.file)
182176

183177
default:
@@ -192,7 +186,6 @@ final class Editor: ObservableObject, Identifiable {
192186
/// - fromHistory: Indicates whether the tab has been opened from going back in history.
193187
func openTab(file: CEWorkspaceFile, at index: Int? = nil, fromHistory: Bool = false) {
194188
let item = Tab(file: file)
195-
print("Tabs before update: \(tabs)")
196189
if let index {
197190
tabs.insert(item, at: index)
198191
} else {
@@ -203,9 +196,6 @@ final class Editor: ObservableObject, Identifiable {
203196
}
204197
}
205198

206-
print("Updated tabs: \(tabs)")
207-
print("New item: \(item.file.url)")
208-
209199
selectedTab = item
210200
if !fromHistory {
211201
history.removeFirst(historyOffset)
@@ -215,14 +205,12 @@ final class Editor: ObservableObject, Identifiable {
215205
do {
216206
try openFile(item: item)
217207
} catch {
218-
print("openFile error")
219208
print(error)
220209
}
221210
}
222211

223212
private func openFile(item: Tab) throws {
224213
guard item.file.fileDocument == nil else {
225-
print("File document is nil, returning!")
226214
return
227215
}
228216

@@ -235,7 +223,6 @@ final class Editor: ObservableObject, Identifiable {
235223
)
236224
item.file.fileDocument = codeFile
237225
CodeEditDocumentController.shared.addDocument(codeFile)
238-
print("Successfully opened file")
239226
}
240227

241228
func goBackInHistory() {

CodeEdit/Features/LSP/LanguageClient+ColorPresentation.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import Foundation
99
import LanguageServerProtocol
1010

1111
extension LanguageServer {
12-
func requestColorPresentation(document documentURI: String, _ color: Color, _ range: LSPRange) async -> ColorPresentationResponse {
12+
func requestColorPresentation(
13+
document documentURI: String,
14+
_ color: Color,
15+
_ range: LSPRange
16+
) async -> ColorPresentationResponse {
1317
let params = ColorPresentationParams(
1418
workDoneToken: nil,
1519
partialResultToken: nil,

CodeEdit/Features/LSP/LanguageClient+Completion.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ extension LanguageServer {
1414
if let cachedResponse: CompletionResponse = lspCache.get(key: cacheKey) {
1515
return cachedResponse
1616
}
17-
let completionParams = CompletionParams(uri: documentURI, position: position, triggerKind: .invoked, triggerCharacter: nil)
17+
let completionParams = CompletionParams(
18+
uri: documentURI,
19+
position: position,
20+
triggerKind: .invoked,
21+
triggerCharacter: nil
22+
)
1823
let response = try await lspInstance.completion(completionParams)
19-
24+
2025
lspCache.set(key: cacheKey, value: response)
2126
return response
2227
}

CodeEdit/Features/LSP/LanguageClient+Declaration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension LanguageServer {
1919
} catch {
2020
print("requestGoToDeclaration Error \(error)")
2121
}
22-
22+
2323
return nil
2424
}
2525
}

CodeEdit/Features/LSP/LanguageClient+DocumentColor.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import Foundation
99
import LanguageServerProtocol
1010

1111
extension LanguageServer {
12-
/// The document color request is sent from the client to the server to list all color references found in a given text document. Along with the range, a color value in RGB is returned.
12+
/// The document color request is sent from the client to the server to list all color
13+
/// references found in a given text document. Along with the range, a color value in RGB is returned.
1314
/// Clients can use the result to decorate color references in an editor. For example:
1415
/// 1. Color boxes showing the actual color next to the reference
1516
/// 2. Show a color picker when a color reference is edited

CodeEdit/Features/LSP/LanguageClient+DocumentHighlight.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ import Foundation
99
import LanguageServerProtocol
1010

1111
extension LanguageServer {
12-
/// The document highlight request is sent from the client to the server to resolve document highlights for a given text document position.
13-
/// For programming languages this usually highlights all references to the symbol scoped to this file.
14-
func requestDocumentHighlight(document documentURI: String, _ position: Position) async -> DocumentHighlightResponse {
12+
/// The document highlight request is sent from the client to the server to resolve document
13+
/// highlights for a given text document position. For programming languages this usually
14+
/// highlights all references to the symbol scoped to this file.
15+
func requestDocumentHighlight(
16+
document documentURI: String,
17+
_ position: Position
18+
) async -> DocumentHighlightResponse {
1519
do {
1620
let params = DocumentHighlightParams(
1721
textDocument: TextDocumentIdentifier(uri: documentURI),

CodeEdit/Features/LSP/LanguageClient+DocumentLink.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension LanguageServer {
1818
}
1919
return []
2020
}
21-
21+
2222
func requestDocumentLinkResolve(_ documentLink: DocumentLink) async -> DocumentLink? {
2323
do {
2424
return try await lspInstance.documentLinkResolve(documentLink)

0 commit comments

Comments
 (0)