atom-inline-messenger-example

Sample App for Inline Messaging in the Atom Editor

mdgriffith

93

0

1.1.1

MIT

GitHub

This package consumes the following services:

Getting Started

This package has example usage of the inline messenger package.

After installing this package, hit cmd-alt-+. A new page will be created with some example messages and a code suggestion. Use alt-up or alt-down to scroll through the messages, and cmd-shift-a to accept the suggestion.

Inline messenger provides a service for use in other Atom projects. With it, a package can show messages next to the relevant, highlighted code, and optionally make a code suggestion for the selected text. To use it, include inline-messenger in the consumedServices section of your package.json:

{
  "name": "my-package",
  "consumedServices": {
    "inline-messenger": {
      "versions": {
        "^1.0.0": "consumeInlineMessenger"
      }
    }
  }
}

Then call methods on the service in your package's main module.

The message creates a message in the active editor.

module.exports =
  activate: ->
    @messages = []

  consumeInlineMessenger: (messenger) ->
    @messenger = messenger

    @messages.push @messenger.message
              range: [[22,0], [25,8]]
              text: "A New Message"
              severity: "warning"

    @messages.push @messenger.message
              range: [[35,0], [35,8]]
              text: "A New Code Suggestion"
              suggestion: "myNewCodeSuggestion();"

  deactivate: ->
    @messages.map (msg) -> msg.destroy()
    @messages = []

The Message Command

The message method takes the following parameters

Commands

Settings