[Bug 35613] Snippets Plugin: Cannot add snippets to languages that don't have any
Arthur Peters
amp at singingwizard.org
Sun Mar 19 16:30:10 UTC 2006
Public bug reported:
https://launchpad.net/malone/bugs/35613
Affects: gedit (Ubuntu)
Severity: Normal
Priority: (none set)
Status: Unconfirmed
Description:
In the Snippets Plugin "Snippet Manager" dialog you can only add new
snippets to languages that already have a system-wide snippets XML file.
For others, the GUI simply shows no change and the following appears on
the console:
Traceback (most recent call last):
File "/usr/lib/gedit-2/plugins/snippets/SnippetsDialog.py", line 431, in on_cell_edited
snippet = self.new_snippet({'description': new_text})
File "/usr/lib/gedit-2/plugins/snippets/SnippetsDialog.py", line 359, in new_snippet
self.language_path), properties)
File "/usr/lib/gedit-2/plugins/snippets/SnippetsLibrary.py", line 638, in new_snippet
library = self.get_user_library(language)
File "/usr/lib/gedit-2/plugins/snippets/SnippetsLibrary.py", line 620, in get_user_library
for library in self.libraries[language]:
KeyError: 'pascal'
I wrote a patch (attached) that changes the mentioned
"self.libraries[language]" to "self.libraries.get(language, [])". I
tested this patch and it works. I think this is probably a good
solution, however before I thought of this I created a patch that simply
adds snippets xml files for all languages (also attach), but I never
tested it.
Thanks.
More information about the desktop-bugs
mailing list