• Packages
  • Themes
  • Documentation
  • Blog
  • Discuss
Sign in

atom-inline-messenger-example

Sample App for Inline Messaging in the Atom Editor
mdgriffith
1.1.1 64
0
  • Repo
  • Bugs
  • Versions
  • License
Flag as spam or malicious

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

  • range - The range to highlight in the editor
  • text - The text to display in the message
  • severity - Can be any of the following: info, warning, error, suggestion. This will affect the coloring of the message.
  • suggestion - Provide a code suggestion to replace the highlighted text.

Commands

  • next-message -> Jumps to the next message. The default keyboard shortcut is alt-down
  • prev-message -> Jumps to the previous message. The default keyboard shortcut is alt-up
  • accept-suggestion -> If the current message is a code suggestion, this command will make the suggested changes for you. The default is cmd-shift-a

Settings

  • Message Positioning - For messages that span multiple lines, show them either below the highlighted code or to the right. Defaults to below.
  • Show Keyboard Shortcut For Suggestions - Show keyboard shortcut reminder at the bottom of a suggestion. Defaults to true.
  • Accept Suggestion Animation - Show a small highlight flash when suggested code is accepted. Defaults to true.

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by