Template IntelliSense

2020-07-06 02:15发布

问题:

I use C# mostly and one thing that I am missing in VSCode is IntelliSense in Angular 2 templates.

I found that there is a solution to this problem here, but I couldn't find a way to integrate it into Visual Studio Code.

I need this:

Is there any way to get IntelliSense in Visual Studio Code for Angular 2 templates?

回答1:

That page you linked details the installation steps:

Usage in VSCode:

  1. Replace the typescript.tmLanguage file under the install location at Contents/Resources/app/extensions/typescript/syntaxes with the version from the TypeScript-TmLanguage repo above (from the ngml branch).

  2. Fork the TypeScript repo above, checkout the ngml branch, and build.

  3. Open the VSCode global settings, and set the typescript.tsdk property to the build location in the prior step (e.g. /src/typescript/built/local).

  4. To get completions within the template on characters such as <, [, etc. open typescriptMain.ts from the Contents/Resources/app/extensions/typescript folder under the VSCode install location, and change the line that calls registerCompletionItemProvider to read vscode_1.languages.registerCompletionItemProvider(modeID, completionItemProvider, '.', '<', '(', '[', '\'');

  5. To make changes edit the local TypeScript repo, rebuild, and relaunch VSCode.

Right now, it doesn't look like there's an extension for it, yet - likely due to gaps in the extension API which are currently in development.



回答2:

Anyone who is looking for this functionality, there is an extension Angular Language Service VS Code extension.