如何更改RAD Studio(2010及更高版本)IDE格式的代码? [英] How do I change the way the RAD Studio (2010 and later) IDE formats my code?

查看:406
本文介绍了如何更改RAD Studio(2010及更高版本)IDE格式的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用格式来源开始在同一行或下一行配置RAD Studio IDE来格式化我的代码, / code>选项?

How do I configure the RAD Studio IDE to format my code with begin on either the same or next line when I use the Format Source option?

最常讨论的首选项之一是 begin - 的位置同一行或一行自己。在Delphi XE2中,如何将Delphi格式化为一行或另一行的 begin 格式化源代码?这是指当你去编辑> 格式来源

One of the most commonly debated preferences is the position of begin - on the same line or a line of its own. How do you set Delphi to format your source with begin on one line or the other in Delphi XE2? This is referring to when you go to Edit > Format Source

推荐答案

我正在回答这个问题Q& A风格。

I am answering this question Q&A style.


  1. 转到工具> 选项

  2. 找到 Formatter 部分在左侧的树中

  3. 在该节点内,选择 Delphi > 换行符

  4. 找到标有

  5. 在这里,找到标记为

  6. 将此设置切换到取决于您的偏好。

  1. Go to Tools > Options
  2. Find the Formatter section in the tree on the left
  3. Inside that node, select Delphi > Line Breaks
  4. Locate the section on the right labeled Insert line breaks for Begin and Single instructions
  5. Inside here, find the setting labeled Line breaks before Begin in control statements
  6. Switch this setting between Yes or No depending on your preference.

将产生:

if (Foo = Bar) then
begin

end;

将产生:

if (Foo = Bar) then begin

end;

默认情况下,此设置设置为是格式来源时,它将始终将 begin 导入下一行。

By default, this setting is set to Yes which means when you use Format Source, it will always bring begin to the next line.

本节中有很多设置可以定义 Format Source 将如何处理您的代码。该选项至少在RAD Studio 2010及以上版本中可用。不确定哪些确切的版本。

There are many settings in this section which can define how Format Source will treat your code. This option is available in at least RAD Studio 2010 and above. Not sure of which exact editions.

注意: Ctrl + D 是格式化源代码的键盘快捷方式,也是一种更快捷的选择。

Note: Ctrl + D is a keyboard shortcut to format your source, a quicker alternative.

这篇关于如何更改RAD Studio(2010及更高版本)IDE格式的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