-1

I know it returns the window ID, but when I run the function that does what's on the question title, it keeps telling me that a 'List is required'. I don't know what's going on.

" Check the type of issue and add the appropriate message
if correction.rule.issueType == 'misspelling'
  let content = 'Did you mean: ' . join(map(correction.replacements, 'v:val.value'), ', ')
endif

" Set the popup's option
let options = {'border': 'none', 'line': 1, 'col': 1, 'minwidth': &columns, 'title': correction.message}

" Display the popup
let popup = popup_create('Hello world!', options)

I've tried changing the variable name to popup_message but that still resulted in the same thing. I've tried testing it first in the command line, and it worked with an empty dictionary for the options. That's why I'm led to believe that it may not be allowed to be assigned to a variable. I've also tried modifying the options to non-variables as value.

5
  • 1
    As usual, you are making huge diagnostic mistakes. You should probably focus on those instead of writing code you don't understand. You are supposed to assign to a variable if you ever hope to interact with that object programmatically. That is not at all where your problem comes from. It comes from not reading :help popup_create-arguments with the attention it deserves.
    – romainl
    Jul 27, 2023 at 5:24
  • Hm, the popup is still drawn, even so there was an error message. I don't think this is supposed to happen Jul 27, 2023 at 6:38
  • Oh. It's the border. Sorry, @romainl. Jul 27, 2023 at 8:28
  • Yes, border is supposed to be a list.
    – romainl
    Jul 27, 2023 at 8:31
  • I'll read carefully next time. Jul 27, 2023 at 8:32

1 Answer 1

1

As pointed out in comments: the error message is about the function arguments (you can always :help EXXX with the error code you get). Specifically, popup_create expects options.border to be a list.

There’s a small bug in that this doesn’t stop the popup from being created, which is confusing.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.