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
TypeScript Plugin for Sublime Text. The plugin uses an IO wrapper around the TypeScript language services to provide an enhanced Sublime Text experience when working with TypeScript code.
Open the typescript file -that you need to run- on sublime text 3. Click on Tools tab, then Build System , then New Build System . A new file will open.. override its content with the following JSON object. The cmd parameter uses ts-node based on the suggestion of @idleberg.
How to edit built-in snippets in Sublime Text [Quick Guide][Super Easy Method] Tools — >Command Palette — >Package Control: Install Package. Step 2: Search for the PackageResourceViewer in the Package Control and install it.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With