indentation

Specify options for a filter in ruby HAML

和自甴很熟 提交于 2019-12-05 05:59:33
Is there any way to add options (HTML attributes) to HAML filters? I wanted to do something like this : :javascript{:'data-turbolinks-eval' => 'false', :foo => 'bar'} if(someCondition){ doSomething(); } And the result would be : <script 'data-turbolinks-eval'='false' 'foo'='bar'> if(someCondition){ doSomething(); } </script> The closest I could get is : %script{:'data-turbolinks-eval' => 'false', :foo => 'bar'} if(someCondition){ doSomething(); } The drawback is that you can't indent your JS in HAML unless you're using the :javascript filter. It's ok for a few lines, but it can get messy

Broken indentation for Qt-specific constructions in Visual Studio

て烟熏妆下的殇ゞ 提交于 2019-12-05 05:02:17
Automatic indentation in VS editor obviously does not know about Qt. And declarations of signals and slots are auto-formatted like this: class MyClass : public QObject { Q_OBJECT public: MyClass(); signals: // <-- Broken indentation void someSignal(); public slots: // <-- Also broken void someSlot(); }; I want "signals:" and "slots:" automatically formatted just like access specifiers. What are the options? (I'm using VS2010) In short answer seems to be NO. Maybe not what you are looking for but maybe you can live with this: class MyClass : public QObject { Q_OBJECT public: MyClass(); private:

Parsing an indentation based language using scala parser combinators

江枫思渺然 提交于 2019-12-05 04:30:41
Is there a convenient way to use Scala's parser combinators to parse languages where indentation is significant? (e.g. Python) Let's assume we have a very simple language where this is a valid program block inside the block and we want to parse this into a List[String] with each line inside the block as one String . We first define a method that takes a minimum indentation level and returns a parser for a line with that indentation level. def line(minIndent:Int):Parser[String] = repN(minIndent + 1,"\\s".r) ~ ".*".r ^^ {case s ~ r => s.mkString + r} Then we define a block with a minimum

Show Indent Guide Lines In Xcode

*爱你&永不变心* 提交于 2019-12-05 04:18:26
Coming from a background using Visual Studio and Notepad++ I'm used to the indent guides which help to visually enhance sections of code where the curly braces are used, Xcode (No indent guides) Visual Studio (Nice tidy indent guides) As you can see from the images above sometimes there are sections of code where multiple levels of curly braces are open and it gets messy without any indent guides. Are there any options or plugins that will allow xcode to display the indent guides in between sections of code? Like the VS2010 sample? Xcode doesn't have this feature (not that I'm aware of) , but

Vim: Use tabs for indentation, spaces for alignment with C source files

本小妞迷上赌 提交于 2019-12-05 04:16:20
Does anybody have her vim setup in a way that uses hard tabs as indentation characters, but does use spaces for alignment? The problem I have is that when starting a continuation line like in if (condition1 && (anotherlongcondition || /* <-- Here I insert a newline */ |-------|------- whatever /* some additional alignment added automatically */ , then cin (which is a must for me) adds some alignment just the way I prefer positionally , but this alignment is created using as much hard tabs as possible and filling the rest with spaces (as I tried to visualize). So, in short, cin doesn't really

Adaptive tabbing in vim

早过忘川 提交于 2019-12-05 04:09:51
I happen to work on code in which some modules use tabs for indentation while others use spaces. Many text editors such as Np++ has some sort of an adaptive tabbing feature, which use spaces for indentation if the previous line (or block of code) use spaces, or tabs as the case may be. I haven't seen anything in vim like this. Is there any such plugin or setting for this? I perfer to set my enviroment up like the below example demonstrates. I make a general rule of replacing tabs with spaces and use augroup when I need to override that rule. Makefiles are a good example of when you may require

How to automatically indent the JavaScript code in Aptana Studio?

筅森魡賤 提交于 2019-12-05 03:19:20
Previously I used Eclipse for PHP and Java development, and I liked the command Ctrl + i to automatically indent the code. Now am I using Aptana Studio that is based on Eclipse, for JavaScript development. I would like to automatically indent my JavaScript code, but Ctrl + i deletes all my code. Is there any other command that automatically indent JavaScript code in Aptana Studio? The Studio does not have this feature yet. You can add a feature request here: https://aptana.lighthouseapp.com/projects/35272-studio/tickets/new Ctrl+Shift+F will format your entire file, as Tim suggested. You can

php: auto indent the whole code?

烈酒焚心 提交于 2019-12-05 03:08:17
isnt there any software/plugin to netbeans/eclipse that auto indent the whole code after i've inserted it? not just indent when i press ENTER for new function. i want to paste in a code for example without indents and it will auto indent everything automatically since it can recognize what language is used. should save a lot of time. In Zend Studio (and I guess in Eclipse with PDT as well), you can right click your pasted document in the editor view and select Source Format . Rules for source formatting are edited in Windows Preferences PHP Code Style Formatter . You can select Code

PHP correct indentation?

别说谁变了你拦得住时间么 提交于 2019-12-05 02:31:14
I'm a beginner PHP coder, recently I've been told I indent my code not correctly. They say this is wrong: if($something) { do_something(); } else { something_more(); and_more(); } While this is right? if($something) { do_something(); } else { something_more(); and_more(); } Really? I am willing to become opensource coder in nearest future so that's why I'm asking how to write code in a good way. Both ways will run just fine. Whichever is more comfortable for you and your team would be the way to go. I personally favor the second example, or something alone these lines: if ($something) { do

Indenting SQL in another major mode in Emacs

假如想象 提交于 2019-12-05 02:08:55
问题 Oftentimes I'm writing some script to do some stuff, often involving SQL, in a different major mode. Maybe it looks like this: sql = """ SELECT * FROM table WHERE row_awesomeness > 1000 """ I'd like to be able to indent the SQL propertly, so it looks something like: sql = """ SELECT * FROM table WHERE row_awesomeness > 1000 """ I'm not picky about the SQL indentation algorithm used, but I can't get anything to work at all. I'm not a huge fan of sql-indent.el, but I can't even get that to work