Giter VIP home page Giter VIP logo

vscode-ng-language-service's Introduction

Angular Language Service

demo

Features

This extension provides a rich editing experience for Angular templates, both inline and external templates including:

  • Completions lists
  • AOT Diagnostic messages
  • Quick info
  • Go to definition

Download

Download the extension from Visual Studio Marketplace.

Configuring compiler options for the Angular Language Service

The Angular Language Service uses the same set of options that are used to compile the application. To get the most complete information in the editor, set the strictTemplates option in tsconfig.json, as shown in the following example:

"angularCompilerOptions": {
  "strictTemplates": true
}

For more information, see the Angular compiler options guide.

Versioning

The language service extension relies on the @angular/language-service and typescript packages for its backend. @angular/language-service is always bundled with the extension, and is always the latest version at the time of the release. typescript is loaded, in order of priority, from:

  1. The path specified by typescript.tsdk in project or global settings.
  2. (Recommended) The version of typescript bundled with the Angular Language Service extension.
  3. The version of typescript present in the current workspace's node_modules.

We suggest not specifying typescript.tsdk in your VSCode settings per method (1) above. If the typescript package is loaded by methods (1) or (3), there is a potential for a mismatch between the API expected by @angular/language-service and the API provided by typescript. This could lead to a failure of the language service extension.

For more information, please see #594.

Installing a particular release build

Download the .vsix file for the release that you want to install from the releases tab.

Do not open the .vsix file directly. Instead, in Visual Studio code, go to the extensions tab. Click on the "..." menu in the upper right corner of the extensions tab, select "Install from vsix..." and then select the .vsix file for the release you just downloaded.

The extension can also be installed with the following command:

code --install-extension /path/to/ngls.vsix

Angular Language Service for Other Editors

vscode-ng-language-service's People

Contributors

alxhub avatar andrewkushnir avatar andrius-pra avatar angular-robot avatar angular-robot[bot] avatar asherbarak avatar atscott avatar ayazhafiz avatar chuckjaz avatar crisbeto avatar danieltre23 avatar dannymcgee avatar dbosley avatar deisterhold avatar dependabot[bot] avatar devversion avatar dylhunn avatar ghaschel avatar gregmagolan avatar iamcco avatar ivanwonder avatar josephperrott avatar kyliau avatar mafredri avatar mickaelistria avatar oocx avatar renovate-bot avatar renovate[bot] avatar siegfriedehret avatar zarend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-ng-language-service's Issues

bug: transitive NgModule exports not being found

Versions:

  • Angular Language Service: 0.0.10
  • angular-cli: 1.0.0-beta.24
  • node: 6.9.1
  • os: darwin x64
  • @angular/*: 2.4.1

It seems that exports from modules that are imported into the main AppModule are not being picked up correctly.

See the following gist: https://gist.github.com/petebacondarwin/9fb71ae5efd2ad1567938db1350f5a9f

In this example the BangPipe is being declared and exported from the SharedModule, which is then being imported into AppModule, which contains the AppComponent. The AppComponent is using the BangPipe in its template.

Putting this inside a vanilla Angular CLI generated project will build (with --prod and --aot flags) successfully but VS Code is reporting that this pipe is not found.

Declaring the BangPipe in the AppComponent resolves the error.

It seems that the Language Service is not walking the module imports to identify what pipes are available. It is possible that this also affects components too.

depends on packages stored on the authors local hard drive ?

I would like to try this extension but it appears its only set up to work on chuckj's computer?

"@angular/language-service": "file:///Users/chuckj/src/angular/dist/packages-dist/language-service"
"@angular/compiler": "file:///Users/chuckj/src/angular/dist/packages-dist/compiler",
"@angular/compiler-cli": "file:///Users/chuckj/src/angular/dist/packages-dist/compiler-cli",
"@angular/core": "file:///Users/chuckj/src/angular/dist/packages-dist/core",
"@angular/tsc-wrapped": "file:///Users/chuckj/src/angular/dist/tools/@angular/tsc-wrapped",

SERVER ERROR: Cannot read property 'map' of undefined

Hi. As soon as VSCode updated to Angular Language Service v0.1.3, I got the following error in the output termianl:

Search path: c:/Users/Kwakes/Documents/Dev/HolitionCMS/cms-frontend/src/app/views/client/client-list
Config file name: c:/Users/Kwakes/Documents/Dev/HolitionCMS/cms-frontend/tsconfig.json
Angular Language Service: 4.1.0-beta.0-96aa236
TypeScript: 2.1.6
SERVER ERROR: Cannot read property 'map' of undefined
TypeError: Cannot read property 'map' of undefined
    at Evaluator.evaluateNode (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:42680:54)
    at _loop_1 (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:43435:57)
    at C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:43495:25
    at visitEachNode (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\typescript\lib\typescript.js:13888:30)
    at Object.forEachChild (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\typescript\lib\typescript.js:14059:24)
    at MetadataCollector.getMetadata (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:43310:14)
    at ReflectorHost.CompilerHost.getMetadataFor (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:43908:51)
    at StaticSymbolResolver.getModuleMetadata (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:40131:62)
    at StaticSymbolResolver._createSymbolsOf (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:39935:46)
    at StaticSymbolResolver.getSymbolsOf (C:\Users\Kwakes\.vscode\extensions\Angular.ng-template-0.1.3\server\node_modules\@angular\language-service\bundles\language-service.umd.js:39916:14)
[Error - 17:00:23] Notification handler 'textDocument/didSave' failed with message: Cannot read property 'map' of undefined

this has only happened on my work PC and not my macbook pro

Parse error on pluralization rule

I'm getting the following error when using a pluralization rule:

[Angular]
Parse Error: Missing expected : at the end of the expression [
    {fieldCount, plural, =0 {no fields} =1 {1 field} other {{{fieldCount}} fields}}
] in @ 4:45

My code is as follows

field-list.component.ts

...
    fieldCount: number = 3;
...

field-list.component.html

<div>
    {fieldCount, plural, =0 {no fields} =1 {1 field} other {{{fieldCount}} fields}}
</div>

Note: Angular parses the expression perfectly fine and displays as expected in the browser.

plugin can't handle objects that can be null

When i have this type on my component:

    test: {a: number, b: number} | null = {
        a: 1,
        b: 2
    }

and this in the template:

{{test?.a}}

the plugin complains and tells me:

'Identifier 'a' is not defined. '<anonymous>' does not contain such a member'

I use the ?. accessor method all the time (of course one could do *ngIf="test" on the outer element but it turns out this does not solve the problem. test is still treated as <anonymous> in that case (along with the error message), meaning that the the ?. operator is not the problem here). Seemingly the plugin can't handle access to members of objects that are possibly null. If i remove null from the type definition everything works smoothly (except the rest of code breaking ;-).

plugin does not respect baseUrl in tsconfig.json

I am using the baseUrl option in tsconfig.json. However the plugin reports an error with the following message:

Error encountered resolving symbol values statically. Could not resolve services/system.service relative to /Users/mc/code/courseapp/src/pages/course/course.page.ts.

Additionally the error is marked 5 lines down from where the actual import takes place.

Completion of method should add parenthesis

When using completion of the (click) event for example to complete a method. No parenthesis are added by default to the method.

For example:

image
image

After pressing TAB:

image

It would be nice if we could have parenthesis added by default and the cursor inside of these parenthesis like:

image

Service crashing with 'TypeError: Cannot read property 'charCodeAt' of undefined'

Launch VSCode with cursor in an HTML file, and get a crash. Ending with "The Angular Language Service server crashed 5 times in the last 3 minutes.The server will not be restarted."

Search path: /home/john/code/mindstorm/src/app/competition-list
Config file name: /home/john/code/mindstorm/tsconfig.json
Angular Language Service: 4.1.0-beta.0-309bae0
TypeScript: 2.1.5
getTemplateRefrences: 2716ms
Add recursive watcher for: /home/john/code/mindstorm
Opened configuration file /home/john/code/mindstorm/tsconfig.json
getTemplateRefrences: 0ms
/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:2401
        if (path.charCodeAt(0) === 47 /* slash */) {
                ^

TypeError: Cannot read property 'charCodeAt' of undefined
    at getRootLength (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:2401:17)
    at isRootedDiskPath (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:2528:16)
    at Object.toPath (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:1273:36)
    at Object.getSourceFile (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:62995:43)
    at findClassSymbolInContext (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:48529:38)
    at TypeScriptSymbolQuery.getTypeSymbol (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:48023:26)
    at _loop_1 (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:45694:44)
    at processReferences (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:45705:13)
    at class_1.visitEmbeddedTemplate (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:45715:13)
    at EmbeddedTemplateAst.visit (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16483:24)
[Info  - 10:46:42 AM] Connection to server got closed. Server will restart.
Search path: /home/john/code/mindstorm/src/app/competition-list
Config file name: /home/john/code/mindstorm/tsconfig.json
Angular Language Service: 4.1.0-beta.0-309bae0
TypeScript: 2.1.5
getTemplateRefrences: 2484ms
Add recursive watcher for: /home/john/code/mindstorm
Opened configuration file /home/john/code/mindstorm/tsconfig.json
getTemplateRefrences: 0ms
/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:2401
        if (path.charCodeAt(0) === 47 /* slash */) {
                ^

TypeError: Cannot read property 'charCodeAt' of undefined
    at getRootLength (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:2401:17)
    at isRootedDiskPath (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:2528:16)
    at Object.toPath (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:1273:36)
    at Object.getSourceFile (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/typescript/lib/typescript.js:62995:43)
    at findClassSymbolInContext (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:48529:38)
    at TypeScriptSymbolQuery.getTypeSymbol (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:48023:26)
    at _loop_1 (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:45694:44)
    at processReferences (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:45705:13)
    at class_1.visitEmbeddedTemplate (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:45715:13)
    at EmbeddedTemplateAst.visit (/home/john/.vscode-insiders/extensions/Angular.ng-template-0.1.1/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16483:24)
[Info  - 10:46:50 AM] Connection to server got closed. Server will restart.

Versions:

ng version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / โ–ณ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0
node: 7.8.0
os: linux x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/compiler-cli: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0

how is this extension Working?

Hi,

I've managed to install the extension into my current vscode and I've opend a ng2 app, but I don't know if I have to do something else, that the intelliSense is working in my templates, because currently its not working. A Installation Instruction would be really nice an a litte how to use it.

thx
squadwuschel

Server crashes with `Cannot read property '__constructor' of undefined`

Moved from issue #49:

hi. i just installed the Experimental Release 0.1.0 and everything was working but then it crashed again.

here is the error message:

/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:47960
        var constructor = type.members['__constructor'];
                                      ^

TypeError: Cannot read property '__constructor' of undefined
    at TypeScriptSymbolQuery.getTemplateRefContextType (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:47960:39)
    at TypeScriptSymbolQuery.getTemplateContext (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:47935:36)
    at ExpressionDiagnosticsVisitor.visitVariable (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:47029:52)
    at VariableAst.visit (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16446:24)
    at visit (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16681:37)
    at /Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16683:42
    at Array.forEach (native)
    at templateVisitAll (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16682:10)
    at visit (/Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:44866:30)
    at /Users/Kwakes/.vscode/extensions/Google.ng-template-0.1.0/server/node_modules/@angular/language-service/bundles/language-service.umd.js:44827:13
[Error - 2:20:17 PM] Connection to server got closed. Server will not be restarted.

Not working in standalone HTML files in larger project

Hi,

i have found very strange behavior. I tried your extension in my project, but it is working only in inline templates, not in standalone html files. But in my project i`m using our company npm packages which are not in public npm repository. So i wanted to reduce project to smaller footprint which i can put on github to reproduce problem.

But when i reduced it it started working also in standalone html files. Well i have to try to find when it stops working, but currently i don`t have that case. But definitely there is some problem when it stops working in standalone html files.

Component methods not recognized in template editor

image
Methods do exist and 'Navigate to symbol' (F12) does work.
image

It appears this is not uniform. It seems to happened in a case where two components reside in the same dir. It might be that the tool uses the model of the wrong component (names do match i.e. c1.ts with c1.html & c2.ts with c2,thml).

typescript 2.2.1

    "@angular/cli": "1.0.0-rc.0",
    "@angular/compiler-cli": ">=4.0.0-beta <5.0.0",
    "@angular/language-service": ">=4.0.0-beta <5.0.0",
    "typescript": "~2.2.1"

vscode 1.9.1

is it possible to get it run with these versions?

SERVER ERROR: Cannot read property 'token' of undefined

Getting this right after opening a project and hovering over a template:

Config file name: /home/hugo/pix4d/spa/src/tsconfig.json
Angular Language Service: 4.1.0-beta.0
TypeScript: 2.1.6
SERVER ERROR: Cannot read property 'token' of undefined
TypeError: Cannot read property 'token' of undefined
    at /home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:30584:33
    at Array.forEach (native)
    at CompileMetadataResolver._getProvidersMetadata (/home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:30551:19)
    at /home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:30128:63
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (/home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:30119:49)
    at addNgModule (/home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:38695:58)
    at /home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:38706:14
    at Array.forEach (native)
    at _createNgModules (/home/hugo/pix4d/spa/node_modules/@angular/language-service/bundles/language-service.umd.js:38705:26)
[Error - 10:07:38 AM] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'token' of undefined

I have the 4.1.0-beta.0 language in the package.json, not sure that is related. Furthermore, this happens both in VSCode Stable and Insiders.

OS: Ubuntu 16.10

template engine support (Pug)

Hi, thanks for making this project!

I've been happily using Angular with Pug (having tried to make things more Angular-friendly from their side), and I was wondering if I might be able to enable the awesomeness of the language services for that as well.
I found a few files that looked like they were about HTML, though I've only quickly glanced through the codebase.

Could you perhaps give pointers as to what it might take to achieve this? Moreover, what would be the best place to put this (PR / branch / fork / plugin to your plugin)?

formGroup not a known property of form

This code shows the error message: Can't bind formGroup since it isn't a known property of form.

<form [formGroup]="form"></form>

The module from @angular/forms is imported via a custom SharedModule that is imported in the module of the template.

Zombie processes throughout the day

So I've found that throughout the day, my angular-cli gets slower and slower and I wondered what it was until I checked my Activity Monitor in OSX.
I noticed quite a few zombie processes towards the end of the day. Previous version of this language-service gave me between 2-5 zombie processes and I think with the latest version I seem to end up with 1 left. I've added a few details/screenshots in this issue about them: microsoft/vscode#17156

Is there any way I can help with getting some more information about them?

Incorrect hover locations in unmodified files in Windows

Windows only

The hover columns of a line are off by one per line of the file until the file is modified.

STEPS:

  1. Open the Angular quickstart application.
  2. Open app.component.ts
  3. Hover over the name in the template.

EXPECTED:
A hover hint for name on all characters of the name

RECEIVED
A hover hint for name over the e and }} past the name.

WORKAROUND
Modifying the file in any way fixes this issue.

Bug: Huge CPU/Battery consumption

Specs:
MacBook Pro (Retina, 13", Late 2013)
OS: OS X El Capitan 10.11.6
VS Code: Version 1.11.1 (1.11.1)

So today I noticed my fan running even tho I was hardly running any apps in the background. Also my battery was draining way faster than usual. A look into the task manager found the culprit:

aktivitatsanzeige meine prozesse 2017-04-06 22-09-48

After deactivating and reactivating every single extension, it was this one that caused the problem. Is anyone else experiencing this?

Template reference to ngModel produces error.

Given the template

<label for="name">Name</label>
<input type="text" class="form-control" id="name"
	   required
	   [(ngModel)]="model.name" name="name"
	   #name="ngModel" >
<div [hidden]="name.valid || name.pristine"
	 class="alert alert-danger">Name is required</div>

The ng language service will draw red squiggles under name.valid and name.pristine with the error

[Angular] Identifier 'valid' is not defined. 'NgModel' does not contain such a member

Structural errors introduced do no show up until a later modification

  1. Create a component:
@Component({
  moduleId: module.id,
  selector: 'my-dashboard',
  templateUrl: 'dashboard.component.html'
})
export class DashboardComponent implements OnInit
...
  1. Comment the object literal properties
@Component({
  // moduleId: module.id,
  // selector: 'my-dashboard',
  // templateUrl: 'dashboard.component.html',
})
export class DashboardComponent implements OnInit
  1. Now @component must be marked as error but the error isn't shown until I edit any other part of my source code

angular-ls-problem

When installing this plugin it breaks intelligence

vscode: 1.11.1
Steps to reproduce:

  1. On any sample project make sure intelligence is working
  2. Install plugin
  3. Try to use intelligence and observe that it is stuck on "loading..." indicator
  4. Uninstall/disable the plugin and observe that intelligence is working again.

@chuckjaz this might be related to #67

Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'forEach' of undefined

I previously had the angular language service working in this project. I upgraded the Language Service from 0.0.11 to 0.0.12 hoping it would sort the issue.

Angular 2.4.9
Language Service: 0.0.12
TypeScript: 2.0.10

Search path: c:/dev/some-app/src/app/...
Config file name: c:/dev/some-app/tsconfig.json
Failed on type {"filePath":"c:/dev/some-app/src/app/layout/menu/menu.component.ts","name":"MenuComponent","members":[]} with error TypeError: Cannot read property 'forEach' of undefined
[Error - 5:17:24 PM] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'forEach' of undefined

My tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

Go to definition or CTRL+Click a symbol, works only once when this extension is active

When the plugin is installed, whenever I go to certain definitions (for example "Promise") it works only once. Afterwards, the functionality does not work anymore and I have to Reload Window.

Not all definitions cause this, but it seem to happen more on core classes.
By turning off this extension, I've narrowed it to this one.

So for now, I unfortunately have no choice to deactivate the extension to continue working. Let me know if you need more information. Thanks

Using latest VSCode 1.11.1

The Angular Language Service server crashed 5 times

Hi.

i installed the vscode-ng-language-service 0.0.12 Experimental Release on both my mac and windows computers. i have been getting the same issue with both of them

angular crash

it has been doing this for a while now. the plugin seem not to be working.

how can i resolve this

thank you

Can't install the extension

I have just got an error during installation:

1/10/2017 10:05:43 AM - Microsoft VSIX Installer
1/10/2017 10:05:43 AM - -------------------------------------------
1/10/2017 10:05:43 AM - vsixinstaller.exe version:
1/10/2017 10:05:43 AM - 15.0.26014.0 built by: D15REL
1/10/2017 10:05:43 AM - -------------------------------------------
1/10/2017 10:05:43 AM - Command line parameters:
1/10/2017 10:05:43 AM - C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VSIXInstaller.exe,C:\Users\me\Downloads\ngls.vsix
1/10/2017 10:05:43 AM - -------------------------------------------
1/10/2017 10:05:43 AM - Microsoft VSIX Installer
1/10/2017 10:05:43 AM - -------------------------------------------
1/10/2017 10:05:44 AM - Initializing Install...
1/10/2017 10:05:45 AM - Extension Details...
1/10/2017 10:05:45 AM - 	Identifier         : ng-template
1/10/2017 10:05:45 AM - 	Name               : Angular Language Service
1/10/2017 10:05:45 AM - 	Author             : Google
1/10/2017 10:05:45 AM - 	Version            : 0.0.10
1/10/2017 10:05:45 AM - 	Description        : Editor services for Angular templates
1/10/2017 10:05:45 AM - 	Locale             : en-US
1/10/2017 10:05:45 AM - 	MoreInfoURL        : 
1/10/2017 10:05:45 AM - 	InstalledByMSI     : False
1/10/2017 10:05:45 AM - 	SupportedFrameworkVersionRange : [0.0,2147483647.2147483647]
1/10/2017 10:05:45 AM - 
1/10/2017 10:05:45 AM - 	SignatureState     : Unsigned
1/10/2017 10:05:45 AM - 	Supported Products : 
1/10/2017 10:05:45 AM - 		Microsoft.VisualStudio.Code
1/10/2017 10:05:45 AM - 			Version : 
1/10/2017 10:05:45 AM - 
1/10/2017 10:05:45 AM - 	References         : 
1/10/2017 10:05:45 AM - Signature Details...
1/10/2017 10:05:45 AM - 	Extension is not signed.
1/10/2017 10:05:45 AM - 
1/10/2017 10:05:45 AM - Searching for applicable products...
1/10/2017 10:05:45 AM - Found installed product - Global Location
1/10/2017 10:05:45 AM - Found installed product - ssms
1/10/2017 10:05:45 AM - Found installed product - Visual Studio Community 2017 RC
1/10/2017 10:05:46 AM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.App.GetInstallableData(String vsixPath, Boolean isRepairSupported, IEnumerable`1& skuData)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

I have VSCode 1.8.1 installed running Windows 7 x64

Editing a component will sometimes report a spurious error or throw and exception.

Users/chuckj/extension/ng-template/client/server/node_modules/@angular/language-service/bundles/language-service.umd.js:27491
	            throw new Error("No Directive annotation found on " + stringify$1(type));
	            ^

Error: No Directive annotation found on AppComponent
    at DirectiveResolver.resolve (/Users/chuckj/extension/ng-template/client/server/node_modules/@angular/language-service/bundles/language-service.umd.js:27491:20)
    at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (/Users/chuckj/extension/ng-template/client/server/node_modules/@angular/language-service/bundles/language-service.umd.js:31502:65)
    at TypeScriptServiceHost.ensureTemplateMap (/Users/chuckj/extension/ng-template/client/server/node_modules/@angular/language-service/bundles/language-service.umd.js:44474:45)
    at TypeScriptServiceHost.getTemplates (/Users/chuckj/extension/ng-template/client/server/node_modules/@angular/language-service/bundles/language-service.umd.js:44373:15)
    at LanguageServiceImpl.getDiagnostics (/Users/chuckj/extension/ng-template/client/server/node_modules/@angular/language-service/bundles/language-service.umd.js:42305:36)
    at /Users/chuckj/extension/ng-template/client/server/editorServices.js:2700:72
    at time (/Users/chuckj/extension/ng-template/client/server/editorServices.js:2691:22)
    at Object.getDiagnostics (/Users/chuckj/extension/ng-template/client/server/editorServices.js:2700:20)
    at ErrorCollector.sendErrorsFor (/Users/chuckj/extension/ng-template/client/server/errors.js:35:39)
    at Timeout.process [as _onTimeout] (/Users/chuckj/extension/ng-template/client/server/errors.js:26:19)

Component not included in a module warning for all components not in root AppModule

Hi,

This is looking very promising, can't wait to use it!

I am however having trouble getting this to recognise components that are declared in feature modules (both lazy-loaded and not). All these components have the following warning (with red squiggles under the component decorator).

[Angular] Component 'xxxComponent' is not included in a module and will not be available inside a template. Consider adding it to a NgModule declaration

This means that in templates (the app.component.html template in the root module is the only one) in this module I can get completion etc. to work for directives that are in the same module and imported angular built-in directives. However directives from my own imported modules i get the following.

[Angular] 'app-nav' is not a known element: 1. If 'app-nav' is an Angular component, then verify that it is part of this module. 2. If 'app-nav' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
Have i missed something or is this maybe a bug?

I am very excited to use this. It will make my angular 2 coding experience so much better and hopefully save a lot of time, so thanks!

Feature request: Get references in template (getReferencesAtPosition)

Hi,

as for now you can navigate to source by ctrl+click, or peek definition, but if you use find all usages template occurencies on methods or properties are not in result window.

This would be awesome, but i`m not sure that this is possible to do in VsCode, but it would be nice :). Especially while refactoring code, since right now this occurencies can be forgotten or must be string searched.

Thank you

Intellisense works very slowly

We have a package of about 200 components with 50 attributes in each. Execution of each action takes from several seconds up to a minute. ย 

The language-service package's version is 2.4.9
Extension version is 0.0.12
Project for reproduce - intellisense-test.zip

Steps to reproduce:

  1. Install packages.
  2. Go to src/app/app.component.html.
  3. Type "<dx" and press Ctrl+Space <- a delay will occur here
  4. Select the "dx-button" component after loading components.
  5. Close the new tag and try to type a new attribute for it (for example, "(onClick)") <- a delay will occur.

String literals throws errors

class FooCmp {
  something: 'foo' | 'bar';
}
<div *ngIf="something === 'foo'"></div>

throws

'Expected the operants to be of similar type or any'

Re-exported modules's components not detected by the language service in HTML templates

Since angular/material2-2.0.0-beta.3 announced that the MaterialModule which exported all of the material components is going to get deprecated in the next version, I decided to follow their advice and create my own application specific AppMaterialModule where I included only the material modules which I use one by one.

// app-material.module.ts
import { NgModule } from '@angular/core';
import {
  MdInputModule,
  etc...
} from '@angular/material'

@NgModule({
  imports: [],
  exports: [
    MdInputModule,
    etc...
  ],
  declarations: [],
  providers: [],
})
export class AppMaterialModule { }

Here is my app.module.ts file as well:

@NgModule({
  imports: [
    CoreModule,
    AppMaterialModule,
    BrowserModule,
    BrowserAnimationsModule,
    HttpModule,
    AppRoutingModule,
    SharedModule.forRoot()
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }

I tested my application and it works just the same way as it used to before replacing the MaterialModule. However, when I opened an HTML template file I noticed that there are errors shown on all the material components used.

They are all with the same error:

[Angular]
'md-input-container' is not a known element:
1. If 'md-input-container' is an Angular component, then verify that it is part of this module.
2. If 'md-input-container' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

ng-lang-service-bug

I hope this is a helpful explanation to the problem I experience. If you need more information I will be glad to provide it.

Cant find version 0.0.10

Hi Chuck.

I have watch for this project and i have received email:

Alpha release 0.0.10

To test install the .vsix file using "Install from VSIX.." in the "Extensions" tab's menu.

This release has known issues. Use at your own risk.

Please submit issues you have with this release to https://github.com/chuckjaz/vscode-ng-template-service/issues.

When i click on link https://github.com/chuckjaz/vscode-ng-template-service/releases/tag/0.0.10 github returns 404 not found.

And one more thing, i cloned repository and tried to build vsix by myself, but without success.
Both branches master and release-tags fails to build during ./build.sh on tsc errors.

release-tags: src/editorServices.ts(2036,21): error TS2346: Supplied parameters do not match any signature of call target.

master: src/extension.ts(5,57): error TS2307: Cannot find module 'vscode'.

I would like to try this extensions lookes awesome, but right now i still cant.

Extension messing with html colorization

After installing this extension, my html element colorization has been messed up. See screenshot below.

screen shot 2017-04-05 at 10 24 46 am

I uninstalled the extension to make sure it was this extension, and the colorization went back to how it should be, shown below:

screen shot 2017-04-05 at 10 27 55 am

Upon re-installing, the colorization was messed up again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.