Open alexwall opened 10 years ago
That is strange. I tested a few cut&paste from other text editors (TextWrangler) and it went ok every time. So not really sure what is going on here. Perhaps something to do with tabs versus spaces, but even then I would expect some indentation.
Does inserting this code snippet in something else (like TextEdit) goes ok, so is it only CATS that shows this behaviour?
On 23 Aug 2014, at 20:12, alexwall notifications@github.com wrote:
Hi,
I use Dash (like TextExpander) to insert common code snippets. The insert is technical a paste command. This is fine for single lines, but when I (Dash) paste a code block the inserted lines starts a the beginning of each new line.
Here an example:
if(isTrue) { // try to trigger the snippet here if(x){ // this is the first line of my snippet content doSomething(); // line without indent doMore(); // line without indent } // line without indent, end of my snippet content } Is it possible to bring cats to add indents? Maybe by checking if the pasted code contains \n.
— Reply to this email directly or view it on GitHub.
I tried BBedit, TextMate (1.5) and Chocolat
BBedit don't insert (smart) indents. But it has a column paste Ctrl+CMD+V, which only works for manually pasted code blocks.
TexteMate works correct: It adds necessary level of indent, depends on my current position inside the code (plus the indent from my snippets)
Chocolat works best way: It adds necessary level of indent and removes potential unnecessary indents, if my code snippet has wrong code format. It works like:
There is actually a feature called getFormattingEditsOnPaste (that is for TypeScript files). I guess worthwhile to check that out and see if that could implement the smart-indent on paste feature.
However I also noticed that the current regular formatText option has already some some issues with comments being wrongly formatted, so I guess first to determine what is going on there before implementing that feature.
Hi,
I use Dash (like TextExpander) to insert common code snippets. The insert is technical a paste command. This is fine for single lines, but when I (Dash) paste a code block the inserted lines starts a the beginning of each new line.
Here an example:
Is it possible to bring cats to add indents? Maybe by checking if the pasted code contains \n.