-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding more feature coverages (#5165)
* more examples * using wrong overload * covers more features * covers more features * covered all editor features * added header
- Loading branch information
1 parent
ae32857
commit 479fdcb
Showing
22 changed files
with
373 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pytest | ||
zope.event |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# you can trigger diagnostics using `View: Focus Problems` | ||
# use `command palette` to find the command and its short cut | ||
# but that said, it will be automatically triggered and show up as squiggles in editor | ||
# or colored number in file explorer or entries in problems tab. | ||
|
||
# import error | ||
import unknownModule | ||
|
||
# unknown identifier | ||
unknownIdentifier | ||
|
||
# syntax error | ||
:"" | ||
|
||
# type error | ||
# if you hover your mouse on the error, you should be able to execute code action | ||
# associated with the error explicitly. it can be done from problem tab as well by | ||
# hovering icon on the entry in problem tab. | ||
a: int = "Hello" | ||
|
||
|
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,27 @@ | ||
# you can trigger document highlight using `Trigger Symbol Highlight` | ||
# use `command palette` to find the command and its short cut | ||
# but that said, it will automatically run if you put cursor on top | ||
# of supported symbol | ||
|
||
# place cursor on `variable` and confirm all `variable` referenced in the document | ||
# is highlighted | ||
from typing import Literal | ||
|
||
|
||
variable = "Hello" | ||
|
||
print(variable) | ||
|
||
# place cursor on `ch` and confirm the same | ||
for ch in variable: | ||
print(ch) | ||
|
||
|
||
# place cursor on `ConstructorHR` and confirm all references are highlighted | ||
class ConstructorHR: | ||
# place cursor on `__init__` and confirm all references of object creation are highlighted | ||
def __init__(self): | ||
pass | ||
|
||
def foo(i: ConstructorHR) -> ConstructorHR: | ||
return ConstructorHR() |
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,21 @@ | ||
# you can trigger document symbol using `Explorer: Focus on Outline View` | ||
# or `Go to Symbol in Editor ...` commands | ||
# use `command palette` to find the command and its short cut | ||
|
||
# confirm the `OUTLINE` view shows symbol hierarchy of the code view | ||
# click entries in the view to make sure correct symbols are highlighted | ||
# and double click to jump to the code | ||
|
||
# confirm the `Go to symbol in Editor` also works as expected | ||
class A: | ||
def __init__(self, v: int): | ||
self.v = v | ||
|
||
def getValue(self) -> int: | ||
return self.v | ||
|
||
|
||
def createA(v: int) -> A: | ||
return A(v) | ||
|
||
aInstance = createA(10) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# you can trigger format on type by hitting enter at the end of statement | ||
|
||
# place cursor after `:` and hit enter and confirm cursor is placed | ||
# at the expected indentation | ||
for a in range(10): | ||
|
||
__break_for_statement_ # its here so that code after this is not recognized as body of the for statement. | ||
|
||
# place cursor after `"a"` and hit enter | ||
ch = "a" | ||
|
||
# place cursor after `ch:` and hit enter | ||
match ch: | ||
# place cursor after `:` and hit enter | ||
case "a": | ||
|
||
__break_for_case_ # its here so that code after this is not recognized as body of the case statement. | ||
|
||
|
||
if ch == "a": | ||
pass | ||
# type `:` after `else` and see `else` is moved to right position. | ||
else |
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,18 @@ | ||
# you can trigger go to declaration using `Go To Declaration` command | ||
# use `command palette` to find the command and its short cut | ||
# one can also use right click menu to issue the command | ||
from typing import Mapping | ||
|
||
|
||
|
||
# place cursor on `==` and issue go to decl command | ||
# it should go to pyi file. | ||
a = 1 == 1 | ||
|
||
# place curosr on "os" and issue go to decl command | ||
# it should go to pyi file. | ||
b = "os" | ||
|
||
# place curosr on "Mapping" and issue go to decl command | ||
# it should go to pyi file instead of py file. | ||
c: Mapping |
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,19 @@ | ||
# you can trigger go to definition using `Go To Definition` command | ||
# use `command palette` to find the command and its short cut | ||
# one can also use right click menu to issue the command | ||
from typing import Mapping | ||
|
||
|
||
class ClassWithMagicMethod: | ||
def __lt__(self, v: int) -> bool: | ||
return True | ||
|
||
|
||
# place cursor on `<` and issue go to def command | ||
a = ClassWithMagicMethod() < 1 | ||
|
||
# place curosr on "os" and issue go to def command | ||
b = "os" | ||
|
||
# place curosr on "Mapping" and issue go to def command | ||
c: Mapping |
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,21 @@ | ||
# you can trigger go to type definition using `Go To Type Definition` command | ||
# use `command palette` to find the command and its short cut | ||
# one can also use right click menu to issue the command | ||
|
||
myVariable: int = 1 | ||
|
||
|
||
# place cursor on `myVariable` and run go to type def | ||
# confirm it goes to the type of the expression (`int` decl in builtin), | ||
# not the variable `myVariable` itself (myVariable: int = 1) | ||
print(myVariable) | ||
|
||
|
||
class MyType: | ||
name: str | ||
|
||
a = MyType() | ||
|
||
# place cursor on `name` and run go to type def | ||
# confirm it goes to the type of the member (`str` decl in builtin) | ||
a.name |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# you can trigger inlay hint by opening a python file | ||
|
||
from io import FileIO | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
# confirm inlay return type | ||
def method(a: int, b: str, /, c: Path, *, d: Optional[FileIO] = None): | ||
return a | ||
|
||
# confirm inlay variable type and call arguments | ||
var = method(10, "hello", Path("path"), d=None) |
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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
from zipfile import Path | ||
|
||
from requests import ConnectTimeout | ||
|
||
|
||
class MyType: | ||
pass | ||
def method(self, v: Path) -> ConnectTimeout: | ||
raise Exception("Hello") |
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 @@ | ||
# shadowing stdlib mailbox module |
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,16 @@ | ||
# you can trigger selection range using `Expand/Shrink Selection` | ||
# use `command palette` to find the command and its short cut | ||
from typing import Literal | ||
|
||
|
||
def foo(ch: Literal["a", "b", "c"]): | ||
match ch: | ||
case "a": | ||
pass | ||
case "b": | ||
for i in range(10): | ||
# place cursor at `print` and issue `Expand Selection` | ||
# repeat the command and confirm the selection is expanded as expected | ||
print(f"{ch}{i}") | ||
case "c": | ||
pass |
Oops, something went wrong.