为什么设施发布代码如此糟糕? [英] Why is the facility to post code so bad?

查看:75
本文介绍了为什么设施发布代码如此糟糕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一封公开信...

[这是我在
一般办公室发展论坛
]。

在这组论坛上,经常需要编写源代码来传达问题或解决方案。使用普通文本(此段落的类型)时,回车后会出现长空间问题;您在
Visual Studio中看到的颜色不足;可怕的'插入代码块'功能旨在克服这些问题。并且可怕的缩进。

It is frequently necessary, on this set of forums, to write source code to communicate an issue or solution. When using normal text (the type of this paragraph) you have the problem of long spaces after a carriage return; lack of color as you would see in Visual Studio; and terrible indenting.

但是,插入代码块存在许多持久性问题。每个定期使用这些论坛的人都会知道它们,但总结一下:

Presumably the 'Insert Code Block' feature was designed to overcome these issues. However, there are a number of persistent issues with inserting code blocks. Everyone who uses these forums regularly will know them, but to summarize:


  • 虽然尝试着色文本与IDE一样,但算法很糟糕。它似乎不是语言特定的;无论我是编写C#,Visual Basic还是C ++,常规代码最终都是注释 - 绿色,注释通常是字符串红色,紫色有时是因为没有可识别的原因而添加
    (参见
    here
  • 一旦代码块被删除插入后,它们不容易编辑。我通常会把它复制到剪贴板,删除它,插入一个新的代码块,然后粘贴,只是添加一行。如果你想在代码块之后插入普通文本,
    并且没想到在
    之前添加后缀回车符(或其他文本)你去插入代码块,你必须删除代码块并重新创建它,因为你不能将插入符号放在文本编辑器末尾的代码块下面。
  • 双回车有时会丢失,特别是从Visual Studio复制和粘贴时(请参阅

    在这里
    ,三分之二的下降)。这尤其使得难以阅读长段。当尝试手动添加它们时,我发现它只允许添加双回车。
  • 缩进是不允许的,否则可行。键入代码块时,无法使用选项卡按钮/字符。但是,您可以粘贴使用了Tab键/字符的文本。
  • 用于代码块的字体具有不同宽度的字符。这可能是此列表中最不重要的一点,但我认为它将作为Visual Studio受益;它可以更容易地直观地比较命令,尤其是字符串。
    在代码块编辑器中没有选项可以更改为等宽字体,但是您可以粘贴等宽字体。
  • Though an attempt is made at coloring text as with an IDE, the algorithm is terrible. It doesn't seem to be language specific; whether I write C#, Visual Basic or C++, regular code ends up comment-green, comments are often string-red, purple is sometimes added for no identifiable reason (see here).
  • Once code blocks have been inserted, they are not easily editable. I usually resort to copying it to the clipboard, deleting it, inserting a new code block, and then pasting, just to add a single line. If you want to insert normal text after the code block, and did not think to add a suffixing carriage return (or other text) before you went to insert the code block, you have to delete the code block and re-create it, because you can't place the caret below a code block that lies at the end of the text editor.
  • Double carriage returns are sometimes lost, particularly when copying and pasting from Visual Studio (see here, two thirds of the way down). This particularly makes it difficult to read long segments. When trying to add them back manually, I found it would only allow adding a double-carriage return.
  • Indentation is not allowable or else workable. When typing the code block, the tab button/character cannot be used. However you can paste in text where the tab button/character has been used.
  • The font used for code blocks has characters of different widths. This is probably the least consequential point on this list, but I think it would benefit from being as Visual Studio; it makes it easier to visually compare commands and especially strings. There is no option to change to a monospaced font when in the code block editor, however you can paste in a monospaced font.

我也经历过以下两个问题。然而,尽管看起来,我还没有找到任何例子,这让我觉得它们可能已经被解决了:

I have also experienced the following two issues. However, despite looking, I have not been able to find any examples, which makes me think they may have already been resolved:


  • 代码经常延伸到右边一侧的帖子,偶尔会偏离屏幕的一侧。可能这与浏览器有所不同,但我在IE和Firefox上体验过它。我不得不将文本复制并粘贴到文本编辑器中以便能够阅读。
  • 我认为特别是在Firefox上,如果有水平滚动条,代码块的最后一行是完全隐藏的。同样,要查看它,有必要从网页上复制它并将其粘贴到文本编辑器中。

由于使用代码进行解释非常重要,并且经常使用,这些论坛上的工具,我认为以上内容值得妥善解决。我觉得微软这个世界领先的软件公司应该做得更好。

Since explaining with code is such an important, and often used, tool on these forums, I think the above is worth being properly addressed. I feel that Microsoft, world leading software company, ought to do better.

Joe Fox

推荐答案

"插入代码块"的代码功能是第三方工具,微软似乎无法控制它。我确信着色会随着时间的推移而发生变化。着色确实有缺陷(错误),有几个人有b $ b抱怨它。我已经看到了代码在屏幕右侧运行的示例,但我认为当人们在编辑器中粘贴代码而不使用"插入代码块"时会发生这种情况。当您使用"插入代码块"时,长行会导致滚动条到
避免自动换行。有些人不喜欢这样。有时,滚动条会遮挡代码的最后一行(即使只有一行)。但是,这是显示回复的论坛代码中的缺陷。如果你等待,同样的回复将在稍后
显示代码的所有行。行为来来去去,并不是每个人都能看到问题。我的理论是,有时我会从服务器上获得错误的代码。

The code for the "Insert Code Block" feature is a third party tool, and Microsoft seems to have little control over it. I'm convinced the colorization has changed over time. The colorization definitely has flaws (bugs), and several people have complained about it. I have seen examples of code running off the right side of the screen, but I think it happens when people paste code in the editor without using "Insert Code Block". When you use "Insert Code Block", long lines result in a scroll bar to avoid word wrapping. Some people do not like this. Occasionlly, the scroll bar will obscure the last line of code (even if there is only one line). However, this is a flaw in the forum code that displays the reply. If you wait, the same reply will later show all lines of the code. The behavior comes and goes, and not everyone sees the problem. My theory is that sometimes I get bad code from a server.

我的解决方案是不使用"插入代码块"。功能,但要使用"插入HTML"按钮。我使用脚本将我的所有代码转换为HTML,并完成着色,然后将其粘贴到带有"插入HTML"的回复中。如果我编辑代码,
我在HTML编辑器中执行此操作。这样我得到一个固定宽度的字体(对我来说很重要),所有间距和缩进都得到维护,我得到了我想要的颜色。这取决于我确保长行不会换行。但是,对于任何人来说,这不是一个可行的选择
else。

My solution has been to not use the "Insert Code Block" feature, but to use the "Insert HTML" button. I use scripts to convert all of my code into HTML, complete with colorization, and paste it in a reply with "Insert HTML". If I edit the code, I do it in the HTML editor. This way I get a fixed-width font (important to me), all spacing and indenting is maintained, and I get the colorization I want. It's up to me to make sure long lines do not wrap. However, this is not a viable option for anyone else.


这篇关于为什么设施发布代码如此糟糕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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