【问题标题】:stop Eclipse inserting newlines before comments停止 Eclipse 在注释前插入换行符
【发布时间】:2015-05-02 04:03:50
【问题描述】:

这篇文章与 Aptana 插件和 PHP 的使用有关,但我发现 Java 和 Python 存在同样令人讨厌的行为。

当你有一些这样的行时:

// Database handling
var $hostname;  // note: xxx
var $user_name;     // note: yyy
var $pwd;   // note: zzz

你对文件进行自动格式化,它总是像这样结束:

// Database handling
var $hostname;
// note: xxx
var $user_name;
// note: yyy
var $pwd;
// note: zzz

... 在 Window -> Prefs -> Aptana -> Formatter -> (my created Profile) -> PHP -> Edit icon -> Comments 选项卡下,没有办法阻止这种烦人的换行插入发生。

有人知道解决方案/解决方法吗?

【问题讨论】:

  • 称你为变量 $hostname、$username 和 $password,所以你不需要解释。
  • "调用变量"... ?你的意思是? Zut alors。
  • 重命名它们,即 $pwd 到 $password
  • tu as quel âge ? Je veux savoir comment empêcher les sauts de lignes automatiques avant les commentaires... Si on ne sait pas comment résoudre le problème pose, mieux vaut se taire, non ?
  • 嗯,你想要一个解决方案或变通办法,所以我提出了一个变通办法,这也提高了你的代码质量。

标签: php eclipse comments aptana


【解决方案1】:

任何有兴趣的人,分号似乎是这里的罪魁祸首,这意味着这(不理想)将同时工作:

var $ext/* STUFF2 */;

顺便说一句,我也试过了

// @formatter:off
...
// @formatter:on: 

没有在“关闭”部分中的 cmets 之前停止自动换行符。很奇怪。

【讨论】:

    猜你喜欢
    • 2010-10-27
    • 2018-11-22
    • 1970-01-01
    • 2023-03-09
    • 2019-09-16
    • 1970-01-01
    • 2016-05-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多