在我从吉特拉布(Gitlab

发布于 2025-02-07 15:50:27 字数 585 浏览 2 评论 0原文

我首先从gitlab中克隆Java代码。 然后,我在没有修改任何代码的情况下使用编辑器打开Java类之一。 我发现每个方法的相对缩进在任何Java类中都消失了。 我尝试使用多个编辑器(包括Intellij Idea,sts,notpad ++)打开课程。 但是,当我使用NotPad时,该纸条本身安装在Win10中。它按预期进行。 这是Intellij Idea,sts,notpad ++开启的结果: 在此处输入图像描述

public ElasticSearchRepository(Class<E> entityClass) {
this.entityClass = entityClass;
}

这是win10:notpad in win10:

public ElasticSearchRepository(Class<E> entityClass) {
   this.entityClass = entityClass;
}

I clone the java code from gitlab firstly.
Then I open one of the java classes with a editor without modifying any code.
I find the relative indent of every method body disappear in any java class.
I tried to open the class with more than one editor, including intellij idea, sts, notpad++.
But When I use notpad which is installed in win10 natively. It goes as expected.
This is the result opened by intellij idea, sts, notpad++:
enter image description here

public ElasticSearchRepository(Class<E> entityClass) {
this.entityClass = entityClass;
}

This is the result opened by notpad in win10:

public ElasticSearchRepository(Class<E> entityClass) {
   this.entityClass = entityClass;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南风几经秋 2025-02-14 15:50:27

这是标签字符中默认空间的缩进设置的差异。

A. Intellij

in Intellij您可以执行此操作

File > Settings > Editor > Code Style > Java > Tabs and Indents > Use tab character

B. Vscode

  1. 转到Code&gt; 首选项&gt; 设置如果您使用的是MacOS(快捷方式:命令 +,)。
  2. 转到file&gt; 首选项&gt; 设置如果您使用的是Windows(hotkey:ctrl +,)。
  3. 键入凹痕进入搜索字段,然后前往编辑器:TAB Size部分。将默认空间编号替换为您的首选:

C。ATOM中的Atom

  1. ,打开首选项或cmd +,
  2. 单击左窗格的编辑器。
  3. 向下滚动到选项卡长度并输入您喜欢的内容。

D. Notepad ++

更改选项卡键的默认操作:

  1. 单击“设置”菜单
  2. 选择首选项
  3. 转到左侧设置窗格上的语言菜单/选项卡。
  4. 确保在最右边的列表中选择[默认值]。
  5. 在右下角,有一个标记为替换为Space的复选框。您可以检查一下以使用空间或在此选项上方设置标签字符的nmber空间。

E. Komodo编辑

  1. 打开首选项。在Mac上,它只是命令 +,和PC上,希望Control + P
  2. 单击编辑器旁边的箭头以删除其其他类别。
  3. 选择凹痕。
  4. 只需在适当的窗口中输入所需数量的凹痕空间,然后在底部击中确定即可。

This is a difference in the indent settings of the default number of spaces in a TAB character.

A. Intellij

In IntelliJ you can do this

File > Settings > Editor > Code Style > Java > Tabs and Indents > Use tab character

B. VSCode

  1. Go to Code > Preferences > Settings if you’re using macOS (shortcut: Command + ,).
  2. Go to File > Preferences > Settings if you’re using Windows (hotkey: Ctrl + ,).
  3. Type Indentation into the search field then head to the Editor: Tab Size section. Replace the default space number with your preferred one:

C. Atom

  1. In Atom, open preferences or CMD + ,
  2. Click on Editor on the left pane.
  3. Scroll down to Tab Length and input what you prefer.

D. Notepad++

To change the default action of the tab key:

  1. Click on the Settings menu
  2. Select Preferences
  3. Go to the Language Menu/Tab on the left Settings pane.
  4. Make sure [Default] is selected in the rightmost list.
  5. At The bottom right, there's a checkbox labelled Replace by space. You can check this to use spaces or set the nomber of spaces for your tab character above this option.

E. Komodo Edit

  1. Open up Preferences. On mac it's simply Command + , and on PC, hopefully control + p.
  2. Click on the arrow beside Editor to bring down the further categories for it.
  3. Select Indentation.
  4. Simply enter the desired number of spaces for indents in the appropriate window and hit OK at the bottom.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文