Files
luma/Luma/CompletionStrip.swift
Ole André Vadla Ravnås b88a9be290 Replace SwiftyMonaco with native editors
Drop the Monaco webview. Edit in a GtkSourceView on GTK and in a
native text view on Apple, both speaking to Frida.Compiler's
in-process language server for completions, signature help,
hovers and diagnostics.

Color, complete and indent code natively, matching the GitHub
theme in light and dark.
2026-09-08 19:52:31 +02:00

39 lines
1.1 KiB
Swift

import SwiftUI
#if canImport(UIKit)
@Observable
final class CompletionCandidates {
private(set) var words: [String] = []
@ObservationIgnored private var accept: (String) -> Void = { _ in }
func offer(_ words: [String], accept: @escaping (String) -> Void) {
self.words = words
self.accept = accept
}
func take(_ word: String) {
accept(word)
}
}
struct CompletionStrip: View {
let candidates: CompletionCandidates
var body: some View {
ScrollView(.horizontal) {
HStack(spacing: 6) {
ForEach(candidates.words, id: \.self) { word in
Button(word) { candidates.take(word) }
.font(.system(.footnote, design: .monospaced))
.buttonStyle(.bordered)
}
}
.padding(.horizontal, 8)
}
.scrollIndicators(.hidden)
.frame(maxHeight: .infinity)
.background(.bar)
}
}
#endif