富文本帮助注释代码? [英] Would rich-text help comment code?

查看:155
本文介绍了富文本帮助注释代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是想知道为什么我必须在文本编辑器中编写富文本代码注释(伪代码)(c'mon,bold,underline!)并返回IDE(集成?



因此,问题是,如果IDE允许富文本代码注释,如果写入实际的程序,更不要说确保这些文档留在代码附近。 会帮助任何人吗?或许您可以强调强调重要点,并使用标题和子标题,让阴暗画面更清楚明了吗?



(是啊,我知道我们可以用*重要的点*和****** HEADER ******来管理,但是让我想想一下吧!

$

解决方案 / div>

这是一个有趣的问题,因为除了它现在是否是一个好主意之外,它推动了我们工作方式的边界。



不是混合丰富的文本和代码的所有原因都没有解决这是否会帮助任何人的问题 - 是否还有一个补偿如果没有人问过这类问题并发明了网络,我们可能仍然在使用gopher。



对于源代码注释,一些富文本功能将比其他更有用:




  • 超链接当然是有用的,因为代码文档经常需要引用文档位于代码之外,以及代码中其他位置的文档链接,以避免重复。

  • 图片会很有用,因为在很多情况下,敏感的代码文档是一个图 - 有些人使用UML,例如

  • 列表将是有用的 - 例如,这个列表更容易阅读富文本版本(即HTML]比Markdown源

  • 字体格式不太重要 - 粗体和斜体偶尔用于强调和文本更加可读如果代码片段a variableName )在格式不同时更容易阅读;不同的颜色很少有意义

  • 标题通常不会有用,因为如果代码注释太长,需要标题来引入结构,



讽刺的是,当您在Stack上发布丰富的文本注释时,溢出 - 你必须诉诸于富文本是有时的参数。



即使在简短的评论中,富文本也是有用的,当您看不到格式化的版本时,源代码保持敏感。因此,或许一个很好的折衷方案是让IDE将Markdown注释块作为丰富文本显示,并在光标位置在注释块中时显示Markdown源。


I always wondered why I have to write rich-text code comments a.k.a. pseudo code in a text editor (c'mon, bold, underline!) and come back to the IDE (integrated?) to write the actual program, not to mention ensuring these documents stay near the code.

So the question is, What if IDEs allowed rich-text code comments. Would it help anyone? Maybe make the murky picture clearer to understand considering you can emphasize or stress on important points and use headers and sub-headers?

(yeah, I know we can manage with *important point* and ****** HEADER ****** but lets think out-of-the-box for a moment!

I'm talking about an RTF Code Editor, integrated within IDEs.

解决方案

This is an interesting question, because aside from whether it is actually a good idea right now, it pushes the boundaries of the way we work.

All of the reasons for not mixing rich text and code do not address of the question of whether this would help anyone - whether there is also an up-side that compensates for the disadvantages. Perhaps we would all still be using gopher if no-one had asked this kind of question and invented the web.

As for source code comments, some rich-text features would be more useful than others:

  • hyperlinks would certainly be useful since code documentation frequently needs to refer to documentation that lives outside the code, as well as links to documentation elsewhere in the code to avoid duplication
  • images would be useful because there are many cases when the most sensible code documentation is a diagram - some people do use UML, for example
  • lists would be useful - this list, for example, is easier to read in its rich text version (i.e. the HTML) than the Markdown source
  • font-formatting is less important - bold and italics are occasionally useful for emphasis and text is more readable if code fragments (e.g. a variableName) are easier to read when formatted differently; different colours make little sense
  • headings would not usually be useful, because if a code comment is so long that it needs headings to introduce structure, it should probably be outside the code.

Ironically, it is harder to argue against rich text comments in code, when you are posting rich text comments on Stack Overflow - you have to resort to the argument that rich text is okay 'sometimes'.

Even in short comments here, rich text turns out to be useful, and the Markdown source remains sensible when you do not see the formatted version. So perhaps a good compromise would be for an IDE to render Markdown comment blocks as rich text, and show the Markdown source as soon as the cursor position is in the comment block.

这篇关于富文本帮助注释代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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