This only addresses half of your answer, but I believe you need to subclass NSTextView
and implement the - (NSRange)rangeForUserCompletion
method, returning the range of the entire string in the text field. This should make sure that it doesn't just autocomplete the most recently entered word.
If you want a custom menu, you're going to have to do that yourself, probably by implementing the -controlTextDidChange:
method and displaying a custom view with a table when appropriate.