Tab 与 Space 缩进(Dreamweaver 与 NetBeans)问题
我在工作中使用 Dreamweaver,在家里使用 NetBeans IDE,但在这两种情况下,项目都存储在 github 上。我的问题是,NetBeans 似乎正在构建由空格缩进的代码,并且当在 Dreamweaver 中打开或导出到 github 时,这里和那里的缩进会中断(意外地比预期移动得更远,反之亦然),尽管在 NetBeans 中再次打开时,会出现这样的情况:恢复正常。已经痛了一段时间了。对此有什么解决办法吗?
我应该说,我们在工作中(包括我在内)更喜欢制表符缩进。
I use Dreamweaver at work and NetBeans IDE at home, but in both cases project is stored at github. My problem is that NetBeans seems to be constructing code indenting out of spaces and when opened in dreamweaver or exported to github, indenting here and there breaks (moves unexpectedly further then it was intended or vice versa), although when opened again in NetBeans, goes back to normal. It has been pain for some time already. Is there any resolution to this?
I should say that we at work (and me including) prefer tab indenting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于 IDE 对 TAB 的定义。 IDE 中通常有一些选项可以使用 TAB 缩进,但将 TAB 转换为给定数量的空格。我通常使用 TAB 缩进,但让 IDE 将其变成 3 个空格。这意味着我(或其他人)使用什么来读取我的代码并不重要,索引总是相同的。
在 NetBeans 中,您需要查看代码编辑器选项,但我不知道在 Dreamweaver 中哪里可以找到这些设置。
It depends on the IDE's definition of a TAB. There are usually options within the IDE to indent using a TAB but turn the TAB into a given number of SPACES. I usually indent using TAB but have the IDE turn that into 3 SPACES. This means that it doesn't matter what I (or anyone else) use to read my code later the indets are always the same.
In NetBeans you need to look in the Code Editor options but I have no idea where to find the settings in Dreamweaver.
众所周知,应该使用双倍空格而不是制表符,因为不同的 IDE 定义制表符按钮的工作方式不同。
例如,emberjs 团队要求贡献者使用双倍空格而不是制表符格式化代码。
在没有 IDE 的情况下使用共同认可的东西是有意义的,这样在高度协作的编码团队环境中代码结构就不会成为问题。
但是,如果在 IDE 中启用选项卡工作方式的自定义,则在这种情况下,选项卡将节省大量时间 - 按两次按钮显然会花费 200% 的按一次按钮的时间:)
希望有帮助!
Its been known that one should use double space rather than tab, because that fact that different IDEs define how the tab button works DIFFERENTLY.
For example, emberjs team require contributor to use double-space rather than tab for formatting the code.
It make sense that to use something recognized in common without an IDE, so that the code structure will not be a problem in a highly collaborated coding team environment.
HOWEVER, if customization of how a tab works in an IDE is enabled, tab will be a great time saver in this case-- Press twice the button cost 200% of the time to press one obviously :)
Hope that helps!