-
Notifications
You must be signed in to change notification settings - Fork 68
Conversation
ptvsd/wrapper.py
Outdated
single_underscore.append(var) | ||
else: | ||
variables.append(var) | ||
variables = variables + single_underscore + double_underscore + dunder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're at it, can you also do sorted()
on variables? Then this will completely fix microsoft/PTVS#2865
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or rather sorted()
on every component individually, since we still want to preserve the category order.
@int19h I used |
ptvsd/wrapper.py
Outdated
double_underscore.sort(key=get_sort_key) | ||
dunder.sort(key=get_sort_key) | ||
|
||
variables = variables + single_underscore + double_underscore + dunder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move all of this into a separate class to track and sort the variables.
If tomorrow we need to sort private variables or member variables, we need to modify this method again, when logic of sorting the list should be outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stuff or sorting and tracking variables should be in its own class, something that can be easily unit tested in isolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll need unit tests for this sorting rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will move this to a class before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
ptvsd/wrapper.py
Outdated
single_underscore = [] # variables that begin with underscores | ||
double_underscore = [] # variables that begin with two underscores | ||
dunder = [] # variables that begin and end with double underscores | ||
variables = VariablesSorter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #165
Fixes #116