microsoft / microsoft/TypeScript

[Feature Request] Print project directory when diagnostics enabled

Offen
#32,496 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Search Terms

diagnostics, project directory

Suggestion

I have about 40+ sub-projects in a composite project right now and when building, it takes about 10 minutes.

It's hard to troubleshoot which projects are the bottleneck when I don't even know which projects are being built.

Enabling diagnostics only tells me how long a project took but doesn't tell me what that project is.

So, my feature request is to print the project directory when diagnostics is enabled.


At the moment, I've modified my own tsc.js,

//Find this line
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
//Replace with this snippet
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
if (program.getRootFileNames().length > 0) {
    const path = program.getRootFileNames()[0].replace(/\/[^/]+?\.[^.]+?$/, "");
    reportStatisticalValue("Project", (
        path.indexOf(program.getCurrentDirectory()) == 0 ?
            path.substr(program.getCurrentDirectory().length) :
            path
    ));
}

It works enough for me,

Files:                                      2944
Lines:                                    279749
Nodes:                                   1473021
Identifiers:                              417022
Symbols:                                  295304
Types:                                        73
Memory used:                             748010K
Assignability cache size:                      0
Identity cache size:                           0
Subtype cache size:                            0
I/O Read time:                             0.02s
Parse time:                                0.21s
Program time:                              0.84s
Bind time:                                 0.18s
printTime time:                            0.01s
Emit time:                                 0.01s
I/O Write time:                            0.01s
Total time:                                1.03s
Project:                  /src/app-route-handler

I don't really know much about the TypeScript API. There's probably a proper way to get this information but with my limited knowledge, I managed to hack that together.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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, den Code für die Diagnoseausgabe rund um reportTimeStatistic in tsc.js zu lokalisieren, und prüfe, wie program.getRootFileNames() und program.getCurrentDirectory() verfügbar sind. Die Änderung ist abgeschlossen, wenn die Diagnoseausgabe für jedes gemeldete Projekt das Projektverzeichnis angibt; verwende das vorhandene Muster reportStatisticalValue als Referenz.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
cli, compilers
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 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.