How to enable autoscroll to/from source permanentl

2019-02-04 06:46发布

问题:

I like the Autoscroll to/from source features. Every time I import a new project, I will always enable them. However, it gets annoying when you have to do that every time for a new import. I googled, but couldn't find out how. So, do you know how to enable them permanently? Thank you very much.

回答1:

This is currently not possible.

The auto-scroll settings are Project specific and are stored in the .idea/workspace.xml file :

Accessing Default Project Settings and Structure documents how to change the default settings used by new projects. Unfortunately, the autoscroll settings are not amongst the ones that can be set there.

A bit more digging shows that the default project is represented by .IntelliJIdea12\config\options\project.default.xml and it does not have settings for autoScroll specified. (Out of curiosity, I tried copying in the following in that file :

  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource ProjectPane="true" />
      <autoscrollFromSource ProjectPane="true" />
      <sortByType />
    </navigator>
  </component>

But that was not picked up by new projects. )



回答2:

There is now a free IntelliJ plugin to remember Autoscroll to/from Source settings:

Jetbrains repository: Autoscroll Save Plugin

Instructions to use:

  • Download Autoscroll Save plugin and restart IntelliJ
  • Open an IntelliJ project and set desired autoscroll to and from settings
  • Use Ctrl-Alt-Shift END

All IntelliJ projects opened or created in future will now inherit your desired Autoscroll to/from Source settings.

If you have any feedback on the plugin, please click on the author (vikingsteve) on the plugin page and use "Send email" function.


Edit: I was just at a java conference and spoke to some of the Jetbrains devs from St Petersbourg. After thanking them for developing IntelliJ, I asked them about this, and I understand that since they are really busy with other things they don't have time right now to make this default functionality in IntelliJ.

So, in the meantime, please try out the Autoscroll Save plugin - from everyone I spoke to at the conference, it works for them without problem.