如何更改 Eclipse 以在 Javascript 编辑器中使用空格而不是制表符?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8993295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:36:24  来源:igfitidea点击:

How do I change Eclipse to use spaces instead of tabs in Javascript editor?

javascripteclipseeclipse-pluginjslint

提问by Damen TheSifter

I use the Eclipse JavaScript plugin, I have my text editor settings to "insert spaces as tabs" this works fine until I select a block of code and tab it or shift tab it, run JSLint and AARGghh! "Mixed spaces and tabs." is there something I am missing, is this possible?

我使用 Eclipse JavaScript 插件,我将文本编辑器设置为“将空格作为制表符插入”,这可以正常工作,直到我选择一个代码块并使用 Tab 键或切换 Tab 键,运行 JSLint 和 AARGghh!“混合空格和制表符。” 有什么我想念的吗,这可能吗?

回答by Hauke Ingmar Schmidt

I am not exactly sure where you set the editor property "insert spaces as tabs". To set the tab policy you need to go to Window > Preferences > Javascript > Code Style > Formatter, create a new profile, edit it and set the Tab policy to "spaces only". Now when using the tab key spaces are inserted.

我不确定您在哪里设置编辑器属性“将空格插入为制表符”。要设置您需要转到的选项卡策略Window > Preferences > Javascript > Code Style > Formatter,创建一个新的配置文件,编辑它并将选项卡策略设置为“仅限空格”。现在当使用tab键时会插入空格。