Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions core/php_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -103,22 +106,23 @@ 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 '<pre>'; " if preTag else ""
closePre = " echo '</pre>';" if preTag else ""

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

Expand Down