Sublime Forum

JavaScript snippets in TypeScript files?


I cannot figure out why I do not have any completion of JavaScript snippets in TypeScript files? Nor can I find out how to enable it?

I would expect the same snippets to available both places.

Can someone help me out? I am a little frustrated, so I will be forever grateful.

Screenshots: JavaScript .js file

Screenshot: TypeScript .ts file



The snippets that ship with Sublime for JavaScript are scoped to only work with JavaScript:

	<content><![CDATA[for (var ${20:i} = ${1:Things}.length - 1; ${20:i} >= 0; ${20:i}--) {
	<description>for (…) {…} (Improved Native For-Loop)</description>

The scope for JavaScript is source.js but TypeScript uses source.ts instead; so they only appear in one file and not the other.

The snippets can be found at: ; so one thing you can do is download them, add them to your User package and modify them to use the appropriate scope so that they will apply to both file types.

1 Like


Oh, yes. I will copy those files and modify the scope.