Skip to content

Extension completely breaks when an Angular project is not the root directory of a workspace. #1488

@b4ux1t3

Description

@b4ux1t3

🐞 bug report

Is this a regression?

Not as far as I can tell.

Description

While working with the ASP.NET Angular template, I noticed that VS Code constantly throws errors about bad syntax, missing imports, and, helpfully, things like saying "Appears in the NgModule.imports of AppServerModule, but itself has errors(-996002)", but then proceeding to show no other errors in the file (example in screenshots).

The Angular app compiles just fine, and these errors go away if I open the Angular app as the workspace directory.

I've also been unable to reproduce this all of my machines; the problem seems to be sporadic but persistent. I've also been unable to reproduce it in any other situations; it doesn't seem to occur when I create a nested directory inside an empty directory and then open an Angular project in that nested directory.

Bug Type

What does this bug affect

  • Angular Language Service VSCode extension
  • Angular Language Service server

Reproduction

Steps to reproduce the behavior:

  1. Clone this repository: https://github.com/b4ux1t3/angular-extension-test.git
  • git clone https://github.com/b4ux1t3/angular-extension-test.git
  1. Run npm install inside the ClientApp directory.
  2. See the aforementioned errors.

Expected behavior

The extension should work regardless of where the angular project is within the VS Code workspace.

Logs

I'm unable to generate logs, because the Angular compiler itself works just fine; it has no problem compiling and serving the application I'm developing.

Screenshots

chrome_MtWtWNbAwl
The aforementioned error.

image
ngForm apparently doesn't exist for forms, but you can see in the previous screenshot that I am, indeed, properly importing the FormsModule.

image
This is a rather large screenshot, but you can see the broken extension on the left, with the same file pulled up in a VSCode instance with the angular application set as the workspace root, and the running, compiled application with no console errors on the right.

This is essentially the "smoking gun" that shows that the extension is the only thing misbehaving here.

🌍 Your Environment

Angular Version:



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.0.0
Node: 14.16.1
Package Manager: npm 7.20.5
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1200.0 (cli-only)
@angular-devkit/core         12.0.0 (cli-only)
@angular-devkit/schematics   12.0.0 (cli-only)
@schematics/angular          12.0.0 (cli-only)

Extension Version:


v12.2.0

VSCode Version:


Version: 1.59.0 (user setup)
Commit: 379476f0e13988d90fab105c5c19e7abc8b1dea8
Date: 2021-08-04T23:13:12.822Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Windows_NT x64 10.0.19043

Operating System:


Windows 10 Version 21H1 (OS Build 19043.1165)

Anything else relevant?
Since I am running this as the client for a .NET application, VSCode is running (at least) three language servers:

  1. OmniSharp for C# and .NET
  2. Angular Language Service
  3. TypeScript

I don't think that should matter, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions