From e3db28cf70fdf7601dd54d757e6422c1e272a7ba Mon Sep 17 00:00:00 2001 From: cioroianudenis Date: Fri, 31 Aug 2018 13:32:47 +0300 Subject: [PATCH] Fixed a bug involving user variables The bug is referenced here https://github.com/Azakur4/autocomplete-php/issues/50 --- lib/provider.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/provider.coffee b/lib/provider.coffee index a75523e..dc9f3fb 100644 --- a/lib/provider.coffee +++ b/lib/provider.coffee @@ -130,7 +130,7 @@ module.exports = if @userSuggestions? for userVar in @userSuggestions.user_vars when userVar.text.toLowerCase().indexOf(lowerCasePrefix) is 0 - completions.push(@buildCompletion(userVar)) + completions.push(@buildCompletion(userVar, prefix)) for variable in @completions.variables when variable.text.toLowerCase().indexOf(lowerCasePrefix) is 0 completions.push(@buildCompletion(variable)) @@ -181,7 +181,7 @@ module.exports = if @userSuggestions? for userVar in @userSuggestions.user_vars when userVar.text.toLowerCase().indexOf(lowerCasePrefix) is 0 - completions.push(@buildCompletion(userVar)) + completions.push(@buildCompletion(userVar, prefix)) for variable in @completions.variables when variable.text.toLowerCase().indexOf(lowerCasePrefix) is 0 completions.push(@buildCompletion(variable)) @@ -189,7 +189,7 @@ module.exports = completions - buildCompletion: (suggestion) -> + buildCompletion: (suggestion, prefix = null) -> text: suggestion.text type: suggestion.type displayText: suggestion.displayText ?= null @@ -197,3 +197,4 @@ module.exports = leftLabel: suggestion.leftLabel ?= null description: suggestion.description ?= "PHP <#{suggestion.text}> #{suggestion.type}" descriptionMoreURL: suggestion.descriptionMoreURL ?= null + replacementPrefix: prefix