Code snippet control indentation
See original GitHub issueHow can I control unindentation in code snippets?
{
"Create migration helper execute statement": {
"prefix": "mhe",
"body": [
"\\$helper->execute(<<<SQL",
"\t$0",
"\rSQL",
");"
]
}
}
When invoking it in indented context:
class Migration {
→ public function up(Helper $helper) {
→ → mhe<tab complete snippet>
→ }
}
Expected behavior:
class Migration {
→ public function up(Helper $helper) {
→ → $helper->execute(<<<SQL
→ → → |<cursor>
SQL
→ → );
→ }
}
Actual behavior:
class Migration {
→ public function up(Helper $helper) {
→ → $helper->execute(<<<SQL
→ → → |<cursor>
→ →
→ → SQL
→ → );
→ }
}
This is invalid behavior when using heredoc.
I tried to insert \r
<carriage return> to try removing all indentation,
but it is just translated to a newline and indented according to snippet context.
- VSCode Version: 1.9.0
- OS Version: macOS Sierra
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:15 (4 by maintainers)
Top Results From Across the Web
How to indent/format a selection of code in Visual Studio Code?
I want to indent a specific section of code in Visual Studio Code: Select the lines you want to indent, and; use Ctrl...
Read more >Code Blocks and Indentation | Flow of Control in Python
To indicate a block of code in Python, you must indent each line of the block by the same amount. The two blocks...
Read more >Snippets wrong indentation - Visual Studio Feedback
The example add personal snippets to Code Snippet Manager of Visual Studio. The snippets can be invoked by shortcut or with menu (CTRL+K,...
Read more >Copy with proper indentation - Visual Studio Blog
You want to share some code you've written with a colleague, so you select it in the editor and hit Ctrl + C...
Read more >Indentation style - Wikipedia
Especially, it is used to clarify the link between control flow constructs such as conditions or loops, and code contained within and outside...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any update for current case?
@thetrompf Well… my bug report was closed in reference to this issue. See #76139