forked from microsoft/pyright
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from microbit-foundation/improve-errors
Improve common student error messages Add a new simplified message bundle with simplified text of error message after review with the education team. In simplified mode, types aren't referenced in common messages as students in our scenarios are best focussed on docs and examples to fix their errors. New messages: - booleanIsLowercase special-cases "true" and "false" in name errors as forgetting to uppercase is common - expectedEqualityOperator adds a new case for `if a = b` scenarios Code-level tweaks to existing messages: - add module names to importSymbolUnknown and moduleUnknownMember (potentially upstreamable)
- Loading branch information
Showing
9 changed files
with
158 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/pyright-internal/src/localization/simplified.nls.en-us.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"Diagnostic": { | ||
"argAssignmentParam": "Argument does not match parameter type for parameter \"{paramName}\"", | ||
"argAssignmentParamFunction": "Argument does not match parameter type for parameter \"{paramName}\"", | ||
"argMissingForParam": "Argument missing for parameter {name}", | ||
"argMissingForParams": "Arguments missing for parameters {names}", | ||
"argMorePositionalExpectedCount": "Expected {expected} more positional arguments", | ||
"booleanIsLowerCase": "\"{name}\" is not defined, did you mean \"{booleanName}\"?", | ||
"breakOutsideLoop": "\"break\" can be used only within a loop", | ||
"continueOutsideLoop": "\"continue\" can be used only within a loop", | ||
"expectedAssignRightHandExpr": "Expected expression to the right of \"=\"", | ||
"expectedCloseBrace": "Missing closing bracket \"}\"", | ||
"expectedCloseBracket": "Missing closing bracket \"]\"", | ||
"expectedCloseParen": "Missing closing bracket \")\"", | ||
"expectedColon": "Missing colon \":\"", | ||
"expectedEqualityOperator": "Expected equality operator, did you mean \"==\"?", | ||
"expectedExpr": "Missing expression", | ||
"expectedFunctionName": "Missing function name after \"def\"", | ||
"expectedIndentedBlock": "Indentation missing", | ||
"expectedNewlineOrSemicolon": "Unexpected extra content\nStatements must be one per line", | ||
"importResolveFailure": "Module \"{importName}\" could not be found", | ||
"importSymbolUnknown": "\"{name}\" not found in module \"{moduleName}\"", | ||
"inconsistentIndent": "Indentation does not match the previous line", | ||
"moduleUnknownMember": "\"{name}\" is not a known member of module \"{module}\"", | ||
"stringUnterminated": "String is not closed — missing quotation mark", | ||
"typeNotIterable": "Type is not iterable", | ||
"typeNotSupportBinaryOperator": "Operator \"{operator}\" not supported for this combination of types", | ||
"typeNotSupportBinaryOperatorBidirectional": "Operator \"{operator}\" not supported for this combination of types", | ||
"unaccessedClass": "Class \"{name}\" is unused", | ||
"unaccessedFunction": "Function \"{name}\" is unused", | ||
"unaccessedImport": "Import \"{name}\" is unused", | ||
"unaccessedSymbol": "\"{name}\" is unused", | ||
"unaccessedVariable": "Variable \"{name}\" is unused", | ||
"unexpectedIndent": "Unexpected indentation", | ||
"unreachableCode": "Code is unreachable\nThe logic of your program means this code will never run" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/pyright-internal/src/tests/samples/suiteExpectedColon4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a = 1 | ||
if a = 1: | ||
pass |
3 changes: 3 additions & 0 deletions
3
packages/pyright-internal/src/tests/samples/suiteExpectedColon5.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a = 1 | ||
if a == 1 | ||
pass |