diff --git a/docs/docs/api-classes.rst b/docs/docs/api-classes.rst index 9feec1c6..30cc365b 100644 --- a/docs/docs/api-classes.rst +++ b/docs/docs/api-classes.rst @@ -8,3 +8,7 @@ API Return Classes .. automodule:: jedi.api.classes :members: :undoc-members: + +.. autoclass:: jedi.api.errors.SyntaxError + :members: + :undoc-members: diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 0cee442e..89ad2fda 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -581,7 +581,9 @@ class Script(object): 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) diff --git a/jedi/api/errors.py b/jedi/api/errors.py index e86f9212..61f7ec07 100644 --- a/jedi/api/errors.py +++ b/jedi/api/errors.py @@ -14,18 +14,22 @@ class SyntaxError(object): @property def line(self): + """The line where the error starts (starting with 1).""" return self._parso_error.start_pos[0] @property def column(self): + """The column where the error starts (starting with 0).""" return self._parso_error.start_pos[1] @property def until_line(self): + """The line where the error ends (starting with 1).""" return self._parso_error.end_pos[0] @property def until_column(self): + """The column where the error ends (starting with 0).""" return self._parso_error.end_pos[1] def __repr__(self):