@@ -85,6 +85,10 @@ public class TextViewController: NSViewController {
8585 /// The provided highlight provider.
8686 public var highlightProviders : [ HighlightProviding ]
8787
88+ /// A delegate object that can respond to requests for completion items, filtering completion items, and triggering
89+ /// the suggestion window. See ``CodeSuggestionDelegate``.
90+ /// - Note: The ``TextViewController`` keeps only a `weak` reference to this object. To function properly, ensure a
91+ /// strong reference to the delegate is kept *outside* of this variable.
8892 public weak var completionDelegate : CodeSuggestionDelegate ?
8993
9094 /// A delegate object that responds to requests for jump to definition actions. see ``JumpToDefinitionDelegate``.
@@ -225,6 +229,7 @@ public class TextViewController: NSViewController {
225229 foldProvider: LineFoldProvider ? = nil ,
226230 undoManager: CEUndoManager ? = nil ,
227231 coordinators: [ TextViewCoordinator ] = [ ] ,
232+ completionDelegate: CodeSuggestionDelegate ? = nil ,
228233 jumpToDefinitionDelegate: JumpToDefinitionDelegate ? = nil
229234 ) {
230235 self . language = language
@@ -234,6 +239,7 @@ public class TextViewController: NSViewController {
234239 self . foldProvider = foldProvider ?? LineIndentationFoldProvider ( )
235240 self . _undoManager = undoManager
236241 self . invisibleCharactersCoordinator = InvisibleCharactersCoordinator ( configuration: configuration)
242+ self . completionDelegate = completionDelegate
237243 self . jumpToDefinitionModel = JumpToDefinitionModel (
238244 controller: nil ,
239245 treeSitterClient: treeSitterClient,
0 commit comments