2

I am working on Visual Studio 2015 professional. I have installed TypeScript using npm. TypeScript 2.0.3 installed. Then i tried to add a TypeScript file using Right Click on a tsScript Folder of my Project -> Add New Item but i did not find any TS file template. Then I make a workaround by adding a text file and changed its extension from .txt to .ts and pasted some TypeScript code in this file. When i am running the application, application is able to generate jsfile from this ts file. But the problem is : the text color in the ts file is all black. There is no coloring, no intellisense, no modularation . It is just plain text.

What can i do to make this ts file recognized to visual studio. Below is the screenshot.

enter image description here

tsconfig.json File :

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../Scripts/",
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "moduleResolution": "node"
  },
  "exclude": [
    "node_modules",
    "typings/index",
    "typings/index.d.ts"
  ]
}

EDIT: The issue resolved by updating my Visual Studio 2015 to Visual Studio 2015 Update 3.

4

3 回答 3

1

如果您已经安装了 TypeScript 2.03 插件,但仍然没有看到您想要的,您可能需要来自https://www.visualstudio.com/vs/node的 Visual Studio 版本 1.02(或更高版本)的 NodeJS 工具-js/

我使用的 TypeScript 启动器位于Project/Add New Item对话框 Installed/NodeJS 下。您可能需要在 NodeJS 项目中才能使这些工作。

于 2016-10-19T00:50:43.897 回答
0

尝试 Visual Studio 代码 https://code.visualstudio.com

安装 Visual Studio Code 0.10.1 或更高版本

启动代码

从命令面板 Ctrl-Shift-P (Windows, Linux) 或 Cmd-Shift-P (OSX)

选择安装扩展

选择扩展名

重新加载 Visual Studio 代码

有关模式详细信息,请查看此 github 页面

https://github.com/johnpapa/vscode-angular2-snippets

于 2016-10-18T12:23:21.457 回答
0

如果尚未安装TypeScript for Visual Studio 2015 插件,请尝试安装。

如果这没有帮助,msdn 论坛上有一个线程指示使用 devenv.exe /InstallVSTemplates命令重新安装模板。

希望这会有所帮助。

于 2016-10-18T12:31:26.390 回答