Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 103093

Summary: spell checking of bugzilla comments
Product: z_Archived Reporter: Mik Kersten <mik.kersten>
Component: MylynAssignee: Jeff Pound <jeff.bagu>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P4 CC: ekuleshov, gunnar, jeff.bagu, mlists, robert.elves
Version: 0.3Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 51444    
Bug Blocks:    
Attachments:
Description Flags
Broken spell check, annotations don't show up.
none
mylar/context/zip
none
mylar/context/zip none

Description Mik Kersten CLA 2005-07-07 17:56:25 EDT
I think that it is really easy to add spell checking to a text editor in 
Eclipse, so it would be cool if we could have this in the bug editor.
Comment 1 Mik Kersten CLA 2005-07-25 18:47:35 EDT
If this is easy enough it might be a fun thing to add next week.  Whenever I 
tell people about this possibility they like the idea.
Comment 2 Shawn Minto CLA 2005-07-26 15:13:23 EDT
It turns out that this isn't as easy as originally thought.  First of all, we
need to make out own dialog for displaying potential matches, etc.  This really
isn't a huge problem though.  The big problem is that the suggestions that are
given in the java editor via quick fix are actually hacked in.  There is a note
in the source code for JavaSpellingProblem.getProposals() that they have not
properly implemented the class.  This is the only kind of problem that we get,
so we will either need to do a major hack like they did, or leave this for now.
Comment 3 Mik Kersten CLA 2005-07-27 17:06:35 EDT
I agree that hacking it in is a lame solution.  I think that we can expect the 
workbench/text stuff to offer spell-checking functionality at some point, and 
then we can use that.  This certainly isn't worth doing if it takes any 
substantial work (so lowering to P4).  However, let's revisit this sometime in 
the 0.4 cycle to see if we want to raise an enhancement request for them to 
generalize the spell-checking support.
Comment 4 Shawn Minto CLA 2005-07-27 17:10:25 EDT
The truth is is that this is generalized with interfaces in 
org.eclipse.ui.texteditor.spelling as well as some managers, but only jdt does 
any implementing.  Also, Eclipse does not ship with a "dictionary" and the 
users must add it themselves to get the spelling to work properly.
Comment 5 Mik Kersten CLA 2006-06-08 21:18:35 EDT
Jeff, this could be another task of interest.  I would love to stop making typos in my bug posts ;)
Comment 6 Jeff Pound CLA 2006-06-09 19:01:37 EDT
Sure, I'll add it to my "todo" list.
Comment 7 Mik Kersten CLA 2006-06-09 20:59:13 EDT
Since you should be using Mylar as your "todo" list for the project, I'll do that for you :)

Do you have a query set up in your Task List for all reports assigned to you?  
Comment 8 Jeff Pound CLA 2006-06-11 18:32:08 EDT
Yeah, i have mylar set up with query tasks for everything Im working on. My todo list is my mental copy of my active tasks ;)
Comment 9 Mik Kersten CLA 2006-08-02 01:38:59 EDT
I just enabled spell checking for the Java editor, mostly following the instructions here: http://www.javalobby.org/java/forums/t17453.html

Can't we at least get the squiggly highlighting in like the Java editor did?  The spelling preference apparently makes the functionality available to all text editors, and Rob's latest editor improvements brought us more in line with those.
Comment 10 Mik Kersten CLA 2006-08-02 02:25:35 EDT
I figured that the JDT folks would have wanted spell checking to work for the UI stuff... just tried it and even though it does not work for plain text files, it does work for Strings in .properties files.  So this behavior is indeed available to other text editors.
Comment 11 Jeff Pound CLA 2006-08-10 13:05:15 EDT
Update: I have a spelling reconciler in place for tasks and it currently gets called as the user finishes a typing run. However there are 2 main issues for completeing spell checking.

  
1. Annotation Model (Form Editor vs. Text Editor):
  The JDT (and .properties) spell checking is based on accessing a TextEditor (primarily to retrieve the annotation model). Since the task editor is a FormEditor, we don't have that attribute. This is necessary to mark spelling errors.
  
2. Task Comment Configuration
  The reconciler I've put in for tasks is a modified version of the one used for .properties configurations. We'll need to create a configuration for task comments. I'll look into creating one but it would be a whole lot easier to do if we had the annotation support :)
  
  
*Note on the .properties editor:
  This editor is actually part of the JDT and essentially just uses the JDT's internal spell checking capabilities with the JDT's .properties configuration.
  
Comment 12 Jeff Pound CLA 2006-08-10 13:15:32 EDT
ok, scratch number 2 off the list. Treating our editors document as a regular text type works. Now we just need annotations to mark the errors and we'll have spell checking!

(I can currently test it by printing the spelling errors to std err)
Comment 13 Robert Elves CLA 2006-08-10 13:34:00 EDT
Awesome.  It looks like our RepositoryTextViewer (which extends SourceViewer) can have annotations. No?
Comment 14 Jeff Pound CLA 2006-08-10 15:00:23 EDT
It seems that it is capable of having them, however the annotation model will not get created unless the SourceViewer has a "VerticalRuler" or an "OverviewRuler"
(see SourceViewer#setDocument(IDocument, IAnnotationModel, int, int)). Otherwise the model is always null.

I tried creating a vertical ruler and an annotation model to be set in the viewer and passed along to the reconciler, but the annotations don't show up. A debug session shows that they are being created from the misspelled words, but the UI bit isn't working.

I'll post a patch of what I have, maybe someone with some annotation experience can see the problem.
Comment 15 Jeff Pound CLA 2006-08-10 15:02:31 EDT
Created attachment 47718 [details]
Broken spell check, annotations don't show up.

Adding the vertical ruler also messes up the text boxes in the editor, beware!
Comment 16 Jeff Pound CLA 2006-08-10 15:03:44 EDT
Created attachment 47719 [details]
mylar/context/zip
Comment 17 Robert Elves CLA 2006-08-23 15:16:46 EDT
Thanks for posting this Jeff, I'll take a look at this today.
Comment 18 Robert Elves CLA 2006-08-25 15:16:04 EDT
Fixed. The overview and gutter rulers are disabled by default. 

Enabling spell checking in Eclipse:
http://www.javalobby.org/java/forums/t17453.html

Adding annotations to a source viewer:
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg19676.html
Comment 19 Robert Elves CLA 2006-08-25 15:16:08 EDT
Created attachment 48766 [details]
mylar/context/zip
Comment 20 Mik Kersten CLA 2006-08-25 15:35:11 EDT
Rob, you should put those instructions in the FAQ, probably as a last section under Setup called "Spell checking"
Comment 21 Eugene Kuleshov CLA 2006-08-25 16:32:02 EDT
Look really cool! 

However, spell checking should be alos enabled for the following elements:

-- task notes on planning tab
-- description on new task editor (bugzilla and others)
-- summary in task editor (bugzilla and others)

It would be also neat to have completion proposal for fixing those error...
Comment 22 Robert Elves CLA 2006-08-25 17:07:06 EDT
- Planning notes and (editable) description fields should have spell checking support already
- Created new bug report to address summary field ( bug#155278 )
- Created new bug report to address presentation of spelling recommendations ( bug#155280 )
Comment 23 Eugene Kuleshov CLA 2006-08-25 19:05:58 EDT
I see it now in the Notes and in Description for new bugzilla task , but not in the Description field for local task.
Comment 24 Robert Elves CLA 2006-08-25 19:19:30 EDT
Yes, description on local tasks is using standard text. Could you tack that on to bug#155278 ?