-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Extension is not activated with highlighted text and pressing ENTER #28
Comments
Good use case, good write up. Thanks for the issue! I specifically have the extension set to not run when there is text highlighted (see the I imagine most of the time spent on this issue will be trying to figure out what poor behaviors come from allowing it to run when text is highlighted, and how to mitigate them. |
Minor nitpick, shouldn't the desired behavior be my_dict = {'a': 1,
'b': 2}
# No trailing space and code is aligned instead of my_dict = {'a': 1,
'b': 2}
# No trailing space and code is aligned ? |
Yikes! That is NOT how it looked when I submitted or previewed it. Now when I go to edit it, I have to take off spaces and check the preview to make sure it's aligned. The two views are not the same! Very strange. I guess I'm going to have to double-check the post after posting too. |
I'm surprised you didn't document that. Your documentation is very thorough.
I can change that setting in my package.json for your extension and test it out and provide feedback. I think the reason my alignment for the code was off is because the font is not fixed-width. Any idea how to change that? It should be a GitHub setting now a browser one. |
OK after removing !editorHasSelection and !editorHasMultipleSelections from lines 32 and 37 of package.json, the space from the beginning of the selection on the first line to the end of the selection on the new line is still highlighted. The pipes and dots in between represent the highlighted section: my_dict = {'a': 1,|
..........|'b': 2} |
It turns out the selected text wasn't even being deleted (since the extension was now responsible for doing it). All that was needed was 4 lines of code at the beginning to delete the selection first. I submitted a pull request. |
This should now work correctly in version 1.1.0. Please upgrade and re-open if the issue persists. |
First off, thank you for putting in the time to create and share this nifty little tool!
I noticed the following minor inconsistency and I thought I would share it just in case it was important (personally I can live with it) or if the fix is simple (I'm guessing this may only require also registering the ENTER key for the extension when text is highlighted). At the very least, I suggest putting this in the Caveats section.
Minimal code example:
What the code looks like before pressing
enter
:What I want the code to look like after pressing
enter
:What the code actually looks like after pressing
enter
:Often times, we have to go back and change our code and sometimes we run up against linting line limits when we add to a line of code. We then have to choose a place to break the line into two lines. Invariably this logical break occurs at a separation point that involves a space. In order to avoid getting lint-bombed, we delete the space. I prefer to highlight the space and hit ENTER. I'm sure that there are a lot of keyboard-only people that will never encounter this and the alternative of course is to simply delete the space before or after hitting ENTER.
Environment (please complete the following information):
Python Indent
version: [e.g. 1.0.0]The text was updated successfully, but these errors were encountered: