Permalink
Browse files

Merge pull request #5 from TheSpyder/underscore_type_inspection_fix

Fix for inspecting variables with underscores
  • Loading branch information...
2 parents 0291804 + 18174e7 commit f266996473ccbee92a74b59c179f2f6c081e13d2 @whitequark committed Feb 19, 2014
Showing with 8 additions and 2 deletions.
  1. +8 −2 sublime_ocp_index.py
View
@@ -84,6 +84,11 @@ def extract_query(self, view, location):
def query_type(self, view, location):
endword = view.word(location).end()
+ while view.substr(endword) is '_':
+ endword = endword + 1
+ if view.substr(endword) is not ' ':
+ endword = view.word(endword).end()
+
query = self.extract_query(view, endword)
if query is not None:
@@ -94,7 +99,7 @@ def query_type(self, view, location):
if (result is None or len(result) == 0):
return "Unknown type: '%s'" % queryString
else:
- return result
+ return "Type: %s" % result
def query_completions(self, view, prefix, location):
@@ -182,7 +187,8 @@ def run(self, enable):
result = sublimeocp.query_type(self.view, locations[0])
- self.view.set_status(OCPKEY,"Type: " + result)
+ if result is not None:
+ self.view.set_status(OCPKEY, result)
# ST2 backwards compatibility
if (int(sublime.version()) < 3000):

0 comments on commit f266996

Please sign in to comment.