Sublime Forum

Typescript with sublime text

#1

Hi

I have sublime text 2 build 2221 on a mac 10.11.5 and want to use Typescript syntax.

I managed to download and install the recommended Typescript package on sublime text and two things are not working.

  1. Auto syntax highlighting does not seem to work for me.

example:

  1. Cmd + B asks for parameters.

Any help would be much appreciated.

0 Likes

#2

I’m not sure what you mean by this; your image seems to show syntax highlighting just fine as far as I can tell. The only thing that doesn’t seem to be syntax highlighted is the call to greet() at the end, but this might be due to the color scheme you’re using?

In my install of ST2 using whatever the default color scheme is, your code looks like this:

This is the TypeScript plugin asking you to pass build parameters to the compiler when it compiles your code.

There are two possible reasons why this is happening:

  1. You’re not using a tsconfig.json file to set up your project, so every time you run the build command the plugin is basically just running tsc for you to compile you code. In this case it asks you for the arguments to pass to the compiler every time you build, but it remembers what you typed last time. You can just hit enter to accept the default (either blank or whatever you last used) to run the build again.

  2. You do have a tsconfig.json file, but the TypeScript file that you’re currently editing isn’t referenced anywhere in it. The TypeScript plugin will detect the tsconfig.json files in your project and use that to run the build. If you’re editing a file that you haven’t told it about yet, it assumes the file isn’t part of the project and treats it as a one off file (like situation #1 above) because in that case it can’t build with the tsconfig.json file.

1 Like

#3

i want to execute the typescript programs in sublime text.what are the processes to run the typescript programs in sublime text. If you know please give me the steps…

0 Likes