Block code formatting in Coda 2 - coda

Despite the bad reviews, I've decided to splurge on Coda 2. There is a feature I can't seem to find though - code formatting on existing code.
In Sublimetext 2 you can highlight a block of code, and with a few key strokes, have it automatically format / indent. I don't see this in Coda 2. Does it exist?

You may need to use a plugin to accomplish it:
http://www.chipwreck.de/blog/software/coda-php/

Related

Vaadin 6 : RichTextArea and remove formatting

It's been a while that I've been reported about a problem on the software I'm on charge. I will try to explain it as much detailed as possible (Sorry if my english seems bad to you by the way ^^').
Context : The software has been developed as a Web Application (Java EE) + the framework Vaadin 6 (not 7). Since this project exists for about 4 or 5 years, the technology used isn't the newest but it's currently ok. This software is used by our internal clients so about a 70 users are using it per day. I'm on charge of this project for 9 months now.
Problem : Often, users copy some info (words, tables and so on) from others sources like a Word Document, or a PowerPoint. Then paste it into a RichTextArea. then they export all those info into an Excel (XLS) file. But sometimes, those pasted info aren't reported, or generate some HTML Tags (not understandable for most users).
What I had suggested : The RichTextArea has some tools, displayed with buttons, one of them is "Remove Formatting", if they press it, everything would be ok. But I had to agree with them, it isn't intuitive and "friendly" to use. Since they are my clients, I want to help them as much as possible.
What I want : I want that if they copy paste into the RichTextArea:
They should be invited to remove the format (with a notification on paste) by pressing the Remove Formatting Button, so I should valorize it.
Or automatically apply the remove formatting on paste.
But I couldn't achieve those solutions because I don't know how to detect the action of pasting, moreover, for the second solution, I couldn't retrieve on the code the remove formatting action.
Can you help me in order to achieve this please? Any tips that doesn't involve an other technology would be appreciated :)
Aynath
If this is still relevant:
Not sure about the first approach. But the first thing that comes to my mind is to use usual change event. When user will paste the new text, you will be notified that values were changed. Then use any tool to clean HTML and get the simple text (I suggest to use something like jsoup because it is the easiest thing). Or, if you need something specific implement your own parser/cleaner. The last thing is to simply set a new text to the current area value.
Otherwise, you can use Vaadin add-ons which may provide such information. Just look for add-ons repository for CKEditor or TinyMCE Editor

2 spaces indentation in google Docs

To prepare an exam, I have to learn coding using google docs rather than using an IDE. It may seem idiot or impratical but the teacher really insists on that. It seems that is the same thing as Google interviews for example...
So far, I really got used with using two spaces indentation (I hate using tab indendation). And I want to learn how can I do that quickly in Google docs. Is there a shortcut or a "tips" (add-on?) for that?
For example, if you have an "if-condition" starting at the position number 4 and you want to move to the following line, it can be really convenient to have the cursor position at 4. Then, you'll add two spaces to start your block at position number 6. (ALL the if block will have at least position 6). But in Docs, when you move to the following line, the cursor always start at the beginning of the line except if you use the tab indentation. And it's really shitting if you want to indent your code properly...
Do you have a solution for that please ?
I was facing the same problem.
To write Python code in google docs, my solution is:
Switch off auto-capitalization, auto-correction and smart quotes. And other auto-substitutions so that you may write code without docs like formatting.
To do this: Tools> Preferences and uncheck the above items. Screen shots attached below.
Set tab to two spaces.
Right-click on ruler on top of page. Add left-tab stop, an arrow will appear, move this tab stop to 2 spaces from left of ruler. Try adding tab in the current line and if the tab size is OK, save this formatting.
To save:
Format > Paragraph Styles > Normal Text > Update 'Normal Text' to match.
Last, to add color(synatx highlight), you may use 'code blocks extension'.
Click install.
Now, write code in docs, select the code in google doc, click on:
Add-ons > Code Block. A pop up opens up.
Choose language : 'python' for me.
Choose theme: 'atom-one-dark'
click Format.
The code looks much like IDE, and writing more code is easier too.
While I understand that sometimes a point can be made by making students do things in a way that might not seem logical, this one doesn't make any sense to me.
Students don't learn anything useful by pressing space twice instead of letting an editor or IDE do it for them.
I wonder, is it because he/she wants it delivered in Google Docs or because they want you coding that way? If it's the latter, you won't have to hide your workaround.
I can only suggest using a good text editor, I always use the excellent and free Notepad++, and copy and paste it to and from Google Docs. Your instructor will never know. In fact, I'd be hunting around to see of there was a way to access your code files directly in Google Docs from Notepad++, or to auto-sync a folder with Google docs.
Notepad++ has syntax colouring - which will save your life - and can be set to indent with tabs or spaces to whatever indent width you specify. If not using an IDE, I only use Notepad++.
Your instructor sounds like some I had, people who cross a line from being quirky but with a point to make to just being a dick. There is absolutely no point in telling a student to code only in Google docs. Google docs is a great thing, I love it, but it is by no stretch of the imagination a coding tool.
(I see that this is an aged thread, but I'll respond in case someone else with a similar issue - like this year's class for that course - comes looking for an answer.)
You could try (ab)using bulleted lists:
Insert a bulleted list
Right click on the bullet, select "More bullets..."
In the "Symbol" selection list, choose "Format & whitespace" and select one of the whitespace options as bullet char
Repeat for as many levels (of bullet sub-lists) as you think you may need in your program
Fix indentation to match whatever feels best for you
Every time you need to write a nested block, you will have to press "tab" only once, then bullet list level is kept and the indentation with it. To go back to the outer block, just press shift-tab.
However, IMHO it doesn't worth the trouble. Generally, interview question solutions are not that large and hitting spacebar a couple of times is not much of an overhead.
It's somewhat cumbersome but you can set as many tab stops as you want, and docs will move nested tabs to the next tab stop as well. For example:
You can add tab stops by right clicking on that tab bar where you want the tab stop to be and clicking Add left tab stop. You'll want to have all text in the document selected if you want the tab stop to apply everywhere.

Indent code in Dreamweaver

I've searched a lot for this and can't find how to Indent code in dreamweaver...
COMMAND-OPT+] - I've found this on google but it didn't work with me, I'm using a mac book air and to achieve ] I have to do alt+9 ( ] -> alt+9
I just want to indent automatically a bunch of code.. I know dreamweaver has automatic indenting but that just works when I'm writing code, but when I copy piece of code that are not indented like I do, ( I use tabs ), it doesn't indent them. I have to do it manually
Thanks
I typically use the formatting tool at http://www.freeformatter.com/html-formatter.html#ad-output. If you're using a copied block of code, you could format it with this tool and paste it accordingly into your existing code. An extra step, but well worth it in my experience.

MacVim/YADR Autocomplete Issue

I have installed MacVim, and https://github.com/skwp/dotfiles (including all the dependencies such as zsh, etc). and I am having trouble getting auto complete to work.
When I'm typing
<tit a pink box shows up with <title>Index</title> and according to the https://github.com/skwp/dotfiles documentation pressing tab will make it autocomplete. Which sometimes works, sometimes it just adds two spaces, however that's not really my question.
When it does auto complete it turns it into
<<title>Index</title>> notice the two < and >
How can I fix this?
Wow… 79 plugins? Really?
At a low level, your problem is that you give someone else too much power over your configuration, your toolset and your workflow.
At a higher level, you are probably misusing your config's auto-completion feature. I think that you have a conflict between the neocomplcache, delimitmate and snipmate plugins: the 1st deals with auto-completion, the 2nd automatically closes pairs of characters (<>,"",()…) while the 3rd does "tab-expansion" on the tit keyword.
Basically, I believe that you are supposed to type tit<Tab> instead of <tit<Tab> to avoid triggering delimitmate.

Tab behavior Resharper Intellisense Options

A product like Resharper has many settings, and I can't seem to find the right settings to get the exact behavior I desire from it.
The behavior I am trying to change is this:
Suppose the endresult I want is
but the line currently is
As you expect I start typing:
and after a tab I get this
but I wanted it to become
Does anyone know how I can change the Resharper settings in such a manner that my desired behavior is realized?
Thank you.
EDIT: Note that tab does perform the desired behavior in the default VS Intellisense.
In this particular case, here's what you should do:
Go to ReSharper > Options > Environment > IntelliSense > IntelliSense Behavior, and set Automatically insert parentheses after completion to Opening only.
Now, with the caret right before SomeMethod(), type in Math.Ab, and complete Abs with Enter, as correctly suggested by Rob H. You'll end up with Math.Abs(SomeMethod();
Finally, press Ctrl+Shift+Enter to invoke the Complete Statement, which in this case will insert the required parenthesis at the end of the statement, and put the caret on the next line.
Keep in mind though that this might not be the optimal solution provided that you probably have plenty of other usages of code completion that could conflict with this kind of settings change.
If that kind of similar code modification is required in multiple places, you should possibly create a search and replace pattern instead.
Hitting Enter instead of Tab will insert without overwriting, although you then end up with
Math.Abs()SomeMethod();

Resources