Skip to content
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

0.1100.3 template inspection not working #1063

Closed
nick-lvov-dev opened this issue Jan 15, 2021 · 11 comments
Closed

0.1100.3 template inspection not working #1063

nick-lvov-dev opened this issue Jan 15, 2021 · 11 comments

Comments

@nick-lvov-dev
Copy link

Describe the bug

Basically the title, the template inspection doesn't work, you can't navigate to a variable, errors aren't shown etc.
When I reverted back to 0.1100.2 it started working again

To Reproduce

Steps to reproduce the behavior:

  1. Create new angular project
  2. Add an object property
  3. Try to access a non-existent property of that object from the template

Expected behavior

You can navigate to the property definition by pressing F12 or Ctrl + left click
An error is displayed about the missing property

Actual behavior
Navigation doesn't work
No error is displayed

Logs

Please attach two logs:

[0115/133555.049:ERROR:registration_protocol_win.cc(103)] CreateFile: The system cannot find the file specified. (0x2)
[Info  - 1:35:55 PM] Angular language server process ID: 8152
[Info  - 1:35:55 PM] Using typescript/lib/tsserverlibrary v4.0.5 from c:\Users\nikit\.vscode\extensions\angular.ng-template-0.1100.3\node_modules\typescript\lib\tsserverlibrary.js
[Info  - 1:35:55 PM] Using @angular/language-service v11.0.9 from c:\Users\nikit\.vscode\extensions\angular.ng-template-0.1100.3\server\node_modules\@angular\language-service\bundles\language-service.js
[Info  - 1:35:55 PM] Log file: c:\Users\nikit\AppData\Roaming\Code\logs\20210115T133438\exthost3\Angular.ng-template\nglangsvc.log
[Info  - 1:35:57 PM] Enabling VE language service for d:/repos/test-angular/tsconfig.json.
[Error - 1:35:57 PM] Failed to find project for d:\repos\test-angular\src\app\app.component.html
[Error - 1:36:11 PM] No config file for d:/repos/test-angular/src/app/app.component.html
  1. nglangsvc.log

Screenshots

image
image

@Max-FullTek
Copy link

I have a same problem.

@bubliq
Copy link

bubliq commented Jan 15, 2021

Same problem with 0.1100.3
Downgrade to version v0.1100.2 helped

@gn131131
Copy link

gn131131 commented Jan 15, 2021

Same problem with 0.1100.3
Downgrade to version v0.1100.2 helped

reinstall vscode and extensions not working, 2h wasted
thankyou

@bubliq
Copy link

bubliq commented Jan 15, 2021

Same problem with 0.1100.3
Downgrade to version v0.1100.2 helped

reinstall vscode and extensions not working, 2h wasted
thankyou

image

@Ruud-cb
Copy link

Ruud-cb commented Jan 15, 2021

Same problem with 0.1100.3
Downgrade to version v0.1100.2 helped

reinstall vscode and extensions not working, 2h wasted
thankyou

2 hours wasted? It literally takes up to 1 minute to install another version like bubliq is already showing.
Thanks for the hint, worked for me as well!

@crclz
Copy link

crclz commented Jan 15, 2021

I haven't write angular apps for 7 month and today I'm about to work on a new project, angular extension gave me this surprise.

Downgrading to v0.1100.2 solves the problem.

@ghost
Copy link

ghost commented Jan 15, 2021

Same issue. Downgrading helps.
Fix 🙏.

@kyliau
Copy link
Contributor

kyliau commented Jan 15, 2021

Thanks for submitting the report. Since there is no way to roll back the release, I'll republish 0.1100.2 as the latest version while we investigate the issue.

On the other hand, looking at the change log, I've narrowed the issue down to two commits:

  1. fix(language-service): do not return external template that does not exist angular#39898
  2. fix(language-service): do not treat file URIs as general URLs angular#39917

I suspect this is a Windows-only issue. From the log provided (thanks for uploading), the path separator is inconsistent:

[Info  - 1:35:57 PM] Enabling VE language service for d:/repos/test-angular/tsconfig.json.
[Error - 1:35:57 PM] Failed to find project for d:\repos\test-angular\src\app\app.component.html
[Error - 1:36:11 PM] No config file for d:/repos/test-angular/src/app/app.component.html

kyliau added a commit to kyliau/angular that referenced this issue Jan 20, 2021
Many `ts.LanguageService` APIs accept a filename, for example
```ts
getQuickInfoAtPosition(fileName: string, position: number)
```
The requirement is that `fileName` is agnostic to the platform (Linux, Mac,
Windows, etc), and is always normalized to TypeScript's internal
`NormalizedPath`.

This is evident from the way these APIs are called from the language server:
```ts
  private onHover(params: lsp.TextDocumentPositionParams) {
    const lsInfo = this.getLSAndScriptInfo(params.textDocument);
    if (lsInfo === undefined) {
      return;
    }
    const {languageService, scriptInfo} = lsInfo;
    const offset = lspPositionToTsPosition(scriptInfo, params.position);
    const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
    // ...
  }
```
https://github.com/angular/vscode-ng-language-service/blob/9fca9c66510974c26d5c21b31adb9fa39ac0a38a/server/src/session.ts#L594
Here `scriptInfo.fileName` is always a `ts.server.NormalizedPath`.

