AP.
AP.

Reputation: 5323

Completion in NSTextView

I am looking for a way (or code) to have a completion list close to the one of xcode xcode completion

Do you know how to achieve this?

Thanks and regards,

Upvotes: 10

Views: 4300

Answers (1)

Aderstedt
Aderstedt

Reputation: 6518

Use the

- (NSArray *)textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index

method of NSTextViewDelegate. This is called whenever text completion is initiated (either by the user, by pressing Esc or F5, or programmatically, by calling -[NSTextView complete:].

You'll need to do some fancy overriding to make it look like the one in Xcode, however. The stock implementation displays only plain text in the system font.

Upvotes: 8

Related Questions