Skip to content

Commit 764adee

Browse files
committed
Version bump v10.2.2-beta.9
+ Python showing exceptions for 'raise' keyword.
1 parent f86d2d5 commit 764adee

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

codeintel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '10.2.2-beta.8'
1+
__version__ = '10.2.2-beta.9'

codeintel/ci2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# Trent Mick ([email protected])
3939

4040
r"""ci2 -- playing with some new CodeIntel ideas"""
41+
from __future__ import absolute_import
4142

4243
__revision__ = "$Id$"
4344
__version_info__ = (1, 0, 0)

codeintel/codeintel2/lang_python.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,9 @@ def trg_from_pos(self, pos, implicit=True):
743743

744744
# Quick out if the preceding char isn't a trigger char.
745745
# Note: Cannot use this now that we have a 2-char locals trigger.
746-
#if last_char not in " .(@_":
746+
#if last_char not in " .(@_,":
747747
# if DEBUG:
748-
# print "trg_from_pos: no: %r is not in ' .(@'_" % last_char
748+
# print "trg_from_pos: no: %r is not in ' .(@'_," % last_char
749749
# return None
750750

751751
style = accessor.style_at_pos(last_pos)
@@ -804,7 +804,7 @@ def trg_from_pos(self, pos, implicit=True):
804804

805805
# Typing a space is very common so lets have a quick out before
806806
# doing the more correct processing:
807-
if last_pos-1 < 0 or accessor.char_at_pos(last_pos-1) not in "tm,":
807+
if last_pos-1 < 0 or accessor.char_at_pos(last_pos-1) not in "tme,":
808808
return None
809809

810810
working_text = accessor.text_range(max(0,last_pos-200),
@@ -833,6 +833,10 @@ def trg_from_pos(self, pos, implicit=True):
833833
return Trigger(self.lang, TRG_FORM_CPLN,
834834
"available-exceptions", pos, implicit)
835835

836+
if line == "raise" or line.endswith(" raise"):
837+
return Trigger(self.lang, TRG_FORM_CPLN,
838+
"available-exceptions", pos, implicit)
839+
836840
if ch == ',':
837841
# is it "from FOO import BAR, <|>" ?
838842
if line.startswith('from ') and ' import ' in line:
@@ -1021,6 +1025,17 @@ def trg_from_pos(self, pos, implicit=True):
10211025
if DEBUG: print("trg_from_pos: no: no chars preceding '('")
10221026
return None
10231027

1028+
elif last_char == ',':
1029+
working_text = accessor.text_range(max(0, last_pos - 200), last_pos)
1030+
line = self._last_logical_line(working_text).rstrip()
1031+
if line:
1032+
last_bracket = line.rfind("(")
1033+
pos = (pos - (len(line) - last_bracket))
1034+
return Trigger(self.lang, TRG_FORM_CALLTIP,
1035+
"call-signature", pos, implicit)
1036+
else:
1037+
return None
1038+
10241039
elif pos >= 2 and style in (self.identifier_style, self.keyword_style):
10251040
# 2 character trigger for local symbols
10261041
if DEBUG:
@@ -1047,7 +1062,7 @@ def trg_from_pos(self, pos, implicit=True):
10471062
preceeding_text = accessor.text_range(start, last_pos-2).strip()
10481063
if preceeding_text:
10491064
first_word = preceeding_text.split(" ")[0]
1050-
if first_word in ("class", "def", "import", "from", "except"):
1065+
if first_word in ("class", "def", "import", "from", "except", "raise"):
10511066
if DEBUG:
10521067
print(" no trigger, as starts with %r" % (first_word, ))
10531068
# Don't trigger over the top of another trigger, i.e.

codeintel/process.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@
6464
if sys.platform != "win32" and sys.version_info[0] != 3:
6565
log.warn("Could not import subprocess32 module, falling back to subprocess module")
6666

67+
try:
68+
from xpcom import components
69+
except ImportError as e:
70+
class components:
71+
@staticmethod
72+
def ProxyToMainThread(fn):
73+
return fn
6774

6875
CREATE_NEW_CONSOLE = 0x10 # same as win32process.CREATE_NEW_CONSOLE
6976
CREATE_NEW_PROCESS_GROUP = 0x200 # same as win32process.CREATE_NEW_PROCESS_GROUP
@@ -227,6 +234,8 @@ def terminate(self):
227234
Popen = WindowsKillablePopen
228235

229236
class ProcessOpen(Popen):
237+
238+
@components.ProxyToMainThread
230239
def __init__(self, cmd, cwd=None, env=None, flags=None,
231240
stdin=PIPE, stdout=PIPE, stderr=PIPE,
232241
universal_newlines=True):

codeintel/test2/test_python.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,15 @@ def test_complete_available_exceptions(self):
620620
#self.assertTriggerMatches("\texcept Ex<|>",
621621
# name=name, implicit=False)
622622

623+
self.assertTriggerMatches("raise <|>",
624+
name=name)
625+
self.assertTriggerMatches(" raise <|>",
626+
name=name)
627+
self.assertTriggerMatches("\traise <|>",
628+
name=name)
629+
#self.assertTriggerMatches("\traise Ex<|>",
630+
# name=name, implicit=False)
631+
623632
def test_complete_magic_symbols(self):
624633
name = "%s-complete-magic-symbols" % self.lang.lower()
625634
self.assertTriggerMatches("__<|>", name=name, symbolstype="global")

0 commit comments

Comments
 (0)