diff --git a/core/php_wrapper.py b/core/php_wrapper.py index 9222c1a..578d7c3 100644 --- a/core/php_wrapper.py +++ b/core/php_wrapper.py @@ -25,7 +25,7 @@ def getConsoleLogTypes(self): return [] def getConsoleStr(self): - return "{variable}" + return settings().get('php').get('consoleStr', "{title}, {variable}") def getConsoleSingleQuotes(self): return True @@ -51,6 +51,9 @@ def create(self, view, edit, cursor, insert_before): var_text = view.substr(word).strip() + if view.substr(word.begin() - 1) == '$': + var_text = '$' + var_text + # if selection is empty and there is no word under cursor use clipboard if not var_text: var_text = sublime.get_clipboard() @@ -103,13 +106,14 @@ def get_wrapper(self, view, var, indent_str, insert_before): consoleArr = consoleStr.split(separator) - t = consoleArr[0] + text = var.replace("'", "\\'") + text = text.replace("\"", "\\\"") + text = '\'' + text + '\'' - if len(consoleArr) >= 2: - v = ', '.join(consoleArr[1:]) - else: - v = t + var = var.replace(";", ',') + v = ', '.join(consoleArr) + tmpl = indent_str if insert_before else ("\n" + indent_str) openPre = "echo '
'; " if preTag else ""
@@ -117,8 +121,8 @@ def get_wrapper(self, view, var, indent_str, insert_before):
dieStr = " die();" if dieAfterLog else ""
- a = "{2}{0}({1});{3}{4}".format("->".join(consoleFunc), v, openPre, closePre, dieStr)
- a = a.format(variable=var)
+ a = "{2}{0}(__FILE__.':'.__LINE__, {1});{3}{4}".format("->".join(consoleFunc), v, openPre, closePre, dieStr)
+ a = a.format(title=text, variable=var)
tmpl += a