     registerEvents: ->
         @disposables.push atom.config.observe('autocomplete-plus.maxSuggestions', => maxItems = atom.config.get('autocomplete-plus.maxSuggestions'))
         @disposables.push @autocompletePlus.autocompleteManager.suggestionList.emitter.on 'did-cancel', =>
-            @hideDocumentation()
+            @clearSuggestions()
+            @documentationView.hide()
         @disposables.push @autocompletePlus.autocompleteManager.suggestionList.emitter.on 'did-confirm', =>
-            @hideDocumentation()
+            @clearSuggestions()
+            @documentationView.hide()
         @disposables.push @autocompletePlus.autocompleteManager.suggestionList.emitter.on 'did-select-next', =>
             if ++@currentSuggestionIndex >= @getMaxIndex()
                 @currentSuggestionIndex = 0

        return new Promise (resolve) ->
            that.client.update(options.editor.getURI(), options.editor.getText()).then =>
                that.client.completions(options.editor.getURI(), {line: options.position.row, ch: options.position.column}).then (data) =>
                    that.suggestionsArr = []
                    that.currentSuggestionIndex = 0
                    if !data.completions.length
                        resolve([])
                        that.documentationView.hide()

        @autocompletePlus.autocompleteManager.runAutocompletion()
        @force = false

    clearSuggestions: ->
        @suggestionsArr = []
        @currentSuggestionIndex = 0

    forceCancel: ->
        @autocompletePlus.autocompleteManager.hideSuggestionList()
        @clearSuggestions()

    hideDocumentation: ->
        @documentationView.hide()
