From 692ec961f2b8df43fd01869b7d4fd36b4e558d9f Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Sat, 6 Apr 2019 14:09:18 -0700 Subject: [PATCH] Improved console messages for command-line. --- .vscode/launch.json | 3 +-- README.md | 5 +---- server/src/analyzer/service.ts | 8 ++++---- server/src/common/timing.ts | 7 ++++++- server/src/pyright.ts | 12 +++++++++--- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index e95b5e5b2..70cf3dee4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,8 +12,7 @@ "args": [ "-p", "${workspaceRoot}/../brain", - "--timing", - "-w" + "--timing" ], "internalConsoleOptions": "openOnSessionStart", "outFiles": [ diff --git a/README.md b/README.md index be7615581..a21587ab0 100644 --- a/README.md +++ b/README.md @@ -71,15 +71,12 @@ To run the command-line tool: Pyright is a work in progress. The following functionality is not yet finished. If you would like to contribute to any of these areas, contact the maintainers of the repo. +* Validate that all abstract methods are overridden * Type analysis support for generators * Type analysis support for coroutines * Type analysis support for async functions and lambdas -* Validate await / async consistency * Support for old-style type annotations within comments * Address the many TODO comments in the code -* Better handling of function decorators (don't punt on type checking) -* Add more tests for type checker -* Validate that all abstract methods are overridden * Provide switch that treats instance variables and methods that begin with underscore as private * Validate parameters for magic functions * Synthesize TypeVar param and return types for lambdas where possible diff --git a/server/src/analyzer/service.ts b/server/src/analyzer/service.ts index d194b77c4..77b49fdc5 100644 --- a/server/src/analyzer/service.ts +++ b/server/src/analyzer/service.ts @@ -220,13 +220,13 @@ export class AnalyzerService { } } } else { - this._console.log( - `No venvPath specified. Falling back on PYTHONPATH:`); const pythonPaths = PythonPathUtils.getPythonPathEnvironmentVariable(); if (pythonPaths.length === 0) { this._console.log( - ` No valid paths found in PYTHONPATH environment variable.`); + `No venvPath specified, and no valid paths found in PYTHONPATH environment variable.`); } else { + this._console.log( + `Using PYTHONPATH directories to resolve imports:`); pythonPaths.forEach(path => { this._console.log(` ${ path }`); }); @@ -324,7 +324,7 @@ export class AnalyzerService { } private _updateTrackedFileList() { - this._console.log(`Finding source files`); + this._console.log(`Searching for source files`); let fileList = this._getFileNamesFromFileSpecs(); let fileDiagnostics = this._program.setTrackedFiles(fileList); diff --git a/server/src/common/timing.ts b/server/src/common/timing.ts index ba2717ba7..05694e074 100644 --- a/server/src/common/timing.ts +++ b/server/src/common/timing.ts @@ -46,6 +46,7 @@ export class TimingStat { } export class TimingStats { + totalDuration = new Duration(); findFilesTime = new TimingStat(); readFileTime = new TimingStat(); tokenizeFileTime = new TimingStat(); @@ -54,7 +55,11 @@ export class TimingStats { semanticAnalyzerTime = new TimingStat(); typeAnalyzerTime = new TimingStat(); - print(console: ConsoleInterface) { + printSummary(console: ConsoleInterface) { + console.log(`Completed in ${ this.totalDuration.getDurationInSeconds() }sec`); + } + + printDetails(console: ConsoleInterface) { console.log('Find Source Files: ' + this.findFilesTime.printTime()); console.log('Read Source Files: ' + this.readFileTime.printTime()); console.log('Tokenize: ' + this.tokenizeFileTime.printTime()); diff --git a/server/src/pyright.ts b/server/src/pyright.ts index d9f6cb19b..4f7271245 100644 --- a/server/src/pyright.ts +++ b/server/src/pyright.ts @@ -93,11 +93,17 @@ function processArgs() { reportDiagnostics(results.diagnostics); } - if (args.timing !== undefined) { - timingStats.print(console); + if (!watch) { + // Print the total time. + timingStats.printSummary(console); } - if (watch === undefined) { + if (args.timing !== undefined) { + // Print the timing details. + timingStats.printDetails(console); + } + + if (!watch) { process.exit( results.diagnostics.length > 0 ? ExitStatus.DiagnosticsReported :