native (the default) uses VS Code's built-in pasting method. Use this setting to change how pasted text is actually inserted into the document. For example,, , etc all start with, , etc). When determining whether a line of code is an ending block or not, we strip out all whitespace, and we only check that the line begins that way. Whenever you paste code above an ending block, the code will be indented one level deeper (so it sits inside that block). Use this setting to change what ending blocks we look for. Just paste like normal! No need to change keybindings or anything. Run code -install-extension gazugafan.vscode-indent-on-paste.Click the extensions tab or press cmd+shift+x.Click the Install button, then the Enable button.Press cmd+p to open the Quick Open dialog.Ctrl+V, Edit > Paste, Right Click > Paste. So, after installing it should just work-no matter how you paste. Instead, it hijacks VS Code's native paste command. Closing braces are easier to detect in a universal language-agnostic way, and this lets me indent the pasted code accordingly.įinally, this extension doesn't rely on remapping the Ctrl+V keybinding. This extension looks for something resembling a "closing block" on the line following the target location (things like closing braces, closing tags, and PHP template endif's). I also wanted to clean up the re-indentation algorithm. This extension takes a different approach by modifying the clipboard contents before it is pasted (and then immediately restores the original clipboard contents aftewards). This seems to have led to some weird bugs where bits of code are left selected after pasting. Rubymaniac's extension is awesome, but it selects and reformats code after it has been pasted in. This was inspired by, but completely separate from Paste and Indent by Rubymaniac. Attempts to re-indent code before it is pasted, using some generalized indentation rules.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |