-
Couldn't load subscription status.
- Fork 36
#86 - Adds enclosing ranges to function and class definitions #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3b19ffd
#86 - Updates scip declaration file to contain enclosing_range
Titou325 abf978e
#86 - Adds basic support for enclosing ranges on functions and classes
Titou325 4bcc0b9
#86 - Adds enclosing range output to formatSnapshot helper function
Titou325 e0a3d30
#86 - Adds single, simple test case for enclosing ranges
Titou325 487edae
#86 - Splits test cases for enclosing_range
Titou325 0ca44f5
#86 - Adds support for format-options in snapshot inputs
Titou325 f358b1a
#86 - Adds enclosing markers
Titou325 d9afbfc
#86 - Updates test snapshots
Titou325 f2b752f
Cleans up unnecessary comments
Titou325 69986a3
Simplified enclosing ranges logic
Titou325 60f9416
Updates caret styling to point left if the line character is before t…
Titou325 d10cd4c
Refactors options parsing into its own function
Titou325 ec2fdbb
Reformats TODO
Titou325 13e503a
Switches to decl.node inside isDefinition switch
Titou325 9236748
chore: Update snapshots
varungandhi-src 8d361a0
Merge pull request #1 from sourcegraph/feature-86
Titou325 5fb6852
Fixes duplicate declarations for classes
Titou325 68bdbd0
chore: Update snapshots
varungandhi-src File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
packages/pyright-scip/snapshots/input/enclosing_range_class/advanced.py
This file contains hidden or 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,13 @@ | ||
| # format-options: showRanges | ||
| def class_decorator(cls): | ||
| def wrapper(*args, **kwargs): | ||
| return cls(*args, **kwargs) | ||
| return wrapper | ||
|
|
||
| @class_decorator | ||
| class Test: | ||
| def __init__(self, x: float): | ||
| self.x = x | ||
|
|
||
| def test(self) -> float: | ||
| return self.x |
3 changes: 3 additions & 0 deletions
3
packages/pyright-scip/snapshots/input/enclosing_range_class/simple.py
This file contains hidden or 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 @@ | ||
| # format-options: showRanges | ||
| class Test(): | ||
| pass |
11 changes: 11 additions & 0 deletions
11
packages/pyright-scip/snapshots/input/enclosing_range_function/advanced.py
This file contains hidden or 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,11 @@ | ||
| # format-options: showRanges | ||
| def decorator(func): | ||
| def wrapper(*args, **kwargs): | ||
| return func(*args, **kwargs) | ||
| return wrapper | ||
|
|
||
| @decorator | ||
| def func(x: float) -> float: | ||
| test = x | ||
|
|
||
| return test |
3 changes: 3 additions & 0 deletions
3
packages/pyright-scip/snapshots/input/enclosing_range_function/simple.py
This file contains hidden or 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 @@ | ||
| # format-options: showRanges | ||
| def simple(x): | ||
| return x |
50 changes: 50 additions & 0 deletions
50
packages/pyright-scip/snapshots/output/enclosing_range_class/advanced.py
This file contains hidden or 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,50 @@ | ||
| # < definition scip-python python snapshot-util 0.1 advanced/__init__: | ||
|
|
||
| # format-options: showRanges | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). | ||
| def class_decorator(cls): | ||
| # ^^^^^^^^^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator(). | ||
| # ^^^ definition snapshot-util 0.1 advanced/class_decorator().(cls) | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper(). | ||
| def wrapper(*args, **kwargs): | ||
| # ^^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper(). | ||
| # ^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper().(args) | ||
| # ^^^^^^ definition snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) | ||
| return cls(*args, **kwargs) | ||
| # ^^^ reference snapshot-util 0.1 advanced/class_decorator().(cls) | ||
| # ^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(args) | ||
| # ^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper().(kwargs) | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator().wrapper(). | ||
| return wrapper | ||
| # ^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator().wrapper(). | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/class_decorator(). | ||
|
|
||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test# | ||
| @class_decorator | ||
| #^^^^^^^^^^^^^^^ reference snapshot-util 0.1 advanced/class_decorator(). | ||
| class Test: | ||
| # ^^^^ definition snapshot-util 0.1 advanced/Test# | ||
| # ^^^^ definition snapshot-util 0.1 advanced/Test# | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). | ||
| def __init__(self, x: float): | ||
| # ^^^^^^^^ definition snapshot-util 0.1 advanced/Test#__init__(). | ||
| # ^^^^ definition snapshot-util 0.1 advanced/Test#__init__().(self) | ||
| # ^ definition snapshot-util 0.1 advanced/Test#__init__().(x) | ||
| # ^^^^^ reference python-stdlib 3.11 builtins/float# | ||
| self.x = x | ||
| # ^^^^ reference snapshot-util 0.1 advanced/Test#__init__().(self) | ||
| # ^ definition snapshot-util 0.1 advanced/Test#x. | ||
| # ^ reference snapshot-util 0.1 advanced/Test#__init__().(x) | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#__init__(). | ||
|
|
||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). | ||
| def test(self) -> float: | ||
| # ^^^^ definition snapshot-util 0.1 advanced/Test#test(). | ||
| # ^^^^ definition snapshot-util 0.1 advanced/Test#test().(self) | ||
| # ^^^^^ reference python-stdlib 3.11 builtins/float# | ||
| return self.x | ||
| # ^^^^ reference snapshot-util 0.1 advanced/Test#test().(self) | ||
| # ^ reference snapshot-util 0.1 advanced/Test#x. | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test#test(). | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/Test# | ||
|
|
||
10 changes: 10 additions & 0 deletions
10
packages/pyright-scip/snapshots/output/enclosing_range_class/simple.py
This file contains hidden or 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,10 @@ | ||
| # < definition scip-python python snapshot-util 0.1 simple/__init__: | ||
|
|
||
| # format-options: showRanges | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 simple/Test# | ||
| class Test(): | ||
| # ^^^^ definition snapshot-util 0.1 simple/Test# | ||
| # ^^^^ definition snapshot-util 0.1 simple/Test# | ||
| pass | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 simple/Test# | ||
|
|
37 changes: 37 additions & 0 deletions
37
packages/pyright-scip/snapshots/output/enclosing_range_function/advanced.py
This file contains hidden or 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 @@ | ||
| # < definition scip-python python snapshot-util 0.1 advanced/__init__: | ||
|
|
||
| # format-options: showRanges | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). | ||
| def decorator(func): | ||
| # ^^^^^^^^^ definition snapshot-util 0.1 advanced/decorator(). | ||
| # ^^^^ definition snapshot-util 0.1 advanced/decorator().(func) | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper(). | ||
| def wrapper(*args, **kwargs): | ||
| # ^^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper(). | ||
| # ^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper().(args) | ||
| # ^^^^^^ definition snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) | ||
| return func(*args, **kwargs) | ||
| # ^^^^ reference snapshot-util 0.1 advanced/decorator().(func) | ||
| # ^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(args) | ||
| # ^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper().(kwargs) | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator().wrapper(). | ||
| return wrapper | ||
| # ^^^^^^^ reference snapshot-util 0.1 advanced/decorator().wrapper(). | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/decorator(). | ||
|
|
||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 advanced/func(). | ||
| @decorator | ||
| #^^^^^^^^^ reference snapshot-util 0.1 advanced/decorator(). | ||
| def func(x: float) -> float: | ||
| # ^^^^ definition snapshot-util 0.1 advanced/func(). | ||
| # ^ definition snapshot-util 0.1 advanced/func().(x) | ||
| # ^^^^^ reference python-stdlib 3.11 builtins/float# | ||
| # ^^^^^ reference python-stdlib 3.11 builtins/float# | ||
| test = x | ||
| # ^^^^ definition local 0 | ||
| # ^ reference snapshot-util 0.1 advanced/func().(x) | ||
|
|
||
| return test | ||
| # ^^^^ reference local 0 | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 advanced/func(). | ||
|
|
11 changes: 11 additions & 0 deletions
11
packages/pyright-scip/snapshots/output/enclosing_range_function/simple.py
This file contains hidden or 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,11 @@ | ||
| # < definition scip-python python snapshot-util 0.1 simple/__init__: | ||
|
|
||
| # format-options: showRanges | ||
| # ⌄ start enclosing_range scip-python python snapshot-util 0.1 simple/simple(). | ||
| def simple(x): | ||
| # ^^^^^^ definition snapshot-util 0.1 simple/simple(). | ||
| # ^ definition snapshot-util 0.1 simple/simple().(x) | ||
| return x | ||
| # ^ reference snapshot-util 0.1 simple/simple().(x) | ||
| # ⌃ end enclosing_range scip-python python snapshot-util 0.1 simple/simple(). | ||
|
|
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.