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
range
- The range to highlight in the editortext
- The text to display in the messageseverity
- 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-downprev-message
-> Jumps to the previous message. The default keyboard shortcut is alt-upaccept-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.