[P101-14] Customizing autocomplete with on_query_completions in Sublime

Опубликовано: 22 Февраль 2026
на канале: OdatNurd - Sublime Text Tutorials
2,923
50

Sublime has a built in autocomplete system that uses information in the files you're editing to offer suggestions for what you might want to type next. This is a great time saver, but what if you want to customize what appears in the list?

Sublime's on_query_completions event is the answer to this question. By implementing a handler for this event, you get notified every time the autocomplete panel is about to open, allowing you to add any additional completions you might like.

In this lesson, we do a detailed breakdown of the on_query_completions event, when it's triggered, and the variety of ways that you can signal your completion information back to Sublime for maximum effect.


0:00 Introduction
3:13 Newer Sublime Versions
3:59 The sample plugin
4:46 About on_query_completions
7:22 Selecting when we provide completions
13:03 Event return values
13:41 Structure of completion items
14:46 Simple string completions
15:41 Distinct trigger and text items
16:36 Adding in hint text
17:52 Using snippet fields in completions
19:21 Using flags to restrict completions
23:17 Lesson Recap


Plugin 101 playlist:    • Plugin 101 - How to write Packages for Sub...  

Simple Notes Plugin playlist:    • Simple Notes Plugin  

Scopes and scope selectors:   • [CQ01] Complete guide to scopes and scope ...  
Sublime Text Snippets:    • [QT05] Speed up your workflow with Sublime...  

Sublime Configuration: https://git.io/fARZ9
Official Documentation: https://www.sublimetext.com/docs/3/
Community Documentation: https://docs.sublimetext.io/
Sublime Forum: https://forum.sublimetext.com/
Sublime Discord:   / discord  


Watch live streams: https://odatnurd.net/live

#SublimeText #Plugin101 #Tutorial

Subscribe for more videos: https://www.youtube.com/user/nurdz?su...
Subscribe for more Sublime live streams:    / @terencemartinlive  
Follow me on Twitter:   / odatnurd