MagicStack / MagicStack/MagicPython
[Bug] Class method 'self' looses special self scope with added type annotation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
Got send here from 'vscode-python' https://github.com/microsoft/vscode-python/issues/11593
* **Editor name and version**: VS Code version: 1.44.2
* **Platform**: Windows_NT x64 10.0.17134
* **Color scheme**: Custom (close to Monokai)
* **MagicPython version**: Dunno which vscode uses
Without type annotation everything is just fine.

When a type annotation is added to the `self` parameter the special scope for `self` is missing.

## Steps to reproduce:
Paste the following code into a *.py file and inspect the `self` parameter with the developer token inspect tool. Like in the screenshots above.
The `self` parameter of the `bad_func` should show the actual scopes and the `self` parameter of the `good_func` should show the expected scopes.
```
class Test:
def bad_func(self: Test):
pass
def good_func(self):
pass
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduced Python snippet and inspect the token scopes for the annotated and unannotated self parameters using the developer token inspect tool. Trace the syntax-highlighting path that handles class method parameters; done means self: Test retains the same special self scopes as unannotated self.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100