Completions files

This is more a general question about completions files I guess. I would like to know if someone knows of a good resource on how to go about building a completions file. I’ve been kicking around building a laravel completions file and would like to look at some good examples of best practices moving forward.
Thanks!

Hi Chris,

Just some general information about completions that I learned along the way while working on the Tailwind CSS completions extension that may be helpful to you and/or others.

There are two methods of providing completions in Nova. The JavaScript API method (https://docs.nova.app/api-reference/), which does not allow for the inclusion of regular expressions in evaluating for completions, and the XML method (https://docs.nova.app/syntax-reference/completions/), which does.

When evaluating which of these two options to use, it is helpful to consider what you want to achieve and choose the option that most closely matches your use case. In your post you mentioned a completions file, so it sounds like you are looking at the XML method. I would think this would be the most appropriate method for your Laravel extension. At the moment, these two methods do not offer feature parity. For example, I needed to use the color property for a completion item and this was not available using XML.

To directly answer your question, I would suggest going to the “Completions” category of the extension library and clicking on the repositories of existing extensions. Between the documentation and just poking around, many of your questions will likely be answered. If these sources do not answer your question, then I would post on this forum. Panic has been great responding to questions. Also, I, and I am sure others, will be happy to chirp in if we think we can help. I think most, if not all, of us are learning as we go.

Hope this helps!

Jason

1 Like