editorconfig / editorconfig-gedit

EditorConfig plugin for Gedit
http://editorconfig.org
Other
54 stars 13 forks source link

`GeditDocument' does not have property `newline-type' #15

Closed webmaster128 closed 4 years ago

webmaster128 commented 7 years ago

After installing version 0.5.3 of this plugin and the core lib EditorConfig-0.12.1-py3-none-any.whl from pip3, I the the following error when opening a document

Traceback (most recent call last):
  File "/home/me/.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 "/home/me/.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'

Gedit 3.18.3 from Ubuntu 16.04.

xuhdev commented 7 years ago

It's a bit weird. Looks like newline-type is clearly defined as a property of GeditDocument: https://developer.gnome.org/gedit/3.0/gedit-gedit-document.html

webmaster128 commented 7 years ago

I don't have a clue how gedit development is organized, but if this commit from June 2014 landed in the software, the property was removed: https://mail.gnome.org/archives/commits-list/2014-June/msg07239.html

The property was documented up to 3.12 but is missing starting with 3.14.

Do you know what The property has been migrated to GtkSourceFile. means? Can GtkSourceFile be used instead?

TriMoon commented 6 years ago

@webmaster128 Do you know what The property has been migrated to GtkSourceFile. means? Can GtkSourceFile be used instead?

It means it is replaced by GtkSourceFile, you need to check it's use if it is "a drop-in compatible" property with the old one...

ferdnyc commented 4 years ago

I know this is a very old issue, but as I'm about to submit a PR to not-address this (meaning, silently ignore end_of_line due to the loss of newline-type), I thought I'd also share the findings that led me to that point.

Several properties of GeditDocument, including newline-type, were deprecated in Gedit 3.14 "Due to a new file loading and saving API in GtkSourceView".

The replacement for the GeditDocument.newline-type property, as noted, is GtkSourceFile.newline-type.

GtkSourceFile.newline-type is a read-only property.

Gedit 3.14+ no longer provides any means of setting the line-ending mode, only of querying it. There is, therefore, nothing editorconfig-gedit can do except to ignore end_of_line.

Hence PR #23, which I'm already applying to the gedit-plugin-editorconfig package in Fedora.