Search code examples
pythonsublimetextsublimetext3

SublimeText3 | API Injected completions


SublimeText: This doc https://docs.sublimetext.io/guide/extensibility/completions.html talks about API-injected completions.

My requirement is as follows

ParentFolder
 Folder1
   file1.json
   file2.json
   file3.json
MainFile.json

Ctrl+Tab in MainFile.json should prompt me file1, file2, file3 as auto-complete options.

How do I do this working with API-injected completions? I couldnt see any examples anywhere.


Solution

  • API-injected completions are completions that are added to the list on the fly by packages. For this you must hook to the on_query_completions event.

    Here is a simple package that will help you to get started: https://github.com/Zinggi/DictionaryAutoComplete