Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Spell checking for Strings(Activate spell checking for Strings in Xtext models)
Spell checking for Strings [message #551406] Fri, 06 August 2010 06:07 Go to next message
Eclipse UserFriend
Hello,
I'ld like to enable spell checking in my dsl for some Elements, like Strings. I think about two possible ways.

1. Writing a cusom reconciler, which enable spell checking and delegates to the XtextReconciler. In this approach I've to access the parsed model, to see the elements at the changed positions.

2. Write a custom Validator which calls the spell checker, for the Strings of one element. Because the spell checking result is neither a error nor a warning or an information, but an additional type of marker, I need a way to get the annotationModel in the validator.

Is there a third, better way, for doing this?

Regards,

Benjamin
Re: Spell checking for Strings [message #551414 is a reply to message #551406] Fri, 06 August 2010 06:36 Go to previous messageGo to next message
Eclipse UserFriend
Hi Benjamin,

I'ld try to collect the regions of all strings and comments, that should
be checked, in the validator. Use SpellingService#check() with a mocked
document that supports the minimal required methods (like
getLegalLineDelimiters and get(offset, length)) and a
ISpellingProblemCollector that transforms the spelling problems into
warnings.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 06.08.10 12:07, schrieb Benjamin Schwertfeger:
> Hello,
> I'ld like to enable spell checking in my dsl for some Elements, like
> Strings. I think about two possible ways.
>
> 1. Writing a cusom reconciler, which enable spell checking and delegates
> to the XtextReconciler. In this approach I've to access the parsed
> model, to see the elements at the changed positions.
>
> 2. Write a custom Validator which calls the spell checker, for the
> Strings of one element. Because the spell checking result is neither a
> error nor a warning or an information, but an additional type of marker,
> I need a way to get the annotationModel in the validator.
>
> Is there a third, better way, for doing this?
>
> Regards,
>
> Benjamin
Re: Spell checking for Strings [message #551859 is a reply to message #551414] Mon, 09 August 2010 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
thanks for the recommendation. I tried to implement a JavaCheck for this scenario, but the SpellingService is inside the ui packages and needs the viewer.

I took the first approach and extended the xtextReconciler to set the document for the spellingReconciler. I modified the SpellingProblemCollector and took the Range from the Terminals in the ParseResult to check only user modifiable text.

Benjamin
Re: Spell checking for Strings [message #552111 is a reply to message #551859] Tue, 10 August 2010 17:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi Benjamin,

you are free to extend the java validator in the ui package although it
would not check the spelling in the standalone scenario.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 09.08.10 21:54, schrieb Benjamin Schwertfeger:
> Hello,
> thanks for the recommendation. I tried to implement a JavaCheck for this
> scenario, but the SpellingService is inside the ui packages and needs
> the viewer.
>
> I took the first approach and extended the xtextReconciler to set the
> document for the spellingReconciler. I modified the
> SpellingProblemCollector and took the Range from the Terminals in the
> ParseResult to check only user modifiable text.
>
> Benjamin
Re: Spell checking for Strings [message #873031 is a reply to message #551859] Thu, 17 May 2012 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Do you mind to share your implementation? I'm facing the same issue here with Xtext 2.1 and I'm struggling trying to replicate your solution. Some code will probably help.

Thanks
Re: Spell checking for Strings [message #873074 is a reply to message #873031] Thu, 17 May 2012 09:13 Go to previous message
Eclipse UserFriend
Wait for Xtext 2.3.0 it has built in support for that.
Previous Topic:Validating unused declarations
Next Topic:Problems with formatting rules
Goto Forum:
  


Current Time: Wed Jul 23 16:47:11 EDT 2025

Powered by FUDForum. Page generated in 0.08693 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top