How to make a conditional text wrap using snippets?

Hello, I wrote many Snippets to “wrap” code, this is an example to wrap between php tags:

<?php [[%w]] ?>

works pretty good, but sometimes I would like to use this snippet without any text (php tags only) to start writting later, like this:

<?php ?>

Then komodo give me an error because [[%w]] is mandatory, and the tag is not inserted.

Why [[%w]] (or other similar selected text tags) are mandatory? I think they should be optional.

How can I make this snippet text optional?

You’re absolutely right, I’ve opened an enhancement request for this here:

As a workaround, you could use EJS to embed the selection:

Selection: <%= require("ko/editor").getSelection() %>
2 Likes

Excelent, thank you for open the request,

The EJS code works and solved my problem, thank you again! :smiley: