New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing metadata for @angular/common/locales #20260

Closed
Maistho opened this Issue Nov 8, 2017 · 23 comments

Comments

Projects
None yet
10 participants
@Maistho

Maistho commented Nov 8, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

The content of every [locale].metadata.json file is [null]. This seems to break the angular vscode language service, and is probably not intended.

Expected behavior

Some actual metadata perhaps? I'm not sure what the contents of these files are supposed to be, but it seems like most libraries have objects top-level in the metadata files.

Minimal reproduction of the problem with instructions

https://github.com/angular/common-builds/blob/master/locales/en-GB.metadata.json

Environment


Angular version: 5.0.0+

Browser: N/A
 
For Tooling issues: N/A
@Maistho

This comment has been minimized.

Show comment
Hide comment
@Maistho

Maistho commented Nov 8, 2017

Related: #20207

@vicb

This comment has been minimized.

Show comment
Hide comment
@vicb

vicb Nov 8, 2017

Contributor

How does it break the lang service ?

Contributor

vicb commented Nov 8, 2017

How does it break the lang service ?

@Maistho

This comment has been minimized.

Show comment
Hide comment
@Maistho

Maistho Nov 8, 2017

It stops giving suggestions in templates, and I get the following output in the output console from VS Code.
Changing the contents of sv.metadata.json from [null] to [] stops the error from occuring.

Search path: /home/maistho/prog/convis/src/app/shop/checkout
Failed to read JSON file /home/maistho/prog/convis/node_modules/@angular/common/locales/sv.metadata.json
Config file name: /home/maistho/prog/convis/src/tsconfig.json
Angular Language Service: 5.0.0-beta.5
TypeScript: 2.4.2
Error for getTemplateRefrences:
    TypeError: Cannot read property 'version' of null
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:21442:70
    at Array.find (native)
    at ReflectorHost.BaseAotCompilerHost.readMetadata (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:21442:42)
    at ReflectorHost.BaseAotCompilerHost.getMetadataFor (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:21419:29)
    at StaticSymbolResolver.getModuleMetadata (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:17910:45)
    at StaticSymbolResolver._createSymbolsOf (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:17740:29)
    at StaticSymbolResolver.getSymbolsOf (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:17725:14)
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16800:30
    at Array.forEach (native)
    at extractProgramSymbols (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16799:79)
getTemplateRefrences: 1402ms
SERVER ERROR: Cannot read property 'length' of null
TypeError: Cannot read property 'length' of null
    at Project.updateFileMap (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:797:94)
    at Project.updateGraph (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:815:14)
    at Project.finishGraph (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:807:14)
    at ProjectService.openConfigFile (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:1634:17)
    at ProjectService.openOrUpdateConfiguredProjectForFile (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:1486:41)
    at ProjectService.openClientFile (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:1404:23)
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/documents.js:135:47
    at TextDocuments.logErrors (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/documents.js:235:13)
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/documents.js:131:74
    at handleNotification (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/vscode-jsonrpc/lib/main.js:353:21)
[Error - 00:10:30] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'length' of null
Search path: /home/maistho/prog/convis/src/app/shop/checkout
Failed to read JSON file /home/maistho/prog/convis/node_modules/@angular/common/locales/sv.metadata.json
Failed to read JSON file /home/maistho/prog/convis/node_modules/@angular/common/locales/sv.metadata.json
Config file name: /home/maistho/prog/convis/src/tsconfig.json
Angular Language Service: 5.0.0-beta.5
TypeScript: 2.4.2

etc.

Maistho commented Nov 8, 2017

It stops giving suggestions in templates, and I get the following output in the output console from VS Code.
Changing the contents of sv.metadata.json from [null] to [] stops the error from occuring.

Search path: /home/maistho/prog/convis/src/app/shop/checkout
Failed to read JSON file /home/maistho/prog/convis/node_modules/@angular/common/locales/sv.metadata.json
Config file name: /home/maistho/prog/convis/src/tsconfig.json
Angular Language Service: 5.0.0-beta.5
TypeScript: 2.4.2
Error for getTemplateRefrences:
    TypeError: Cannot read property 'version' of null
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:21442:70
    at Array.find (native)
    at ReflectorHost.BaseAotCompilerHost.readMetadata (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:21442:42)
    at ReflectorHost.BaseAotCompilerHost.getMetadataFor (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:21419:29)
    at StaticSymbolResolver.getModuleMetadata (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:17910:45)
    at StaticSymbolResolver._createSymbolsOf (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:17740:29)
    at StaticSymbolResolver.getSymbolsOf (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:17725:14)
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16800:30
    at Array.forEach (native)
    at extractProgramSymbols (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/@angular/language-service/bundles/language-service.umd.js:16799:79)
getTemplateRefrences: 1402ms
SERVER ERROR: Cannot read property 'length' of null
TypeError: Cannot read property 'length' of null
    at Project.updateFileMap (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:797:94)
    at Project.updateGraph (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:815:14)
    at Project.finishGraph (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:807:14)
    at ProjectService.openConfigFile (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:1634:17)
    at ProjectService.openOrUpdateConfiguredProjectForFile (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:1486:41)
    at ProjectService.openClientFile (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/editorServices.js:1404:23)
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/documents.js:135:47
    at TextDocuments.logErrors (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/documents.js:235:13)
    at /home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/documents.js:131:74
    at handleNotification (/home/maistho/.vscode/extensions/Angular.ng-template-0.1.7/server/node_modules/vscode-jsonrpc/lib/main.js:353:21)
[Error - 00:10:30] Notification handler 'textDocument/didOpen' failed with message: Cannot read property 'length' of null
Search path: /home/maistho/prog/convis/src/app/shop/checkout
Failed to read JSON file /home/maistho/prog/convis/node_modules/@angular/common/locales/sv.metadata.json
Failed to read JSON file /home/maistho/prog/convis/node_modules/@angular/common/locales/sv.metadata.json
Config file name: /home/maistho/prog/convis/src/tsconfig.json
Angular Language Service: 5.0.0-beta.5
TypeScript: 2.4.2

etc.

@Maistho

This comment has been minimized.

Show comment
Hide comment
@Maistho

Maistho Nov 8, 2017

This also only appears after importing and registering the locale in my app.module.ts.

import { registerLocaleData } from '@angular/common';
import svLocale from '@angular/common/locales/sv';
registerLocaleData(svLocale);

Maistho commented Nov 8, 2017

This also only appears after importing and registering the locale in my app.module.ts.

import { registerLocaleData } from '@angular/common';
import svLocale from '@angular/common/locales/sv';
registerLocaleData(svLocale);
@Maistho

This comment has been minimized.

Show comment
Hide comment
@Maistho

Maistho Nov 8, 2017

Right now I also tried updating the language service and other dependencies in the vs-code extension to 5.0.1, and the problem still persists.

Maistho commented Nov 8, 2017

Right now I also tried updating the language service and other dependencies in the vs-code extension to 5.0.1, and the problem still persists.

@FdezRomero

This comment has been minimized.

Show comment
Hide comment
@FdezRomero

FdezRomero Nov 8, 2017

Same problem here: importing any locale throws the error above in the Angular Language Service (as it sees an element in the array but null isn't an object), that prevent any checks being completed in the whole project.

After many retries Visual Studio Code just stops trying to the restart the language server due to errors.

FdezRomero commented Nov 8, 2017

Same problem here: importing any locale throws the error above in the Angular Language Service (as it sees an element in the array but null isn't an object), that prevent any checks being completed in the whole project.

After many retries Visual Studio Code just stops trying to the restart the language server due to errors.

@fpeterdev

This comment has been minimized.

Show comment
Hide comment
@fpeterdev

fpeterdev Nov 9, 2017

I have the same issue angular 5.0.0. and VSCode 1.17.2
Replacing [null] with [] in the [locale].metadata.json file in node_modules seems to solve it; so far everything seems to work. Modifying files in node_modules is far from ideal, but at least VS Code is working until a more permanent solution.

fpeterdev commented Nov 9, 2017

I have the same issue angular 5.0.0. and VSCode 1.17.2
Replacing [null] with [] in the [locale].metadata.json file in node_modules seems to solve it; so far everything seems to work. Modifying files in node_modules is far from ideal, but at least VS Code is working until a more permanent solution.

@ikourfaln

This comment has been minimized.

Show comment
Hide comment
@ikourfaln

ikourfaln Nov 10, 2017

Same issue.
I think the problem occurs because the Angular Language Service extension uses @angular/language-service@5.0.0-beta.5. the extension needs to be updated to use @angular/language-service@5.0.1

ikourfaln commented Nov 10, 2017

Same issue.
I think the problem occurs because the Angular Language Service extension uses @angular/language-service@5.0.0-beta.5. the extension needs to be updated to use @angular/language-service@5.0.1

@Maistho

This comment has been minimized.

Show comment
Hide comment
@Maistho

Maistho Nov 10, 2017

@ikourfaln I had the same issue with 5.0.1

Maistho commented Nov 10, 2017

@ikourfaln I had the same issue with 5.0.1

@ikourfaln

This comment has been minimized.

Show comment
Hide comment
@ikourfaln

ikourfaln Nov 11, 2017

@Maistho
Yes me too, but as I said maybe the issue is the extension, still uses language-service@5.0.0-beta.5

capture

Dependency must be updated to @angular/language-service@5.x.x

ikourfaln commented Nov 11, 2017

@Maistho
Yes me too, but as I said maybe the issue is the extension, still uses language-service@5.0.0-beta.5

capture

Dependency must be updated to @angular/language-service@5.x.x

@Maistho

This comment has been minimized.

Show comment
Hide comment
@Maistho

Maistho Nov 11, 2017

@ikourfaln: Sorry I was not clear. I updated the vscode extension to use 5.0.1 and still had the same issue.

Maistho commented Nov 11, 2017

@ikourfaln: Sorry I was not clear. I updated the vscode extension to use 5.0.1 and still had the same issue.

@ikourfaln

This comment has been minimized.

Show comment
Hide comment
@ikourfaln

ikourfaln Nov 12, 2017

@Maistho
I see, but updating just the package is not enough, I think that the extension must be refactored to follow the break changes after Language Service beta5.

ikourfaln commented Nov 12, 2017

@Maistho
I see, but updating just the package is not enough, I think that the extension must be refactored to follow the break changes after Language Service beta5.

@victornoel

This comment has been minimized.

Show comment
Hide comment
@victornoel

victornoel Nov 20, 2017

Contributor

That sucks a bit that the extension does not use an implementation based on the node_modules… everytime there are ng update, there are some risks of breaking everything.

Contributor

victornoel commented Nov 20, 2017

That sucks a bit that the extension does not use an implementation based on the node_modules… everytime there are ng update, there are some risks of breaking everything.

@victornoel

This comment has been minimized.

Show comment
Hide comment
@victornoel

victornoel Nov 21, 2017

Contributor

@vicb any way to get this fixed? There has been two patch releases since this issue was reported and I suppose this could be fixed simply, no? If you have a recommendation on how to do that, I can do a PR :)

Contributor

victornoel commented Nov 21, 2017

@vicb any way to get this fixed? There has been two patch releases since this issue was reported and I suppose this could be fixed simply, no? If you have a recommendation on how to do that, I can do a PR :)

