mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Better SyntaxError listings
This commit is contained in:
@@ -8,3 +8,7 @@ API Return Classes
|
|||||||
.. automodule:: jedi.api.classes
|
.. automodule:: jedi.api.classes
|
||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
|
|
||||||
|
.. autoclass:: jedi.api.errors.SyntaxError
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
|||||||
@@ -581,7 +581,9 @@ class Script(object):
|
|||||||
|
|
||||||
def get_syntax_errors(self):
|
def get_syntax_errors(self):
|
||||||
"""
|
"""
|
||||||
XXX
|
Lists all syntax errors in the current file.
|
||||||
|
|
||||||
|
:rtype: list of :class:`.SyntaxError`
|
||||||
"""
|
"""
|
||||||
return parso_to_jedi_errors(self._inference_state.grammar, self._module_node)
|
return parso_to_jedi_errors(self._inference_state.grammar, self._module_node)
|
||||||
|
|
||||||
|
|||||||
@@ -14,18 +14,22 @@ class SyntaxError(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def line(self):
|
def line(self):
|
||||||
|
"""The line where the error starts (starting with 1)."""
|
||||||
return self._parso_error.start_pos[0]
|
return self._parso_error.start_pos[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def column(self):
|
def column(self):
|
||||||
|
"""The column where the error starts (starting with 0)."""
|
||||||
return self._parso_error.start_pos[1]
|
return self._parso_error.start_pos[1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def until_line(self):
|
def until_line(self):
|
||||||
|
"""The line where the error ends (starting with 1)."""
|
||||||
return self._parso_error.end_pos[0]
|
return self._parso_error.end_pos[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def until_column(self):
|
def until_column(self):
|
||||||
|
"""The column where the error ends (starting with 0)."""
|
||||||
return self._parso_error.end_pos[1]
|
return self._parso_error.end_pos[1]
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user