Sublime 3 JS Snippets to Typescript
Asked Answered
G

1

6

I have a lot of useful snippets on JS. Like cl for console.log(); or

fn for

function methodName (arguments) {
    // body...
}

However I can't use them on *.ts files.

How can manage the snippets and complation for js to ts also.

Thanks

Geneviegenevieve answered 18/6, 2015 at 11:24 Comment(0)
H
7

You have to add a typescript source to your snippets scope.

<scope>source.js, source.ts</scope>

There is a exemple of snippet that you can find in the TypeScript package:

<snippet>
    <content><![CDATA[
class ${2:ClassName}${3: extends ${4:AnotherClass}} {
    $5
    ${6:constructor}(${7:argument}) {
        ${0:// code...}
    }
}
]]></content>
    <tabTrigger>class</tabTrigger>
    <scope>source.ts</scope>
    <description>class …</description>
</snippet>
Homage answered 18/6, 2015 at 13:11 Comment(2)
thnx for reply, where can i find these files. *.sublime-package files are binary.Geneviegenevieve
@Geneviegenevieve Just FYI the *.sublime-package are actually zip files. You can use 7zip or any other tools to view and unzip themTemplar

© 2022 - 2024 — McMap. All rights reserved.