Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
fixed snippets, fixed suggestions on long expressions
  • Loading branch information
Florian Zinggeler authored and Florian Zinggeler committed Oct 7, 2013
1 parent 1269562 commit 8b8cc60
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
43 changes: 22 additions & 21 deletions UnrealScriptIDEData.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,29 @@ def get_object(self, word, out_of, b_no_classes=False, b_no_functions=False, b_n
out_of.parse_me()
return "parsing..."

# ## What was I thinking here??!
# Nothing found, search in the current view
view = sublime.active_window().active_view()
regex_var = r"(var|local)(\(\w*\))?\s([^\s]+)\s" + word
regex_func = r"([a-zA-Z0-9()\s]*?)function[\s]+((coerce)\s*)?([a-zA-z0-9<>_]*?)[\s]*("+word+r")([\s]*\(+)(.*)((\s*\))+)[\s]*(const)?[\s]*;?[\s]*(\/\/.*)?"
try:
var = view.find(regex_var, 0, sublime.IGNORECASE)
except RuntimeError as err:
print err
return None
else:
if var:
var_lines = view.substr(var).split()[:-1]
row, col = view.rowcol(var.a)
return Variable(var_lines, word, "", row + 1, sublime.active_window().active_view().file_name(), "")
func = view.find(regex_func, 0, sublime.IGNORECASE)
if func:
line = view.substr(func)
row, col = view.rowcol(func.a)
print line
matches = re.search(regex_func, line) # search for: 1: modifiers, 2: coerce, 3: ?, 4: return type, 5: name, .., 7: arguments ...
if matches:
return Function(matches.group(1).strip(), matches.group(4).strip(), word, matches.group(7).strip(), row + 1, sublime.active_window().active_view().file_name(), "", True)
# view = sublime.active_window().active_view()
# regex_var = r"(var|local)(\(\w*\))?\s([^\s]+)\s" + word
# regex_func = r"([a-zA-Z0-9()\s]*?)function[\s]+((coerce)\s*)?([a-zA-z0-9<>_]*?)[\s]*("+word+r")([\s]*\(+)(.*)((\s*\))+)[\s]*(const)?[\s]*;?[\s]*(\/\/.*)?"
# try:
# var = view.find(regex_var, 0, sublime.IGNORECASE)
# except RuntimeError as err:
# print err
# return None
# else:
# if var:
# var_lines = view.substr(var).split()[:-1]
# row, col = view.rowcol(var.a)
# return Variable(var_lines, word, "", row + 1, sublime.active_window().active_view().file_name(), "")
# func = view.find(regex_func, 0, sublime.IGNORECASE)
# if func:
# line = view.substr(func)
# row, col = view.rowcol(func.a)
# print line
# matches = re.search(regex_func, line) # search for: 1: modifiers, 2: coerce, 3: ?, 4: return type, 5: name, .., 7: arguments ...
# if matches:
# return Function(matches.group(1).strip(), matches.group(4).strip(), word, matches.group(7).strip(), row + 1, sublime.active_window().active_view().file_name(), "", True)
return None

# returns the type (class) of the object before the dot
Expand Down
4 changes: 2 additions & 2 deletions UnrealScriptIDEMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def get_relevant_text(text):
elif c == '(':
i -= 1
if (c == ' ' or c == ',' or c == '\t') and i == 0:
obj_string = obj_string[-2::-1]
return get_rid_of_arguments(obj_string[-2::-1])
elif c == '(' and i == -1:
obj_string = obj_string[-2::-1]
return get_rid_of_arguments(obj_string[-2::-1])
obj_string = obj_string[::-1].lstrip()
return get_rid_of_arguments(obj_string)

Expand Down

0 comments on commit 8b8cc60

Please sign in to comment.