Is there a way to copy code from the Eclipse IDE without the rich-text formatting? - eclipse

Recently every time I copy a block of code from Eclipse and paste the code into TextEdit or a online forum using the code tags, I get the code with the rich-text or html formatting, so I have to copy into a text editor remove the formatting copying and pasting again, In the past this was not a problem I used to copy from eclipse and paste the code without any formatting at all just as plain-text, I dont know if I turn on a property or what I did for this to happen, any ideas how to fix this?

There is an Eclipse bug filed for this that can be voted for:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=45969
It has been open for 10 years though!
There are applications out there that think they can handle rich text but can't. So for those it looks like we'll have to carry on with "Copy-Switch to Notepad-Paste-Select All-Copy-Switch to final app-Paste" for some time yet.

Note: the rich formatting from a SWT editor seems to have always been available (bug 64498).
You could use "Edit, Paste and Match Style" in TextEdit.
From the Edit menu, choose Paste and Match Style,
or use the keyboard shortcut, Shift Option Command V.
The pasted text will pick up all the formatting from the character to the left of the flashing insertion point. This technique works in Mail as well.

Related

Format only pasted code segment in VSCode, not entire document

Is there a way to do so? I find a lot of my time is taken up correcting indentation formatting in VSCode after pasting, because it seems to sometimes take the source indenting and apply it at the destination (so the entire pasted code block is at the wrong indent level) or worse, just mess up indents entirely (no idea what's going on here) and I need to manually fix every line.
Example use case, for single PHP files which contain PHP, HTML, and Javascript, I often only want the pasted Javascript block to format nicely. Turning on "paste on format" will format the entire document, often times making the PHP sections awkwardly arranged.
I know that VSCode has "format on paste" in settings, but this formats the entire document. How can I format only the pasted code? Is this even possible?
Thank you
I am not certain whether you're fine with this roundabout solution, but you can format selection with Ctrl+K Ctrl+F (see official vscode site for more detail). So rather than turning on format on paste you can paste and then reselect it and do the shortcut above.
If you're not satisfied with this method, you can try using a vscode extension that was given here under a somewhat similar copy and paste problem

VSCode Comments aren't inline

I use VSCode and I think its a great editor, but when I write a comment in html it drops to a new line under what I'm commenting which is really irritating.
If I comment a closing div I want it next to the closing div not under it.
I have uninstalled prettier but that made no difference.
Is what I want even possible in VSCode?
Any advise would be appreciated because I am so irritated that I am considering using a different editor (I'm on a Mac just in case it matters).
Thanks in advance.
This was a problem for me too, as were other new line / white space related HTML issues.
Assuming you are not using any formatters besides the native VSCode HTML language features (you said you uninstalled prettier, but you didn't mention whether you were using something else),
there is a setting HTML white space which you can set to preserve to leave your comments untouched.
Note that you may need to go into settings and check what is being used as the HTML default formatter

How to stop FlashDevelop suggestions in text files

I'm using FlashDevelop 4.6.1.30 in Windows, using it with HaxeFlixel.
The autocomplete suggestions appear when editing code - this is wanted, it is good.
They also appear when editing text files though - this is not wanted, it is not good.
Specifically, if I create a new text file in flash develop (so the file is called "readme.txt" or something), after typing a few words, FD tries to "guess" what I'm typing and pops up the suggestions list. This, of course, makes no sense when trying to type out things that aren't code.
Yes, I've seen this Flashdevelop - Disable autocomplete for txt files and no, it doesn't work - even after a restart.
Here is a screenshot showing it not working...
Can confirm, setting that option doesn't prevent completion in .txt files. Consider opening an issue on the FlashDevelop repository.
Looks like a bug.
For now you can simply disable the BasicCompletion plugin (check Disable and restart FlashDevelop).

Cut and paste from eclipse into MS word appears as large blue blob

This has been bothering me for years. Every time I cut a block of code from a java file in eclipse and paste into a word document, the text just appears as a big block of text. Does anyone know of a way to fix this?
This mostly happens with single line copying. Try copying by including the white-space from the above/bottom line.
Try pasting your code into a basic text editor first, like notepad; it should get rid of any attributes that are coming from where you cut from.
EDIT
See http://office.microsoft.com/en-us/word-help/control-the-formatting-when-you-paste-text-HA010215708.aspx and look for the "Keep Text Only" option.
This is well known problem. It is registered as a Eclipse bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=86503
Unfortunately, for today, this problem is not solved.

View nicely formatted version of HTML source

I need to edit this HTML page and re-upload it.
The problem is that somehow all of the newlines have been eliminated from it so that its just one long line. I'm using Notepad++ now, although I don't have to be.
What is a good way to view and edit this HTML/PHP/Javascript source in a way that a reasonable human being can read it?
Thanks!
You can tidy this up (as #AR suggested) with notepad++. Go into Notepad++, go to the plugin manager and select
textFX and install that.
among other things, it will install a new menu item in the toolbar called "textFX"
select it, then select Text Fx HTML Tidy. This will give you a selection of formatting objects and ought to pretty it up for you.
once again:
TextFx >> TextFx HTML Tidy