-
Notifications
You must be signed in to change notification settings - Fork 178
Linter Indie API
Steel Brain edited this page Nov 4, 2015
·
9 revisions
There are some linters that do not depend on the user saving the file to update their output. Those providers can consume the linter-indie
to register their linters and update them as they like.
Here's what you need to add to your package.json
file:
"consumedServices": {
"linter-indie": {
"versions": {
"1.0.0": "consumeLinter"
}
}
Then you need to create a consumeLinter
method in your main package instance, a package that implements linter indie API would look something like this
'use babel'
import {CompositeDisposable} from 'atom'
module.exports = {
activate: function() {
this.subscriptions = new CompositeDisposable()
},
deactivate: function() {
this.subscriptions.dispose()
},
consumeLinter: function(indieRegistry) {
const myLinter = indieRegistry.register({name: 'My Linter'})
this.subscriptions.add(myLinter)
myLinter.setMessages([{
type: 'Error',
text: 'Something went wrong'
}])
}
}
Because we're adding the provider to disposables, the provider's messages will automatically disappear when this package is deactivated.
class IndieRegistry {
register({name}): Indie
has(Indie): Boolean
unregister(Indie): void
}