                     suggestion: 'and'
                     description: ''
                 }
-                {
-                    suggestion: 'div'
-                    description: ''
-                }
-                {
-                    suggestion: 'eq'
-                    description: ''
-                }
-                {
-                    suggestion: 'ga'
-                    description: ''
-                }
-                {
-                    suggestion: 'ge'
-                    description: ''
-                }
-                {
-                    suggestion: 'gt'
-                    description: ''
-                }
-                {
-                    suggestion: 'le'
-                    description: ''
-                }
-                {
-                    suggestion: 'le'
-                    description: ''
-                }
-                {
-                    suggestion: 'lt'
-                    description: ''
-                }
-                {
-                    suggestion: 'mod'
-                    description: ''
-                }
-                {
-                    suggestion: 'mul'
-                    description: ''
-                }
-                {
-                    suggestion: 'na'
-                    description: ''
-                }
-                {
-                    suggestion: 'ne'
-                    description: ''
-                }
-                {
-                    suggestion: 'not'
-                    description: ''
-                }
-                {
-                    suggestion: 'nth'
-                    description: ''
-                }
-                {
-                    suggestion: 'oa'
-                    description: ''
-                }
-                {
-                    suggestion: 'or'
-                    description: ''
-                }
-                {
-                    suggestion: 'sub'
-                    description: ''
-                }
             ]
-            nothing:[
+            "" :[
                 {
                     suggestion: 'r'
                     description : 'The main ReQL namespace'

                                return i+1
                        else if query[i] is ')'
                            count_opening_parenthesis--

            return 0


        # Make suggestions when the user is writing
        handle_keypress: (editor, event) =>
            if event?.which?
                console.log event
                if event.which is 9 # is tab
                    event.preventDefault()
                    if event.type isnt 'keydown'
                        console.log 'break'
                        return true
                    @current_highlighted_suggestion++
                    if @current_highlighted_suggestion >= @current_suggestions.length
                        @current_highlighted_suggestion = 0

                    if @current_suggestions[@current_highlighted_suggestion]?
                        @highlight_suggestion @current_highlighted_suggestion
                        @write_suggestion @current_suggestions[@current_highlighted_suggestion].suggestion

                        position = (@query_first_part + @current_completed_query + @current_suggestions[@current_highlighted_suggestion].suggestion).length
                        console.log '---'
                        console.log @query_first_part
                        console.log @current_completed_query
                        console.log @current_suggestions[@current_highlighted_suggestion].suggestion
                        @position_cursor position
                    return true
                if event.which is 13 and (event.shiftKey or event.ctrlKey)
                    event.preventDefault()
                    if event.type isnt 'keydown'
                        console.log 'break'
                        return true
                    @.$('suggestion_name_list').css 'display', 'none'
                    @execute_query()
                    #@codemirror.blur()



            @current_highlighted_suggestion = -1
            @.$('.suggestion_name_list').html ''

            #TODO Handle multiple line
            query_before_cursor = @codemirror.getValue().slice 0, @codemirror.getCursor().ch

            # Check if we are in a string
            if (query_before_cursor.match(/\"/g)||[]).length%2 is 1
                @hide_suggestion()
                return ''

            query_after_cursor = @codemirror.getValue().slice @codemirror.getCursor().ch
            slice_index = @extract_query_first_part query_before_cursor
            query = query_before_cursor.slice slice_index
            
            @query_first_part = query_before_cursor.slice 0, slice_index
            next_dot_position = query_after_cursor.indexOf('.')
            if next_dot_position is -1
                @query_last_part = ''
            else
                @query_last_part = query_after_cursor.slice next_dot_position

            #TODO retrieve real data when API is ready
            if /^(\s*)$/.test query
                suggestions = []
                suggestions = @suggestions['nothing']
                query = ''
                @append_suggestion(query, suggestions)
            else if /^(r\.)[^\.]*$/.test query
                suggestions = []
                for suggestion in @suggestions['r']
                    suggestions.push suggestion
                for database in databases.models
                    suggestions.unshift
                        suggestion: 'db(\''+database.get('name')+'\')'
                        description: 'Select database '+database.get('name')
                @append_suggestion(query, suggestions)
            else if /^(r\.)[^\.]*\.[^\.]*$/.test query
                suggestions = []
                for surggestion in @suggestions['database']
                    suggestions.push suggestion
                for namespace in namespaces.models
                    suggestions.unshift
                        suggestion: 'table(\''+namespace.get('name')+'\')'
                        description: 'Select table '+namespace.get('name')
                @append_suggestion(query, suggestions)
            else if /^(r\.)[^\.]*\.[^\.]*\..*$/.test query
                suggestions = @suggestions['stream']
                @append_suggestion(query, suggestions)
            else
                @hide_suggestion()
 
            console.log 'end'
            return false

        append_suggestion: (query, suggestions) =>
            splitdata = query.split('.')

        # We have to keep track of a lot of things because web-kit browsers handle the events keydown, keyup, blur etc... in a strange way.
        current_suggestions: []
        current_highlighted_suggestion: -1
        current_conpleted_query: ''
        query_first_part: ''
        query_last_part: ''

        write_suggestion: (suggestion_to_write) =>
            @codemirror.setValue @query_first_part + @current_completed_query + suggestion_to_write + @query_last_part
