elixir-editors / language-elixir

Elixir language support for the Atom editor.
Other
181 stars 40 forks source link

Better documentation snippets #54

Closed keathley closed 8 years ago

keathley commented 8 years ago

Right now the documentation snippets aren't very complete and aren't very usable. Ideally we could create a snippet like:

  'moduledoc':
    'prefix': 'moduledoc'
    'body': """
      @moduledoc \"\"\"
      ${0:documentation}
      \"\"\"
    """

But unfortunately this is currently not supported in atom. There's an open issue on this here: atom/snippets#140. Based on the resolution of that issue I'd like to rework the documentation snippets to be more consistent.

gusaiani commented 8 years ago

Just an observation, \""" seems to work just as well as \"\"\".

keathley commented 8 years ago

Good catch. Unfortunately we're still stuck until that issue is resolved. I've thought about changing the snippet to something like:

@doc""" <- the cursor would go here
"""

That way the user can hit enter to expand the doc. Its not an ideal solution but it would provide better support until atom works out a fix upstream.

gusaiani commented 8 years ago

Seems just fine for the time being.

gusaiani commented 8 years ago

This seems to work, apparently even for nested modules:

  'moduledoc':
    'prefix': 'moduledoc'
    'body': """
      @moduledoc \"""\n\b\b${0:documentation}\n\"""
    """

...if people do use double-space indentation.

keathley commented 8 years ago

Thats awesome!!! Would you want to submit a PR with with these fixes? If not thats fine. I can try to get to it a bit later.

gusaiani commented 8 years ago

Glad you liked it :) If you can point me to which snippets you're planning to add or fix, I'll be happy to give them a shot. It's getting late here, I'll be back tomorrow. If you'd rather go ahead and tackle them, all the merrier.

Thanks always for this package.

keathley commented 8 years ago

Lets just start with the doc and moduledoc snippets. I think that we're missing snippets for almost all of the attributes (@callback, @type, @spec, etc.) but we can handle that in another PR.

keathley commented 8 years ago

Closed with #62 and #63