victornoel added a commit to victornoel/angular that referenced this issue Nov 21, 2017

fix(language-service): ignore null metadatas
There can be null metadatas in certain cases, for example with locales.

Fixes angular#20260

victornoel added a commit to victornoel/angular that referenced this issue Nov 23, 2017

fix(language-service): ignore null metadatas
There can be null metadatas in certain cases, for example with locales.

Fixes angular#20260
@ashishmulaye

This comment has been minimized.

Show comment
Hide comment
@ashishmulaye

ashishmulaye Nov 26, 2017

@victornoel, any update on when your fix will be available?

ashishmulaye commented Nov 26, 2017

@victornoel, any update on when your fix will be available?

@victornoel

This comment has been minimized.

Show comment
Hide comment
@victornoel
Contributor

victornoel commented Nov 26, 2017

@ashishmulaye

This comment has been minimized.

Show comment
Hide comment
@ashishmulaye

ashishmulaye Nov 29, 2017

@chuckjaz, @mhevery, will it be available in next beta release?

ashishmulaye commented Nov 29, 2017

@chuckjaz, @mhevery, will it be available in next beta release?

@deniskrafczyk

This comment has been minimized.

Show comment
Hide comment
@deniskrafczyk

deniskrafczyk Dec 1, 2017

are there any further information?

deniskrafczyk commented Dec 1, 2017

are there any further information?

@ocombe

This comment has been minimized.

Show comment
Hide comment
@ocombe

ocombe Dec 14, 2017

Contributor

Fixed with #20938

Contributor

ocombe commented Dec 14, 2017

Fixed with #20938

@ocombe ocombe closed this Dec 14, 2017

@ikourfaln

This comment has been minimized.

Show comment
Hide comment
@ikourfaln

ikourfaln Dec 14, 2017

Thank you @ocombe
But this is fixed for which milestone? we are waiting for a version that includes this fix.

ikourfaln commented Dec 14, 2017

Thank you @ocombe
But this is fixed for which milestone? we are waiting for a version that includes this fix.

@ocombe

This comment has been minimized.

Show comment
Hide comment
@ocombe

ocombe Dec 14, 2017

Contributor

For the next releases (minor and major)

Contributor

ocombe commented Dec 14, 2017

For the next releases (minor and major)

@ikourfaln

This comment has been minimized.

Show comment
Hide comment
@ikourfaln

ikourfaln Dec 15, 2017

Thank you @ocombe
I'm just wondering how do you manage all commits without milestone!
I think that there is a label to target all next releases.

ikourfaln commented Dec 15, 2017

Thank you @ocombe
I'm just wondering how do you manage all commits without milestone!
I think that there is a label to target all next releases.

@ocombe

This comment has been minimized.

Show comment
Hide comment
@ocombe

ocombe Dec 15, 2017

Contributor

It's a bit of a mess sometimes, but we are starting to change our process and we will be adding milestones soon
And yes, we're using the target label for now

Contributor

ocombe commented Dec 15, 2017

It's a bit of a mess sometimes, but we are starting to change our process and we will be adding milestones soon
And yes, we're using the target label for now

mhevery added a commit that referenced this issue Jan 2, 2018

fix(language-service): ignore null metadatas (#20557)
There can be null metadatas in certain cases, for example with locales.

Fixes #20260

PR Close #20557

mhevery added a commit that referenced this issue Jan 2, 2018

fix(language-service): ignore null metadatas (#20557)
There can be null metadatas in certain cases, for example with locales.

Fixes #20260

PR Close #20557

leo6104 added a commit to leo6104/angular that referenced this issue Mar 25, 2018

fix(language-service): ignore null metadatas (angular#20557)
There can be null metadatas in certain cases, for example with locales.

Fixes angular#20260

PR Close angular#20557
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment