Improved console messages for command-line.

This commit is contained in:
Eric Traut 2019-04-06 14:09:18 -07:00
parent 56fa8040c5
commit 692ec961f2
5 changed files with 21 additions and 14 deletions

3
.vscode/launch.json vendored
View File

@ -12,8 +12,7 @@
"args": [
"-p",
"${workspaceRoot}/../brain",
"--timing",
"-w"
"--timing"
],
"internalConsoleOptions": "openOnSessionStart",
"outFiles": [

View File

@ -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

View File

@ -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);

View File

@ -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());

View File

@ -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 :