LoginSignup
10
11

More than 5 years have passed since last update.

もっと!Promiseと仲良くなるためにスニペットを用意する

Last updated at Posted at 2015-09-10

よく叩くわりに長いフレーズはスニペットに入れておくと捗ります。
promise.gif

エディタ別のスニペットを用意しました。
今日から貴方も more Promise ライフ!

Sublime Text

Toolsメニュー→New Snippets...
promise.sublime-snippet の名前で保存します。

SublimeText
<snippet>
    <content><![CDATA[
new Promise(function (resolve, reject) {
    $1
});
]]></content>
    <tabTrigger>promise</tabTrigger>
    <scope>source.js</scope>
</snippet>

Visual Studio Code

(2015/11/23 追記)
Visual Studio Marketplaceで公開しましたので、簡単に導入できます。 Promise snippets - Visual Studio Marketplace

Ctrl(Cmd)+Shift+P → [install] → [promise]

自分で作る場合は↓
Ctrl(Cmd)+Shift+P → [Snippets] → [JavaScript]

VisualStudioCode
{
    "Promise": {
        "prefix": "promise",
        "body": [
            "new Promise(function (resolve, reject) {\n\t$1\n});"
        ]
    }
}

Atom

Ctrl(Cmd)+Shift+P → [Open Your Snippets]

Atom
'.source.js':
  'Promise':
    'prefix': 'promise'
    'body': 'new Promise(function (resolve, reject) {\n\t$1\n});'
10
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
11