         replacementPrefix: prefix
         type: 'import'
 
-  getPreprocessor: (prefix) =>
-    (if prefix[0]=='-' then @info.ghcFlags
-    else @info.langOpts)
+  getPreprocessor: =>
+    kw=@lineSearch /\b(LANGUAGE|OPTIONS_GHC)\b/
+    prefix=@getPrefix()
+    return [] unless kw?
+    label=''
+    if kw=='OPTIONS_GHC'
+      prefix=@getPrefix(/[\w-]+/)
+      label='GHC Flag'
+      list=@info.ghcFlags
+    else if kw=='LANGUAGE'
+      label='Language'
+      list=@info.langOpts
+    else
+      label='Pragma'
+      list=@pragmaWords
+
+    list
       .filter (line) ->
         line.startsWith prefix
       .map (mod) ->
         text: mod
-        rightLabel: if prefix[0]=='-' then 'ghc flag' else 'Language'
+        rightLabel: label
         replacementPrefix: prefix
         type: 'keyword'
-
-  isIn: (scope) ->
-    scope.every (s1) =>
-      @scopes.some (s) ->
-        s==s1
-
-  genSpaceSearch: =>
-    new Promise (resolve) =>
-      @editor.backwardsScanInBufferRange /[\w.']+/,
-        @lineRange, ({matchText,stop})->
-          resolve(matchText)
-          stop()
 
   buildSymbolSuggestion: (s, prefix) ->
     text: s.qname ? s.name

    @lineRange = new Range [0, @options.bufferPosition.row],
      @options.bufferPosition

  genTypeSearch: =>
    unless @controller.backend
      return Promise.reject(Error('no backend'))
    r = new Range @options.bufferPosition, @options.bufferPosition
    @controller.backend.getType(@editor.getBuffer(), r)

  #ghc-mod search
  getModule: (prefix) =>
    @info.moduleList
      .filter (line) ->
        line.startsWith prefix

      .map (s) =>
        @buildSymbolSuggestion(s, prefix)

  getTypeMatches: () =>
    unless @controller.backend
      return Promise.reject(Error('no backend'))
    r = new Range @options.bufferPosition, @options.bufferPosition
    @controller.backend.getType @editor.getBuffer(), r
      .then (type) =>
        @symbols
          .filter (s) ->
            return false unless s.type?
            tl = s.type.split(' -> ').slice(-1)[0]
            return false if tl.match(/^[a-z]$/)
            ts = tl.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
            rx=RegExp ts.replace(/\b[a-z]\b/g,'.+'),''
            rx.test(type)
          .map (s) =>
            @buildSymbolSuggestion(s, @prefix)

  getModuleMatches: =>
    prefix = @getPrefix()
    mod=@lineSearch /^import ([\w.]+)/, 1
    return [] unless mod?
    @controller.backend.listImportedSymbols @editor.getBuffer(), [{name: mod}]
      .then (symbols) =>