However, angular#39917 accidentally leaked
the platform-specific paths, and caused a mismatch between the incoming paths
and the paths stored in the internal data structure `fileToComponent`.

This PR fixes the bug by always normalizing the paths, and updating the
type to reflect the format of the underlying data.

Fixes angular/vscode-ng-language-service#1063
kyliau added a commit to kyliau/angular that referenced this issue Jan 20, 2021
Many `ts.LanguageService` APIs accept a filename, for example
```ts
getQuickInfoAtPosition(fileName: string, position: number)
```
The requirement is that `fileName` is agnostic to the platform (Linux, Mac,
Windows, etc), and is always normalized to TypeScript's internal
`NormalizedPath`.

This is evident from the way these APIs are called from the language server:
```ts
  private onHover(params: lsp.TextDocumentPositionParams) {
    const lsInfo = this.getLSAndScriptInfo(params.textDocument);
    if (lsInfo === undefined) {
      return;
    }
    const {languageService, scriptInfo} = lsInfo;
    const offset = lspPositionToTsPosition(scriptInfo, params.position);
    const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
    // ...
  }
```
https://github.com/angular/vscode-ng-language-service/blob/9fca9c66510974c26d5c21b31adb9fa39ac0a38a/server/src/session.ts#L594
Here `scriptInfo.fileName` is always a `ts.server.NormalizedPath`.

However, angular#39917 accidentally leaked
the platform-specific paths, and caused a mismatch between the incoming paths
and the paths stored in the internal data structure `fileToComponent`.

This PR fixes the bug by always normalizing the paths, and updating the
type to reflect the format of the underlying data.

Fixes angular/vscode-ng-language-service#1063
AndrewKushnir pushed a commit to angular/angular that referenced this issue Jan 20, 2021
Many `ts.LanguageService` APIs accept a filename, for example
```ts
getQuickInfoAtPosition(fileName: string, position: number)
```
The requirement is that `fileName` is agnostic to the platform (Linux, Mac,
Windows, etc), and is always normalized to TypeScript's internal
`NormalizedPath`.

This is evident from the way these APIs are called from the language server:
```ts
  private onHover(params: lsp.TextDocumentPositionParams) {
    const lsInfo = this.getLSAndScriptInfo(params.textDocument);
    if (lsInfo === undefined) {
      return;
    }
    const {languageService, scriptInfo} = lsInfo;
    const offset = lspPositionToTsPosition(scriptInfo, params.position);
    const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
    // ...
  }
```
https://github.com/angular/vscode-ng-language-service/blob/9fca9c66510974c26d5c21b31adb9fa39ac0a38a/server/src/session.ts#L594
Here `scriptInfo.fileName` is always a `ts.server.NormalizedPath`.

However, #39917 accidentally leaked
the platform-specific paths, and caused a mismatch between the incoming paths
and the paths stored in the internal data structure `fileToComponent`.

This PR fixes the bug by always normalizing the paths, and updating the
type to reflect the format of the underlying data.

Fixes angular/vscode-ng-language-service#1063

PR Close #40492
AndrewKushnir pushed a commit to angular/angular that referenced this issue Jan 20, 2021
Many `ts.LanguageService` APIs accept a filename, for example
```ts
getQuickInfoAtPosition(fileName: string, position: number)
```
The requirement is that `fileName` is agnostic to the platform (Linux, Mac,
Windows, etc), and is always normalized to TypeScript's internal
`NormalizedPath`.

This is evident from the way these APIs are called from the language server:
```ts
  private onHover(params: lsp.TextDocumentPositionParams) {
    const lsInfo = this.getLSAndScriptInfo(params.textDocument);
    if (lsInfo === undefined) {
      return;
    }
    const {languageService, scriptInfo} = lsInfo;
    const offset = lspPositionToTsPosition(scriptInfo, params.position);
    const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
    // ...
  }
```
https://github.com/angular/vscode-ng-language-service/blob/9fca9c66510974c26d5c21b31adb9fa39ac0a38a/server/src/session.ts#L594
Here `scriptInfo.fileName` is always a `ts.server.NormalizedPath`.

However, #39917 accidentally leaked
the platform-specific paths, and caused a mismatch between the incoming paths
and the paths stored in the internal data structure `fileToComponent`.

This PR fixes the bug by always normalizing the paths, and updating the
type to reflect the format of the underlying data.

Fixes angular/vscode-ng-language-service#1063

PR Close #40492
@kyliau kyliau added this to Features in Ivy Language Service via automation Jan 20, 2021
@kyliau
Copy link
Contributor

kyliau commented Jan 20, 2021

Fixed in v11.1.0, published to the marketplace
https://github.com/angular/vscode-ng-language-service/releases/tag/v11.1.0

@kyliau kyliau closed this as completed Jan 20, 2021
Ivy Language Service automation moved this from Features to Done Jan 20, 2021
@bubliq
Copy link

bubliq commented Jan 21, 2021

Fixed in v11.1.0, published to the marketplace
https://github.com/angular/vscode-ng-language-service/releases/tag/v11.1.0

Worked for me, thanks, @kyliau

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

7 participants