Skip to content
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

Use with other commands in macros(vs code extension) #45

Closed
ghost opened this issue Oct 21, 2019 · 7 comments
Closed

Use with other commands in macros(vs code extension) #45

ghost opened this issue Oct 21, 2019 · 7 comments
Labels
enhancement New feature or request extension compatibility Compatibility with another extension is broken. pull requests welcome PRs will be reviewed, but maintainers will not fix.

Comments

@ghost
Copy link

ghost commented Oct 21, 2019

I used to use Shift+Enter to insert a newline after current line, but the newline still has same indent with previous line, even the previous line is a Return Statement. So I want to use this indent etension to solve it. My idea is use macros and config the order like that:

"macros": {
        "insertLineAfterWithAutoIndent": [
             "cursorEnd",
             "pythonIndent.newlineAndIndent",
         ]
}

and bind this command with keyboard shortcuts Shift+Enter, but the result is not satisfied. It executes "pythonIndent.newlineAndIndent" firstly, and then executes "cursorEnd", I don't know why order is changed and want know whether this idea can be realize.

@ghost ghost added the indentation label Oct 21, 2019
@kbrose
Copy link
Owner

kbrose commented Oct 22, 2019

I've edited your issue text. If you wrap the text in triple back-ticks, then it will preserve your indentation:

```
{
  x
}
```

More instructions: https://guides.github.com/features/mastering-markdown/

@kbrose
Copy link
Owner

kbrose commented Oct 22, 2019

@zhongjimeiying I don't think macros are built into VSCode. What are you using to create macros?

Edit: just realized you said it was an extension. This seems like more of a problem with the macros extension, right?

@kbrose kbrose added extension compatibility Compatibility with another extension is broken. and removed indentation labels Oct 22, 2019
@ghost
Copy link
Author

ghost commented Oct 23, 2019

@kbrose I think so. If your extension provide the the command -- {1.move cursor to line end 2.execute this extension script}, and bind it to shortcuts {Shift+Enter}, will be more useful.

@kbrose
Copy link
Owner

kbrose commented Oct 24, 2019

If this is a problem with the macros library, then I encourage you to also open an issue there.


Shift+Enter is already a widely used shortcut to run the selected python code in the terminal. I'm not comfortable overwriting that shortcut by default.

However, I would review a Pull Request that adds an additional command pythonIndent.cursorEndAndNewLineAndIndent (with tests) which does the actions you list, and then you could set your own keyboard shortcut to activate that command.

I want to be clear that I won't probably will not add this feature myself any time soon.

@kbrose kbrose added enhancement New feature or request pull requests welcome PRs will be reviewed, but maintainers will not fix. labels Oct 24, 2019
@ghost
Copy link
Author

ghost commented Oct 24, 2019

@kbrose ok, thank you.

@ghost
Copy link
Author

ghost commented Oct 24, 2019

According to your words, I find the solution. That's a problem of macros extension indeed by viewing its issues. And I found another extension -- ctf0.macros, and it work fine with your pythonIndent.newlineAndIndent. Thank you again.

@kbrose
Copy link
Owner

kbrose commented Oct 24, 2019

I’m glad you were able to find a solution that works for you!

@kbrose kbrose closed this as completed Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extension compatibility Compatibility with another extension is broken. pull requests welcome PRs will be reviewed, but maintainers will not fix.
Projects
None yet
Development

No branches or pull requests

1 participant