The ability to support Windows, Mac and Linux would not have been possible without the work done by James Wilkins and Christian Bernasko. James Wilkins created the V8.NET library and when it was first released it supported only Windows. Christian Bernasko then took V8.NET and modified it to make it work with Mono on Linux and the Mac. The TypeScript addin is using V8.NET binaries built by Christian from his port of V8.NET.
Please note that this is an alpha release and because V8.NET uses a native library it can cause Xamarin Studio or MonoDevelop to terminate if a bug is encountered.
- TypeScript compilation on save or build.
- Code completion.
- Find references.
- Rename refactoring.
- Go to declaration.
- Errors highlighted as you type.
- Code folding.
The addin supports:
- Xamarin Studio MonoDevelop 5 and above.
- TypeScript 1.4
- Linux, Mac and Windows.
Installing the addin
The addin is currently available from MonoDevelop’s Add-in Repository in the alpha channel. By default the alpha repository is not enabled so you will have to enable it before you can find and install the addin.
In Xamarin Studio open the Add-in Manager and select the Gallery tab. Click the repository drop down and if Xamarin Studio Add-in Repository (Alpha Channel) is not displayed then click Manage Repositories…. In the window that opens tick the check box next to Xamarin Studio Add-in Repository (Alpha Channel) and then click the Close button.
Back in the Add-in Manager dialog click the Refresh button to update the list of addins. Use the search text box in the top right hand corner of the dialog to search for the addin by typing in TypeScript.
Select the TypeScript addin and then click the Install… button.
Note that if you are using Linux 32 bit then you should install the TypeScript Linux 32 bit addin. The other TypeScript addin listed supports Linux 64 bit. Hopefully in the future it will be possible to support both Linux 32 bit and 64 bit using the same addin.
Now that the TypeScript addin is installed let us create a TypeScript file.
To add a TypeScript file open the New File dialog, select the Web category and select Empty TypeScript file.
Give the file a name and click the New button.
Note that currently the TypeScript file needs to be included in a project. Standalone TypeScript project files are not supported. TypeScript files can be added to any .NET project.
When editing the TypeScript code you will have code completion when you press the dot character.
Code completion also works when you type the opening bracket of a function.
Go to Declaration
The text editor’s right click menu has three TypeScript menus: Go to Declaration, Find References and Rename.
The Go To Declaration menu option will open the corresponding definition in the text editor.
Find References will show the references in the Search Results window.
Selecting the Rename menu option in the text editor will open the Rename dialog where you can type in a new name and click OK to have it updated.
Note that currently on Linux the Rename dialog will only be displayed if the keyboard shortcut F2 is used. Selecting the context menu will not show the Rename dialog on Linux but will work on Windows and on the Mac.
Errors in your TypeScript code will be highlighted as you are typing in the text editor.
Code folding is supported for TypeScript classes, modules and interfaces.
Code folding by default is disabled. To enable code folding open the Preferences dialog and in the Text Editor section select the General category, then tick the Enable code folding check box.
There are more compiler options available in the project options in the Build – TypeScript category.
That is the end of our quick look at TypeScript support in Xamarin Studio and MonoDevelop.
The source code for the addin and for the V8.NET engine that works on Mono are available on GitHub.