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

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

2 Comments

thnx for reply, where can i find these files. *.sublime-package files are binary.
@engincancan Just FYI the *.sublime-package are actually zip files. You can use 7zip or any other tools to view and unzip them

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.