microsoft / microsoft/TypeScript

Go to Definition for Angular (9.0.0-rc.9) project breaks

Offen
#36,335 8 Kommentare 7 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

OS and VSCode version
  • VSCode Version: 1.41.1
  • OS Version: Ubuntu Mate 18.04
  • Typescript versions tested: 3.6.4 (version from node_modules) , 3.7.3 (current version used in VSCode), ms-vscode.vscode-typescript-next-3.8.20200119 (using VSCode plugin)
  • Angular version: 9.0.0-rc.9
Problem description (updated with findings in comments below)

Go To Definition does not work properly when trying to go to definition of an Angular class that resides in node_modules. Simply mouse-hovering over this Class (or function) definition works though and the context popup is shown.
Moreover, if navigating to a class that resides inside the project source files (not inside node_modules) also works.
Go To Definition also works when going into definition of libraries that are not part of Angular - for example, rxjs.

Steps to Reproduce:
  1. Import or create Angular project (using RC version 9.0.0-rc.9) and install node_modules
  2. Create a component like so:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
  constructor() {}

  ngOnInit() {}
}
  1. Try ctrl + mouse click on OnInit class. Following error is thrown in the log file:
Info 260  [8:44:36.701] request:
    {"seq":37,"type":"request","command":"definitionAndBoundSpan","arguments":{"file":"/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/src/app/modules/login/login.component.ts","line":8,"offset":44}}
Err 261   [8:44:36.883] Exception on executing command {"seq":37,"type":"request","command":"definitionAndBoundSpan","arguments":{"file":"/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/src/app/modules/login/login.component.ts","line":8,"offset":44}}:

    Maximum call stack size exceeded

    RangeError: Maximum call stack size exceeded
        at String.replace (<anonymous>)
        at Object.normalizeSlashes (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:15757:21)
        at Object.combinePaths (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:16094:31)
        at Object.getPathComponents (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:15943:19)
        at Object.resolvePath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:16115:82)
        at Object.normalizePath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:15865:19)
        at Object.toPath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:8866:18)
        at toPath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:110995:23)
        at getSourceFile (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111043:24)
        at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111016:24)
        at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)
        at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)
        at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)
        at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)
        at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)
        [... repeated entries ommited for brevity]

File text of /media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/src/app/modules/login/login.component.ts:
    import { Component, OnInit } from '@angular/core';
    
    @Component({
      selector: 'app-login',
      templateUrl: './login.component.html',
      styleUrls: ['./login.component.scss']
    })
    export class LoginComponent implements OnInit {
      constructor() {}
    
      ngOnInit() {}
    }
    

Info 176  [8:56:13.165] response:
    {"seq":0,"type":"response","command":"definitionAndBoundSpan","request_seq":14,"success":false,"message":"Error processing request. Maximum call stack size exceeded\nRangeError: Maximum call stack size exceeded\n    at String.replace (<anonymous>)\n    at Object.normalizeSlashes (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:15757:21)\n    at Object.combinePaths (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:16094:31)\n    at Object.getPathComponents (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:15943:19)\n    at Object.resolvePath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:16115:82)\n    at Object.normalizePath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:15865:19)\n    at Object.toPath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:8866:18)\n    at toPath (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:110995:23)\n    at getSourceFile (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111043:24)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111016:24)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111016:24)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111016:24)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    at tryGetSourcePosition (/media/martin/DADOS/Programacao/projetos/bootstrap-code/ui/node_modules/typescript/lib/tsserver.js:111020:61)\n    [... repeated entries ommited for brevity]

Does this issue occur when all extensions are disabled?: Yes/No

Yes

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, Go to Definition für OnInit in der gemeldeten Angular 9.0.0-rc.9-Komponente zu reproduzieren und die definitionAndBoundSpan-Anfrage zu untersuchen. Lies den relevanten Stack-Pfad in node_modules/typescript/lib/tsserver.js, insbesondere die wiederholten tryGetSourcePosition-Aufrufe. Als erledigt gilt die Navigation in Angular-Klassen, wenn sie nicht mehr mit Maximum call stack size exceeded fehlschlägt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
developer-experience, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.