Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:07 Go to next message
Benjamin Schwertfeger is currently offline Benjamin SchwertfegerFriend
Messages: 53
Registered: July 2009
Member
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 10:36 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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 19:54 Go to previous messageGo to next message
Benjamin Schwertfeger is currently offline Benjamin SchwertfegerFriend
Messages: 53
Registered: July 2009
Member
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 21:13 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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 11:07 Go to previous messageGo to next message
Roberto Lo Giacco is currently offline Roberto Lo GiaccoFriend
Messages: 17
Registered: April 2012
Junior Member
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 13:13 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Wait for Xtext 2.3.0 it has built in support for that.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Validating unused declarations
Next Topic:Problems with formatting rules
Goto Forum:
  


Current Time: Wed Apr 24 22:58:07 GMT 2024

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

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

Back to the top