Permalink
36a46af Sep 18, 2016
244 lines (193 sloc) 11.1 KB

Table of Contents generated with DocToc

Contributing

Development

Color Schemes

JetBrains plugins are able to set the text attribute values for TextAttributeKeys that are unique to the plugin by using additionalTextAttributes entries in src/META-INF/plugin.xml. If you have a Color Scheme for Elixir you like, you can propose it as the default for a named theme by extracting the additionTextAttributes file from an Exported Settings .jar.

Customizing Scheme

  1. Preferences > Editor > Colors & Fonts > Elixir
  2. Customize the colors
  3. Click "Save As" to name the Scheme (My $SCHEME_NAME)_

Exporting Settings

  1. File > Export Settings
  2. Click "Select None"
  3. Check "Editor Colors"
  4. Change the "Export settings to:" path to a place you can easily access it in the terminal
  5. Click "OK"

Unpack Settings

  1. mkdir settings
  2. cd settings
  3. jar xf $SAVE_DIRECTORY/settings.jar

Convert ICLS to Additional Text Attributes format

  1. mv colors/colors/My\ $SCHEME_NAME.icls $INTELLIJ_ELIXIR/colorSchemes/ElixirSCHEME_NAME.xml ($SCHEME_NAME will be Default, Darcula or another shared theme name.)
  2. Remove all elements except for scheme attributes.
  3. Remove the outer scheme tag
  4. Rename the attributes tag to list.
  5. Add <?xml version='1.0'?> to the top of the file

Add Additional Text Attributes to plugin

  1. In plugin.xml inside the idea-plugin extensions[defaultExtensionNs="com.intellij"] tag, add a new additionalTextAttribute tag: <additionalTextAttributes file="colorSchemes/Elixir$SCHEME_NAME.xml" scheme="SCHEME_NAME"/>

Building

Documentation

The documentation files (CHANGELOG.md, CONTRIBUTING.md, README.md, and UPGRADING.md) all have table of contents generated by doctoc.

Install doctoc (globally) using npm

npm install -g doctoc

Then regenerate the table of contents using doctoc

doctoc .

Dependencies

IntelliJ IDEA

For Plugin

An IntelliJ Platform Plugin SDK must be setup to develop plugins, but the paths are tied to the version of IntellIJ IDEA you have installed, so you will likely need to fix the paths to match your environment.

  1. File > Project Structure
  2. In the “Project Structure” window
    1. Select Platform Settings > SDKs
    2. Click “+”
    3. Chose “IntelliJ Platform Plugin SDK”
    4. A modal may pop-up saying “Cannot Create SDK”, “You need to configure a Java SDK first”.
      1. Click OK
      2. In the “Select Home Directory for JDK” select the JDK 1.6 directory: “/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home”. NOTE: JDK 1.6 is used, even though it is unsupported by Oracle, to give the greatest compatibility with older JetBrains IDE versions
        1. You can download JDK 1.6 from Apple
      3. Click OK
    5. In the “Select Home Directory for IntelliJ Platform Plugin SDK” select the IntelliJ IDEA Community Edition Contents: /Applications/IntelliJ IDEA 14.1 CE.app/Contents. NOTE: Use Community Edition even if you have IntelliJ IDEA Ultimate Edition installed, so that the built plugin works with Community Edition.
    6. In the “Select Internal Java Platform” window
      1. Select “1.6”
      2. Click OK
    7. Select the “IntelliJ IDEA Community Edition” SDK.
      1. Select the Sourcepath tab
      2. Click the + Icon
      3. Select “~/git/JetBrains/intellij-community”
      4. In the “Detected Roots” window, click “OK” to add all roots.
    8. Click OK to close “Project Structure”
For JPS Builder Compile Server

Compile servers must be compatible all the way back to Java 1.6, but they also link to openapi.jar, which in new IntelliJ versions, like 2016.1, contains Java 1.8 only (MAJOR.MINOR 52.0) .class files. To ensure the jps-builder module is built so it will only use Java 1.6 compatible .class files in IntelliJ 14.1 through IntelliJ 2016.1, a separate, minimal IntelliJ Platform Plugin SDK is used for the jps-builder and jps-shared modules.

  1. Files > Project Structure
  2. In the "Project Structure" window
    1. Select Platform Settings > SDKs
      1. Click “+”
      2. Chose “IntelliJ Platform Plugin SDK”
      3. A modal may pop-up saying “Cannot Create SDK”, “You need to configure a Java SDK first”.
      4. Click OK
      5. In the “Select Home Directory for JDK” select the JDK 1.6 directory: “/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home”. NOTE: JDK 1.6 is used, even though it is unsupported by Oracle, to give the greatest compatibility with older JetBrains IDE versions
        1. You can download JDK 1.6 from Apple
      6. Click OK
      7. In the “Select Home Directory for IntelliJ Platform Plugin SDK” select the IntelliJ IDEA Community Edition Contents: /Applications/IntelliJ IDEA 14.1 CE.app/Contents. NOTE: Use Community Edition even if you have IntelliJ IDEA Ultimate Edition installed, so that the built plugin works with Community Edition.
      8. In the “Select Internal Java Platform” window
      9. Select “1.6”
      10. Click OK
      11. Select the “IntelliJ IDEA Community Edition” SDK.
      12. Change the Name to "IntelliJ IDEA Community Edition (JPS-Builder)"
      13. Minimize the number of jars included from "IntelliJ IDEA Community Edition"
        1. Select all /Applications/IntelliJ IDEA 14.1 CE.app/Contents jars
        2. Unselect (with Cmd+Click) the minimal jars needed
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/annotations.jar
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/jdom.jar
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/jps-model.jar
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/jps-server.jar
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/openapi.jar
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/trove4j.jar
          • /Applications/IntelliJ IDEA 14.1 CE.app/Contents/lib/util.jar
        3. Click the - Icon to remove the unneeded jars
      14. Add the Sourcepath
        1. Select the Sourcepath tab
        2. Click the + Icon
        3. Select “~/git/JetBrains/intellij-community”
        4. In the “Detected Roots” window, click “OK” to add all roots.
      15. Click OK to close “Project Structure”

IntelliJ Erlang

In order to integrate with IntelliJ Erlang, we need it as a jar to access its classes. The ant files used to build on Travis CI can be used to download the intellij-erlang.jar locally too.

  1. Install ant: brew install ant on OSX with Homebrew.
  2. ant -logger org.apache.tools.ant.listener.AnsiColorLogger -f intellij-elixir.xml get.idea get.intellij-erlang

Testing

Dependencies

elixir-lang/elixir

package org.elixir_lang.parser_definition.ElixirLangElixirParsingTestCase parses all the *.ex files in elixir-lang/elixir to verify the parser works with a realistic set of realistic files.

Installation
  1. mkdir ~/git
  2. git clone git@github.com:elixir-lang/elixir.git elixir-lang/elixir

intellij_elixir

org.elixir_lang.parsing_definition tests uses intellij_elixir's IntellijElixir.Quoter process to verify that intellij-elixir's parsed and quoted format matches that of native Elixir's Code.string_to_quoted.

Installation
  1. mkdir ~/git/KronicDeth
  2. cd ~/git/KronicDeth
  3. git clone git@github.com:KronicDeth/intellij_elixir.git
  4. cd intellij_elixir
  5. git checkout v0.1.1
  6. mix local.hex --force
  7. mix deps.get
  8. mix release
Starting

For the tests to find intellij_elixir, intellij_elixir must be running locally:

  1. cd ~/git/KronicDeth/intellij_elixir
  2. rel/intellij_elixir/bin/intellij_elixir start
Stopping

After the tests are completed you can stop intellij_elixir:

  1. cd ~/git/KronicDeth/intellij_elixir
  2. rel/intellij_elixir/bin/intellij_elixir stop
Running automatically for tests
  1. Run > Edit Configurations
  2. Select JUnit > org.elixir_lang
  3. Select “Unknown external tool” from the “Before launch: Make, External tool, Active tool window” from the bottom right pane.
  4. Click the Pencil Edit icon
  5. In the External Tools window
    1. Cick the + icon in the External Tools window
    2. In the Create Tool window
      1. Put “intellij_elixir” for “Name”
      2. Put “IntellijElixir.Quoter” for “Description”
      3. In the Tool Settings section
        1. For “Program” click the “…” and select ~git/KronicDeth/intellij_elixir/rel/intellij_elixir/bin/intellij_elixir from the file picker.
        2. In “Parameters” put “start”
      4. Click OK to close the “Create Tool” window
    3. Click OK to close the “External Tool” window
  6. Click OK to close the “Run/Debug Configurations” window
  7. Click the Run arrow to run “org.elixir_lang” tests.