1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
language-mzn/lib/init.coffee
2017-03-18 23:13:08 +01:00

44 lines
1.2 KiB
CoffeeScript

{CompositeDisposable} = require 'atom'
module.exports = AtomLanguageMZN =
config:
enableLinter:
type: 'boolean'
default: true
description: "Enable linting using `mzn2fzn`"
mzn2fznPath:
type: 'string'
default: 'mzn2fzn'
description: 'Path to Minizinc\'s compiler `mzn2fzn`'
activate: (state) ->
console.log 'language-mzn: package loaded,
ready to get initialized by AtomLinter.'
if not atom.packages.getLoadedPackage 'linter'
atom.notifications.addError 'Linter package not found',
detail: '[language-mzn] `linter` package not found. \
Please install https://github.com/AtomLinter/Linter'
@subscriptions = new CompositeDisposable
@subscriptions.add atom.config.observe 'linter-mzn.mzn2fznPath', (mzn2fznPath) =>
@mzn2fznPath = mzn2fznPath
deactivate: ->
@subscriptions.dispose()
serialize: ->
AtomLanguageMZNViewState: @AtomLanguageMZNView.serialize()
provideLinter: ->
LinterMZN = require('./linter-mzn')
@provider = new LinterMZN()
return {
name: 'MiniZinc',
grammarScopes: ['source.mzn'],
scope: 'file',
lintsOnChange: true,
lint: @provider.lint
}