You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the bigger Sublime plugins seem to do some pretty complex stuff with the APIs sublime exposes (and they're not all listed in the official documentation). Creating intuitive interfaces in Sublime seems to be a matter of creatively (ab)using the APIs.
One idea I can think of is attempting to provide a different way of triggering NodeRequirer. The current method of doing it is with Ctrl+Shift+I. And personally, I hate keyboard combos. It's another thing to memorize and it forces me to temporarily break my hands' typing position in order to hit the keys.
Here's one creative idea for a method of triggering NodeRequirer by abusing two sublime APIs in combination:
We add one (or more) NodeRequirer.sublime-snippet snippets. These will be something like require(${1:[module]}).
Using on_modify/on_modify_async or maybe intercepting the commit_completion command we watch for a selection that matches [module].
If that selection matches we look at the surrounding text to see if we're in the correct snippet result.
If so we trigger the NodeRequirer panel.
From the user perspective it should look like:
They started typing require.
A showed up in their completions.
They hit tab/enter, whatever is configured for completions.
NodeRequirer popped up asking what module to require.
The text was updated successfully, but these errors were encountered:
<snippet>
<content><![CDATA[require(${1:[module]})]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>require</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger --><!-- <scope>source.javascript</scope> -->
</snippet>
Some of the bigger Sublime plugins seem to do some pretty complex stuff with the APIs sublime exposes (and they're not all listed in the official documentation). Creating intuitive interfaces in Sublime seems to be a matter of creatively (ab)using the APIs.
One idea I can think of is attempting to provide a different way of triggering NodeRequirer. The current method of doing it is with
Ctrl
+Shift
+I
. And personally, I hate keyboard combos. It's another thing to memorize and it forces me to temporarily break my hands' typing position in order to hit the keys.Here's one creative idea for a method of triggering NodeRequirer by abusing two sublime APIs in combination:
NodeRequirer.sublime-snippet
snippets. These will be something likerequire(${1:[module]})
.[module]
.From the user perspective it should look like:
require
.The text was updated successfully, but these errors were encountered: