code-formatting

Per-token font size in Sublime Text 2

六眼飞鱼酱① 提交于 2019-11-28 00:26:10
Apologies if this has already been answered but I couldn't find any duplicates. Is it possible to set font sizes on a per-token basis in Sublime Text 2? For example, all 'function' tokens would be size 10 whereas 'functionName' would be size 30? I've put together a rough mock-up of what I want to achieve: The motivation here is to make it easier for you to focus on the important parts of your code - especially when skimming. I would suspect that such a thing should be possible given that, by default, ST2 already applies different fonts to different tokens (e.g. 'var' vs. 'c = a;' in switchVars

Best source code formatter for Javascript? [closed]

吃可爱长大的小学妹 提交于 2019-11-27 22:56:29
I've been digging through Stack Overflow as well as a number of Google searches, and I cannot find a satisfactory code formatter for Javascript. I have found several related tools, such as syntax highlighters and pretty-printers, but I am looking for a tool that I can ideally create a wrapper for in Eclipse and simply run from the menu bar. Hence, if any Java-based ones are available, that is a big plus. Free and/or open-source is preferred as well. I am looking for something that my development group can use to maintain a consistent code style. Thanks. [EDIT] Thank you for the incredibly fast

How do I configure autoformatting in Eclipse?

坚强是说给别人听的谎言 提交于 2019-11-27 22:09:26
问题 I dislike how auto format messes up empty cycle body, like: Before for (int i = 0; isTest(i); i++); After for (int i = 0; isTest(i); i++) ; How to configure eclipse not to do this? 回答1: Go to Windows -> Preferences , and in the options table select Java -> Code Style -> Formatter , then configure to your hearts content. For future reference, in the Preferences menu you can just type in a search term to find all options for that term - so just going onto the Preferences menu and typing "format

Windows batch command to ignore case sensitivity in variables

走远了吗. 提交于 2019-11-27 21:59:05
问题 I have a set of variables I allow some people I work with to edit. These are True ( T ) and False ( F ) values, but I have some people that insist on putting t and f instead of the upper case values respectively. I use the following workaround code to properly set uppercase values: IF '%dotnet35%'=='f' set dotnet35=F IF '%dotnet35%'=='t' set dotnet35=T IF '%dotnet40%'=='f' set dotnet40=F IF '%dotnet40%'=='t' set dotnet40=T IF '%regedit%'=='f' set regedit=F IF '%regedit%'=='t' set regedit=T IF

Sorting methods in Eclipse

只谈情不闲聊 提交于 2019-11-27 20:59:38
Is there an easy way to sort methods within a class in Eclipse? marcgg select the class, Source > Sort Members you can set the order in Java preferences via Eclipe forums Carl Manaster Found it on the Eclipse newsgroup : select the class, Source > Sort Members 来源: https://stackoverflow.com/questions/854232/sorting-methods-in-eclipse

How to generate an Eclipse formatter configuration from a checkstyle configuration?

纵饮孤独 提交于 2019-11-27 19:38:20
I have a checkstyle configuration XML file and want to automatically generate an Eclipse formatter configuration from this. Is there any tool that can do this? Paul In Eclipse (3.6): Install Checkstyle plug-in Import stylesheet using Windows --> Preferences, General --> Checkstyle --> New. Since you have an external file, choose "external file" as the type. Right-click on your project in the Package view and select Checkstyle --> Create Formatter-Profile. Then enable the formatter for your workspace: Windows --> Preferences --> Java --> Code Style --> Formatter. Select formatter: "eclipse-cs

Why might my Emacs use spaces instead of tabs?

こ雲淡風輕ζ 提交于 2019-11-27 19:26:52
问题 I am trying to diagnose this problem. TAB creates 4 spaces instead of a 4 col TAB like I want. But I don't think it should because C-h v indent-tabs-mode on the buffer in question says it is set to t . When I check my keybindings, TAB is set to c-indent-line-or-region . Does this function ignore my tabs-mode? 回答1: Tabs and indentation in Emacs is a considerably more complex subject than most people anticipate. I highly recommend spending some time reading about it -- it will almost certainly

Ruby indented multiline strings [duplicate]

泪湿孤枕 提交于 2019-11-27 17:57:10
问题 This question already has answers here : How do I remove leading whitespace chars from Ruby HEREDOC? (11 answers) Closed 3 years ago . It's a best-practice question. There are obvious ways to do that, none of them just seem quite right. Quite often I need to test that some multi-line string gets produced. This normally breaks indentation making everything look like a mess: class TestHelloWorld < Test::Unit::TestCase def test_hello assert_equal <<EOS, hello_world Hello, world! World greets you

Eclipse: Can you format code on save?

一个人想着一个人 提交于 2019-11-27 17:13:51
In Eclipse, under Windows -> Preference -> Java -> Code Style , you can define code templates for comments and code, and you can setup a code formatter. I'm wondering if it is possible in Eclipse to have these setting take affect every time I save a source file. Basically, instead of me highlighting everything and pressing Ctrl + Shift + F , I want Eclipse to be responsible for making sure my code is formatted properly. Is this possible and how do you set it up? Note On Using the Auto-Format: It's probably best to choose "Format Edited Lines" as merging changes becomes very difficult when you

Ruby: Can I write multi-line string with no concatenation?

泄露秘密 提交于 2019-11-27 16:37:37
Is there a way to make this look a little better? conn.exec 'select attr1, attr2, attr3, attr4, attr5, attr6, attr7 ' + 'from table1, table2, table3, etc, etc, etc, etc, etc, ' + 'where etc etc etc etc etc etc etc etc etc etc etc etc etc' Like, is there a way to imply concatenation? There are pieces to this answer that helped me get what I needed (easy multi-line concatenation WITHOUT extra whitespace), but since none of the actual answers had it, I'm compiling them here: str = 'this is a multi-line string'\ ' using implicit concatenation'\ ' to prevent spare \n\'s' => "this is a multi-line