Kapiainen / SublimePapyrus

A Sublime Text 2 and 3 package for the Papyrus scripting language.
MIT License
47 stars 8 forks source link

Double Event on Text Completion #2

Closed xanderdunn closed 10 years ago

xanderdunn commented 10 years ago

Steps to reproduce: Inside a Papyrus script, type Event OnI. You should see completion options, including Event OnInit. Press Enter to select that completion option. You'll see that it inserts the completion text and you end up with: event

The initial Event keyword wasn't replaced so you end up with Event Event, which won't compile.

Kapiainen commented 10 years ago

Type in the name of the function or event only as that will be replaced by the template for the function call or event. Alternatively use the command palette to trigger the snippets by typing in the name of the function or event.

This is due to how snippets work. The program in the package generates a snippet for each function or event that it finds in the .psc files it processes. Each snippet contains a keyword (the name of the function or event), which is used to trigger the snippet, and what to replace the keyword with in the text, which in the case of events is an entire event structure/template. For example the OnInit snippet has "OnInit" as its keyword so the first "Event" that you typed is completely ignored and "OnInit" is replaced by the contents, which contain the entire event structure, of the snippet.

xanderdunn commented 10 years ago

I see. So, instead of typing Event OnI, I should just type OnI and it will complete correctly from there. That works great. I'll just retrain myself.