vscode-ng-language-service: bundled @angular/language-service not loaded

Describe the bug

–> is in the title

To Reproduce

Steps to reproduce the behavior:

  1. install & activate (=> latest -> 0.90012 (but also on 0.90003, and other)
  2. error (title)

Logs

Please attach two logs:

  1. Console output (Go to toolbar --> View --> Output, and copy the contents)
  2. Log file (Path is printed to the console output at startup)
[Info  - 8:53:43 AM] Angular language server process ID: 66846
[Info  - 8:53:43 AM] Using typescript v3.7.4 from /Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js
[Info  - 8:53:43 AM] Using @angular/language-service v9.0.1 from /Users/x/.vscode/extensions/angular.ng-template-0.900.12/server/node_modules/@angular/language-service/bundles/language-service.umd.js
[Info  - 8:53:43 AM] Log file: /Users/x/Library/Application Support/Code/logs/20200211T164224/exthost1/Angular.ng-template/nglangsvc.log
[Error - 8:54:07 AM] No config file for /Users/x/src/app/test/test.component.html
/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js:131051
                throw error;
                ^

Error: Could not find source file: '/Users/x/src/app/test/test.component.html'.
    at getValidSourceFile (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js:131047:29)
    at Object.getSemanticDiagnostics (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js:131269:36)
    at Object.proxy.getSemanticDiagnostics (/Users/x/node_modules/@angular/language-service/bundles/language-service.umd.js:49429:32)
    at Session.sendPendingDiagnostics (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/server/index.js:1020:39)
    at Timeout._onTimeout (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/server/index.js:1001:19)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {
  ProgramFiles: [
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es5.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2016.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2017.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2018.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.dom.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.core.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.collection.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.generator.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.iterable.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.promise.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.proxy.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.reflect.d.ts',
    '/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/lib.es2015.symbol.d.ts',
.
.
.
    '/Users/…/node_modules/tslib/tslib.d.ts',
    '/Users/…/node_modules/@types/node/globals.d.ts',
    '/Users/…/node_modules/@types/node/assert.d.ts',
    '/Users/…/node_modules/@types/node/async_hooks.d.ts',
    '/Users/…/node_modules/@types/node/buffer.d.ts',
    ... 1097 more items
  ]
}

[Info  - 9:07:28 AM] Connection to server got closed. Server will restart.
[Info  - 9:07:30 AM] Angular language server process ID: 68581
[Info  - 9:07:30 AM] Using typescript v3.7.4 from /Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js
[Info  - 9:07:30 AM] Using @angular/language-service v9.0.1 from /Users/x/.vscode/extensions/angular.ng-template-0.900.12/server/node_modules/@angular/language-service/bundles/language-service.umd.js
[Info  - 9:07:30 AM] Log file: /Users/x/Library/Application Support/Code/logs/20200211T164224/exthost1/Angular.ng-template/nglangsvc.log

Setup Angular CLI: 8.1.3 Node: 10.16.0 OS: darwin x64 Angular: 8.2.14

Package Version @angular-devkit/architect 0.801.3 @angular-devkit/build-angular 0.801.3 @angular-devkit/build-optimizer 0.801.3 @angular-devkit/build-webpack 0.801.3 @angular-devkit/core 8.1.3 @angular-devkit/schematics 8.1.3 @angular/cdk 8.2.3 @angular/cli 8.1.3 @angular/flex-layout 8.0.0-beta.27 @angular/material 8.2.3 @ngtools/webpack 8.1.3 @schematics/angular 8.1.3 @schematics/update 0.801.3 rxjs 6.5.4 typescript 3.4.5 webpack 4.35.2

VS Code Version: 1.42.0 Commit: ae08d5460b5a45169385ff3fd44208f431992451 Date: 2020-02-06T10:51:33.119Z Electron: 6.1.6 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Darwin x64 18.7.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 32 (16 by maintainers)

Most upvoted comments

Well if you specify the paths for source files tsconfig should apply to it will only apply to those source files and nothing more. In the case of this issue, the relevant tsconfig path was "paths": {"@app/*": ["src/app/*"]"}, but the template source file is located at the nested path “src/app/test/test.component.html”. If you get rid of the paths config option or expand it to include the nested file (e.g. via src/app/**/*) the error should disappear. But for template files this should not affect the functionality of the language service.

Error: Could not find source file: '/Users/x/src/app/test/test.component.html'.
    at getValidSourceFile (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js:131047:29)
    at Object.getSemanticDiagnostics (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/node_modules/typescript/lib/tsserverlibrary.js:131269:36)
    at Object.proxy.getSemanticDiagnostics (/Users/x/node_modules/@angular/language-service/bundles/language-service.umd.js:49429:32)
    at Session.sendPendingDiagnostics (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/server/index.js:1020:39)
    at Timeout._onTimeout (/Users/x/.vscode/extensions/angular.ng-template-0.900.12/server/index.js:1001:19)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {

@ThaBrad try to uninstall the @angular/language-service under /Users/x/, Or remove the node_modules.

@ayazhafiz Thanks that helps clear things up for me.

EVERYTHING fixed now

TO SUMMARIZE:

  • color coding fix by now (latest ALS extension version)
  • which also fixes the snippet problem
  • which also fixes the html comment problem

✅ Original Problem fix: https://github.com/angular/vscode-ng-language-service/issues/635#issuecomment-588271261

@ThaBrad @ayazhafiz I think the missing snippet is still related to the template color highlighting. remove the error color code, it will have snippets again.

I don’t think the missing snippets should be related to the extension. Do they come back if you disable the extension? What are you using to get the snippets?

FINNALY I got SOMEWHERE… 😤. Still weird and “errory”!

I saw in my system’s user (mac -> /Users/myUser/) main folder I had a package.json & node_module folder with more or less the same stuff (and of course @angular/language-service). I found that out after uninstalling it from project/node_module’s and the extension that it was still running. WHY ON EARTH this path (totally out of any scope or reference / 5th-degree parent folder) was touched in any way bears absolutely no logic to me. So I just deleted these artifacts and now I finally get stuff (hovering, autocomplete, …etc).

BUT:

  • still get the [Error - 2:50:55 PM] No config file for /Users/x/FE/src/app/test/test.component.html error for some reason (even if I also npm install @angular/language-service)
  • lost function of other extension (snippets primarily) now: Screenshot 2020-02-19 at 15 07 19 (and no, also not at bottom of list, just gone!) before: Screenshot 2020-02-19 at 15 12 32

. . .

(General) Editor fails

color coding

Also just in general, (installed) Angular Language Service is messing up the color coding in the editor in some cases (tag endings, directives and especially with html comments). That I also saw on other installations of colleagues VS Code instances

Screenshot 2020-02-19 at 15 32 10 Screenshot 2020-02-19 at 15 31 51 Screenshot 2020-02-19 at 15 38 05 (last one is just ALL

@ThaBrad Or try to change the version of @angular/language-service in package.json to 9.0.1.

Can you provide the log file? Did you save test.component.html before this error occurred?