 
         [hint, _type] = suggestions[0].split(';')
         suggestions = suggestions[1...]
-        module_prefix = ''
-        modules_to_add = []
-        is_prefix_a_function_call = !!(prefix.match(/\.[^A-Z][^\.]*$/) || prefix.match(/^[^A-Z:][^\.]*$/))
-
-        if prefix != '' && !is_prefix_a_function_call
-          prefix_modules = prefix.split('.')[...-1]
-          hint_modules   = hint.split('.')[...-1]
-
-          if prefix[-1...][0] != '.' || ("#{prefix_modules}" != "#{hint_modules}")
-            modules_to_add = (m for m,i in hint_modules when m != prefix_modules[i])
-            lastModuleHint = hint_modules[hint_modules.length-1]
+        modulesToAdd = []
+        isPrefixFunctionCall = !!(prefix.match(/\.[^A-Z][^\.]*$/) || prefix.match(/^[^A-Z:][^\.]*$/))
+
+        if prefix != '' && !isPrefixFunctionCall
+          prefixModules = prefix.split('.')[...-1]
+          hintModules   = hint.split('.')[...-1]
+
+          if prefix[-1...][0] != '.' || ("#{prefixModules}" != "#{hintModules}")
+            modulesToAdd = (m for m,i in hintModules when m != prefixModules[i])
+            lastModuleHint = hintModules[hintModules.length-1]
 
         suggestions = suggestions.map (serverSuggestion) ->
           fields = serverSuggestion.replace(/;/g, '\u000B').replace(/\\\u000B/g, ';').split('\u000B')
           name = fields[0]
-          if lastModuleHint && (lastModuleHint not in [name, ":#{name}"]) && modules_to_add.length > 0
-            fields[0] = modules_to_add.join('.') + '.' + name
+          if lastModuleHint && (lastModuleHint not in [name, ":#{name}"]) && modulesToAdd.length > 0
+            fields[0] = modulesToAdd.join('.') + '.' + name
           createSuggestion(serverSuggestion, fields, prefix, pipeBefore, captureBefore)
 
         suggestions = sortSuggestions(suggestions)


  moduleAndFuncName = (moduleParts, func) ->
    module = ''
    func_name = ''
    if func.match(/^:/)
      [module, func_name] = func.split('.')
    else if moduleParts.length > 0
      module = moduleParts[0]
      func_name = func
    [module, func_name]

      params  = [1..arity].map (i) -> "${#{i}:arg#{i}}"
      displayText = "#{func}/#{arity}"

    snippetParams = params
    snippetParams = snippetParams[1...] if snippetParams.length > 0 && pipeBefore

    if captureBefore
      snippet = "#{func}/#{arity}"
    else if snippetParams.length > 0
      snippet = "#{func}(#{snippetParams.join(', ')})"

    snippet = snippet.replace(/^:/, '') + "$0"

