Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After installing the plugin, how do I create elixir modules in a project? #77

Closed
prodev42 opened this issue Jan 1, 2015 · 4 comments
Closed

Comments

@prodev42
Copy link

prodev42 commented Jan 1, 2015

Hi, I have installed the plugin successfully in IntellJ, however it doesn't not let me create elixir modules. What do I have to do to enable this?

@KronicDeth
Copy link
Owner

There are 3 ways to create modules:

Using Right-click menu

  1. Right-click a directory, such as the lib directory made by mix new
  2. Select New from the context menu
  3. Select Elixir File from the submenu
  4. Enter the module name MyModule
  5. Click OK
  6. MyModule.ex will open with the Module stub

Use App Menu

  1. Select the File Menu from the application menu
  2. Select the New... action from the File Menu
  3. Select Elixir File from the submenu
  4. Enter the module name MyModule
  5. Click OK
  6. MyModule.ex will open with the Module stub

By file extension

  1. Right-click a directory, such as the lib directory made by mix new
  2. Select New from the context menu
  3. Select File from the submenu
  4. Enter the file name with a .ex extension my_module.ex
  5. Click OK
  6. my_module.ex will open with no content and you'll have to fill it in yourself.

You'll notice that in the first and second steps that use the New Elixir File action, the file name and module name exactly match, which doesn't actually follow mix's convention of underscored for file names and Elixir's convention of CamelCase for modules, so if you use the first two method, I'd recommend renaming the file to underscored, my_module.ex, manually. There are already issues open to fix the naming so it follows conventions: #19 and #20.

If you just create the file with the correct file extension you'll be able to name the module however you like.

@prodev42
Copy link
Author

prodev42 commented Jan 2, 2015

Thanks but I think I did not state my question clearly.

I just installed a fresh copy of IntellJ IDE. Next I installed your plugin. Can you teach me how to configure/set it up for Elixir?For example, do I have to setup something in Project Settings or Platform Settings? Do I have to install Erlang Plugin?Do I have to setup SDK path? What do I have to do in order to start editing .ex files and run/debug them in the IDE?

I think this guy is asking the same question on stackoverflow ->

http://stackoverflow.com/questions/27730087/new-elixir-project-in-intellij

@KronicDeth KronicDeth reopened this Jan 3, 2015
@KronicDeth
Copy link
Owner

There are no Project settings or Platform settings. intellij-elixir doesn't currently require intellij-erlang, although it will probably eventually to leverage the debugger and so intellij-erlang can parse the Erlang code for dependencies (like cowboy for phoenix) and the standard library while intellij-elixir can handle the References between Erlang and Elixir code. There is no SDK path as no features that depend on the Elixir itself exist yet. There is no way to run and debug them in the IDE at this time.

The features that do exist are syntax highlighting and partial support for grammar as outlined in the Features section of the README along with a few Inspections and Quick Fixes where intellij-elixir's grammar can be more forgiving than elixirc's and will allow you to correct errors that would break the compile.

The README really does document all the current features. There just aren't a lot of them.

The current way intellij-elixir can be used is to create files the steps I outlined above and anything involving running code you'll need to use the Terminal pane in Intellij and drop into iex or invoke mix yourself. Don't misunderstand, I do want all those things you mention in intellij-elixir, but I need to get the grammar completed first.

@KronicDeth
Copy link
Owner

@prodev42, you'll want to upgrade to v0.3.0 when it appears in the Jetbrains plugin repository or grab it from the releases here on Github: it includes better New > Elixir File support, including transforming Foo.Bar into foo/bar.ex. See the README for usage information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants