Commit Graph

1720 Commits

Author SHA1 Message Date
Jake Bailey
80355e6756
Upgrade to Prettier 2.0, reformat (#610) 2020-04-07 17:18:22 -07:00
Eric Traut
d4f3f2f96c Did some cleanup in prep for next round of changes: Renamed vfs.ts to fileSystem.ts and VirtualFileSystem to FileSystem for consistency and clarity. Added more comments. Removed extraneous "event" parameter from createFileSystemWatcher interface. 2020-04-05 11:47:42 -07:00
Eric Traut
aae44cbdb3 Added "reportGeneralTypeIssues" setting, which is set to "error" by default. Users can optionally change it to "warning" or "none". 2020-04-01 22:48:24 -07:00
Eric Traut
bb02a52dc3 Fixed broken test case. 2020-04-01 22:46:34 -07:00
Eric Traut
99d5e11b75 Fixed a few more cases where we were using single quotes rather than double quotes in user-visible strings. 2020-04-01 22:00:32 -07:00
Jake Bailey
cc0b9b2ddb
Add contextual signature help, handle configuration events as fa… (#597) 2020-03-30 12:56:27 -07:00
Eric Traut
33b049d2a7 Published 1.1.30 2020-03-29 22:04:40 -07:00
Eric Traut
253ed9683e Fixed broken unit test. 2020-03-29 21:21:13 -07:00
Eric Traut
c451a39c97 Added code to hover provider to print the constructor input parameters for a class that is being instantiated. 2020-03-29 21:16:03 -07:00
Eric Traut
9bf8c52f7d Changed printType to not include "Unknown" input parameter types when printing a function that has no type annotations. 2020-03-29 21:15:26 -07:00
Eric Traut
e3c28837e0 Added new "hasDeclaredType" field to FunctionParameter interface to track whether a parameter has an explicitly declared type. 2020-03-29 21:14:32 -07:00
Eric Traut
2369f96ddd Updated dependencies to latest versions. 2020-03-29 20:12:55 -07:00
Eric Traut
81f4bff4e8 Normalized all diagnostic messages to use the same terminology, tense, and quote symbol. 2020-03-29 15:32:26 -07:00
Eric Traut
f1c3b9b2a4 Dramatically sped up analysis in cases where there are deep call chains that require inference because type annotations are not provided. The optimization involves further scoping the use of "speculative" mode to only those portions of the parse tree that need to be evaluated speculatively. This allows type information to be cached for nodes outside of the speculative subtree. 2020-03-28 23:20:13 -07:00
Eric Traut
9c0bc6e0e7 Improved perf of type evaluator by reducing use of "speculative mode" where types are not cached and diagnostics are suppressed. Introduced a new mode where only diagnostics are suppressed but types are still cached. Also changed argument-matching logic to avoid inferring return types when attempting to determine which overload function should be used; this was generating a bunch of unnecessary work. 2020-03-28 23:05:34 -07:00
Eric Traut
7ea154e497 Added checks for disallowed usage of Final as specified in PEP 591. 2020-03-28 13:11:19 -07:00
Eric Traut
11c70a483e Added more helpful error message for missing __enter__ method if there is an __aenter__ method present. 2020-03-28 12:35:02 -07:00
Eric Traut
93c4d66383 Fixed formatting issue. 2020-03-28 00:59:18 -07:00
Eric Traut
8131011d6f Removed unused method in sourceFile and eliminated a source of unnecessary reanalysis. 2020-03-28 00:58:15 -07:00
Eric Traut
c912f3270d Fixed bug where Any or Unknown type incorrectly resulted in an "is not valid iterable" error. 2020-03-27 21:55:35 -07:00
Eric Traut
12787c3a87 Added support for built-in "__dict__" symbol within module. 2020-03-27 21:54:38 -07:00
Eric Traut
a95a5131c3 Fixed another bug related to classes that derive from an unknown type. 2020-03-27 21:18:50 -07:00
Eric Traut
530c642826 Fixed regression in previous check-in. 2020-03-26 19:45:14 -07:00
Eric Traut
ef8c08e0c7 Changed class-member lookup logic to better handle the case where one of the base classes is unknown. It previously stopped when it encountered an unknown base class. Now it scans all known base classes first. 2020-03-26 19:39:49 -07:00
Eric Traut
0c69bef31f Improved perf by creating a new speculative context only when needed. 2020-03-25 19:49:23 -07:00
Eric Traut
ff3df8d133 Added a global cancellation check throttle. We now call the file system at most once every 5ms. This provides good responsiveness without impacting performance too much. 2020-03-25 18:13:34 -07:00
Eric Traut
a6a9a2780c Fixed handling of Tuple[()], which should be interpreted as a zero-element tuple according to PEP 483. Fixed assignment compatibility check for zero-element tuples. 2020-03-25 17:13:56 -07:00
Eric Traut
c9704c58cd Fixed unit test that was recently broken by a change. 2020-03-25 09:40:01 -07:00
Eric Traut
6483970a7b Fixed bug that caused forward-referenced type annotations within data class definitions to be reported as "unbound" even if the "annotations" futures flag was enabled. 2020-03-25 09:34:16 -07:00
Eric Traut
91a01c420c Reduced the "user activity backoff time" from 1000ms to 500ms. That means we'll run the analyzer after just half a second of inactivity, providing the user with faster diagnostic feedback when they stop typing. 2020-03-24 21:28:53 -07:00
Eric Traut
b44a7e8dd5 Added code to diagnostic sink to detect and prevent redundant diagnostics. We previously relied on the type cache to prevent redundant diagnostics within a file, but we now support cancellation and type cache overflow detection, so it's possible for the type cache to be cleared at any time. 2020-03-24 21:28:03 -07:00
Eric Traut
fa31c7d260 Fixed recent regression that caused all non-opened files in the program to be included in the diagnostic report if "checkOnlyOpenFiles" was enabled. 2020-03-24 21:26:35 -07:00
Heejae Chang
b559b7ce89
added cancellation support and more tests. (#583)
cancellation support is added through vscode-languageserver's new cancellation strategy API.

more tests on hover and completion.
2020-03-24 20:04:49 -07:00
Heejae Chang
81bfc73697
added completion test coverage (#579) 2020-03-24 11:11:33 -07:00
Eric Traut
17d7df157d Published 1.1.29 2020-03-23 21:52:20 -07:00
Eric Traut
2cb40ade2c Replaced type cache mechanism with one that's more robust.
Fixed bug in TypeVar matching logic for functions when a later parameter's generic type influenced the type of an earlier parameter. This situation requires multiple passes to resolve all type variables properly.
2020-03-23 21:25:40 -07:00
Eric Traut
6acfd77200 Added cancellation support to the type evaluator using the same technique as in the TypeScript compliler. Updated the program module to properly handle cancellation during invocation of the type evaluator. Removed cancellation from parse and bind calls; these are very fast, and it's not worth adding the complexity of cancellation to them. 2020-03-22 14:56:32 -07:00
Eric Traut
2ba0f63cf1 Added additional diagnostic context for type var assignments so it's clear whether the type var is invariant, covariant, or contravariant. 2020-03-22 10:32:33 -07:00
Eric Traut
6b2a5941ea Fixed recent regression that caused a crash when using the "find references" or "rename symbol" features. 2020-03-21 21:17:45 -07:00
Eric Traut
7ae0d93829 Fixed a few more bugs found with manual testing and code review. 2020-03-21 00:02:51 -06:00
Eric Traut
911e42c91c Fixed a few bugs in logic that determines whether to report diagnostics for a given source file. Diagnostics were previously suppressed for type stubs found in the "typings" directory but should not have been. Diagnostics were also suppressed for local source files that are imported by included files. And diagnostics were not properly added or cleared when a file was opened and the "openFilesOnly" setting was in effect. 2020-03-20 23:30:28 -06:00
Eric Traut
589ba8f7a1 Fixed several bugs in the logic that handles type matching of functions. It wasn't properly taking into account name-only and position-only markers in parameter lists. 2020-03-20 22:28:20 -06:00
Heejae Chang
4b194b0431
added auto venv detection, LS extension points, auto detection on library changes and more tests added. (#574)
auto venv detection makes sure pyright automatically exlude virtual environment from user codes
LS extension points lets plug in such as intellicode to extend what shows up in completion list
auto detection on library let pyright to refresh automatically when new packages are installed/removed.

more test coverage on code fix, new features and etc
2020-03-20 12:17:25 -07:00
Eric Traut
8faf8e2da2 Fixed name of function in analyzerServiceExecutor to match coding style. 2020-03-20 12:44:48 -06:00
Eric Traut
0501d89ee3 Updated dependencies to work around reported vulnerability. 2020-03-20 10:06:08 -06:00
Eric Traut
0993fe7a4c Hid type arguments and type parameters when printing types related to pseudo-generic classes. Since these type parameters are internally synthesized, they are confusing for users to see. 2020-03-20 10:00:20 -06:00
Eric Traut
5e1e2c759a Published 1.1.28 2020-03-17 22:41:55 -06:00
Eric Traut
d29087520b When a class contains an __init__ method whose input parameters are not annotated, generate a "pseudo-generic" class parameterized by the types of the init method's input parameters. This allows call-site specialization of the class, which provides better type checking and type completion suggestions. 2020-03-17 18:06:59 -06:00
Eric Traut
5f719d49e6 Added support for the multi-parameter form of the built-in "type" call. 2020-03-17 14:24:42 -06:00
Eric Traut
0ab9caf39a Fixed bug in parser where a single-element tuple atom used as a subscript index was handled incorrectly. 2020-03-17 13:01:16 -06:00