mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-16 19:30:26 +03:00
Improved console messages for command-line.
This commit is contained in:
parent
56fa8040c5
commit
692ec961f2
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@ -12,8 +12,7 @@
|
|||||||
"args": [
|
"args": [
|
||||||
"-p",
|
"-p",
|
||||||
"${workspaceRoot}/../brain",
|
"${workspaceRoot}/../brain",
|
||||||
"--timing",
|
"--timing"
|
||||||
"-w"
|
|
||||||
],
|
],
|
||||||
"internalConsoleOptions": "openOnSessionStart",
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
"outFiles": [
|
"outFiles": [
|
||||||
|
@ -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.
|
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 generators
|
||||||
* Type analysis support for coroutines
|
* Type analysis support for coroutines
|
||||||
* Type analysis support for async functions and lambdas
|
* Type analysis support for async functions and lambdas
|
||||||
* Validate await / async consistency
|
|
||||||
* Support for old-style type annotations within comments
|
* Support for old-style type annotations within comments
|
||||||
* Address the many TODO comments in the code
|
* 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
|
* Provide switch that treats instance variables and methods that begin with underscore as private
|
||||||
* Validate parameters for magic functions
|
* Validate parameters for magic functions
|
||||||
* Synthesize TypeVar param and return types for lambdas where possible
|
* Synthesize TypeVar param and return types for lambdas where possible
|
||||||
|
@ -220,13 +220,13 @@ export class AnalyzerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._console.log(
|
|
||||||
`No venvPath specified. Falling back on PYTHONPATH:`);
|
|
||||||
const pythonPaths = PythonPathUtils.getPythonPathEnvironmentVariable();
|
const pythonPaths = PythonPathUtils.getPythonPathEnvironmentVariable();
|
||||||
if (pythonPaths.length === 0) {
|
if (pythonPaths.length === 0) {
|
||||||
this._console.log(
|
this._console.log(
|
||||||
` No valid paths found in PYTHONPATH environment variable.`);
|
`No venvPath specified, and no valid paths found in PYTHONPATH environment variable.`);
|
||||||
} else {
|
} else {
|
||||||
|
this._console.log(
|
||||||
|
`Using PYTHONPATH directories to resolve imports:`);
|
||||||
pythonPaths.forEach(path => {
|
pythonPaths.forEach(path => {
|
||||||
this._console.log(` ${ path }`);
|
this._console.log(` ${ path }`);
|
||||||
});
|
});
|
||||||
@ -324,7 +324,7 @@ export class AnalyzerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _updateTrackedFileList() {
|
private _updateTrackedFileList() {
|
||||||
this._console.log(`Finding source files`);
|
this._console.log(`Searching for source files`);
|
||||||
let fileList = this._getFileNamesFromFileSpecs();
|
let fileList = this._getFileNamesFromFileSpecs();
|
||||||
|
|
||||||
let fileDiagnostics = this._program.setTrackedFiles(fileList);
|
let fileDiagnostics = this._program.setTrackedFiles(fileList);
|
||||||
|
@ -46,6 +46,7 @@ export class TimingStat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TimingStats {
|
export class TimingStats {
|
||||||
|
totalDuration = new Duration();
|
||||||
findFilesTime = new TimingStat();
|
findFilesTime = new TimingStat();
|
||||||
readFileTime = new TimingStat();
|
readFileTime = new TimingStat();
|
||||||
tokenizeFileTime = new TimingStat();
|
tokenizeFileTime = new TimingStat();
|
||||||
@ -54,7 +55,11 @@ export class TimingStats {
|
|||||||
semanticAnalyzerTime = new TimingStat();
|
semanticAnalyzerTime = new TimingStat();
|
||||||
typeAnalyzerTime = 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('Find Source Files: ' + this.findFilesTime.printTime());
|
||||||
console.log('Read Source Files: ' + this.readFileTime.printTime());
|
console.log('Read Source Files: ' + this.readFileTime.printTime());
|
||||||
console.log('Tokenize: ' + this.tokenizeFileTime.printTime());
|
console.log('Tokenize: ' + this.tokenizeFileTime.printTime());
|
||||||
|
@ -93,11 +93,17 @@ function processArgs() {
|
|||||||
reportDiagnostics(results.diagnostics);
|
reportDiagnostics(results.diagnostics);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.timing !== undefined) {
|
if (!watch) {
|
||||||
timingStats.print(console);
|
// 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(
|
process.exit(
|
||||||
results.diagnostics.length > 0 ?
|
results.diagnostics.length > 0 ?
|
||||||
ExitStatus.DiagnosticsReported :
|
ExitStatus.DiagnosticsReported :
|
||||||
|
Loading…
Reference in New Issue
Block a user