editorconfig-gedit: TypeError GeditDocument does not have property `newline-type' #252

Open
TomEubank opened this Issue Jan 30, 2016 · 0 comments

Projects

None yet

2 participants

@TomEubank
TomEubank commented Jan 30, 2016 edited

With editorconfig-gedit installed, gedit generates many instances of the following error:

    File "~/.local/share/gedit/plugins/editorconfig_plugin/shared.py", line 40, in set_config
      self.set_end_of_line(document, props.get('end_of_line'))
    File "~/.local/share/gedit/plugins/editorconfig_plugin/shared.py", line 81, in set_end_of_line
      document.set_property('newline-type', 0)
    TypeError: object of type `GeditDocument' does not have property `newline-type'

To correct the problem, I made the following changes to editorconfig_plugin/shared.py:

    diff  $OLD $NEW
    80,85c80,88
    <         if end_of_line == "lf":
    <             document.set_property('newline-type', 0)
    <         elif end_of_line == "cr":
    <             document.set_property('newline-type', 1)
    <         elif end_of_line == "crlf":
    <             document.set_property('newline-type', 2)
    ---
    >         try:
    >             if end_of_line == "lf":
    >                 document.set_property('newline-type', 0)
    >             elif end_of_line == "cr":
    >                 document.set_property('newline-type', 1)
    >             elif end_of_line == "crlf":
    >                 document.set_property('newline-type', 2)
    >         except TypeError: 
    >             pass

System Configuration

  • Debian GNU/Linux 8 (jessie) 64-bit
  • Gnome Version 3.14.1
  • gedit Version 3.14.0-3, gedit-plugins 3.14.0-2
  • Python 3.4.2
  • EditorConfig Python Core Version 0.12.0
  • editorconfig-gedit-0.5.3


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@xuhdev xuhdev self-assigned this Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment