   messages: null
   subscriptions: null
 
+  # Configuration options
   config:
+    # Path to pawncc executable
     pawnExecutablePath:
       title: 'Path to pawncc executable'
       type: 'string'
       default: 'C:\\pawn\\pawncc.exe'
+
+    # List of pawncc options (passed before filename)
     pawnOptions:
       title: 'Pawn options'
       type: 'array'

    return @messages

  build: ->
    filepath = atom.workspace.getActiveTextEditor()?.getPath()

    # ignore command if current file is not saved, or is not a .pwn file
    return unless filepath? and path.extname(filepath) == '.pwn'

    # prepare command
    cmd = atom.config.get('pawn-build.pawnExecutablePath')

    # prepare arguments
    args = atom.config.get('pawn-build.pawnOptions')
    args.push path.basename filepath

    # run pawn
    process = child_process.spawn cmd, args,
      cwd: path.dirname filepath

    procout = []
    hasError = false

    process.stdout.on 'data', (data) ->
      procout.push data.toString()

    process.stderr.on 'data', (data) ->
      procout.push data.toString()

    process.on 'error', (error) =>
      hasError = true
      output = @createOutputPanel()
      output.add new PlainMessageView

        type: 'string'

  activate: (state) ->
    # Activate package
    @subscriptions = new CompositeDisposable
    @subscriptions.add atom.commands.add 'atom-workspace', 'pawn-build:build': => @build()

  deactivate: ->
    # Deactivate package
    @messages?.detatch()
    @subscriptions.dispose()
    @pawnBuildView.destroy()
