JetBrains / gradle-idea-ext-plugin

Plugin to store IJ settings in gradle script
Apache License 2.0
232 stars 39 forks source link

DSL to configure IssueNavigationConfiguration #88

Open LeafHacker opened 4 years ago

LeafHacker commented 4 years ago

For example, I have the following in my vcs.xml but would like to configure it via gradle rather than unigorning .idea/vcs.xml

  <component name="IssueNavigationConfiguration">
    <option name="links">
      <list>
        <IssueNavigationLink>
          <option name="issueRegexp" value="([^/# ]+)/([^/# ]+)#([0-9]+)" />
          <option name="linkRegexp" value="https://github.com/$1/$2/issues/$3" />
        </IssueNavigationLink>
        <IssueNavigationLink>
          <option name="issueRegexp" value="/([^/# ]+)/([^/# ]+)/issues/([0-9]+)" />
          <option name="linkRegexp" value="https://github.com/$1/$2/issues/$3" />
        </IssueNavigationLink>
        <IssueNavigationLink>
          <option name="issueRegexp" value="#([0-9]+)" />
          <option name="linkRegexp" value="https://github.com/org/project/issues/$1" />
        </IssueNavigationLink>
      </list>
    </option>
  </component>
LeafHacker commented 4 years ago

Perhaps something like:

idea.project.settings {
    issueLinks [
        /([^\/# ]+)\/([^\/# ]+)#([0-9]+)/: 'https://github.com/$1/$2/issues/$3',
        /\/([^\/# ]+)\/([^/# ]+)\/issues\/([0-9]+)/: 'https://github.com/$1/$2/issues/$3',
        /#([0-9]+)/: 'https://github.com/org/project/issues/$1'
    ]
}

or

idea.project.settings {
    issueLink(/([^\/# ]+)\/([^\/# ]+)#([0-9]+)/, 'https://github.com/$1/$2/issues/$3')
    issueLink(/\/([^\/# ]+)\/([^/# ]+)\/issues\/([0-9]+)/, 'https://github.com/$1/$2/issues/$3')
    issueLink(/#([0-9]+)/, 'https://github.com/org/project/issues/$1')
}

?

vlsi commented 4 years ago

Implementing the configuration via editorconfig might be slightly better: https://github.com/editorconfig/editorconfig/issues/426 as it would be consistent across IDEs