Spell checking for custom construct - DocumentPartitioner is confused [message #895957] |
Mon, 16 July 2012 12:15  |
Eclipse User |
|
|
|
Hi,
after happily migrating to Xtext 2.3 and enjoying the compatibility with Eclipse 3.7.2 I added support for spell checking into my tool.
Since I need spellchecking for a custom syntax element (none of the predefined COMMENT rules) I had to apply some tweaks which now cause the DocumentPartitioner to log this error
ERROR org.eclipse.xtext.ui.editor.model.DocumentPartitioner - Detected unexpected state in document partitioner. Please file a bug with the following information attached:
Document content after the event was applied:
>>> content of my file
<<<
Document event: offset: 375, length: 1, timestamp: 3
text:><
Is this a bug in xtext or is that caused by one of my customizations?
Basically I did 3 things:
1. write and bind my own AntlrTokenToAttributeIdMapper, copied mainly from DefaultAntlrTokenToAttributeIdMapper and adding my elements to calculateId()
2. let the same class implement ITokenTypeToPartitionTypeMapper and bind it for this type, too.
-- getPartitionType() has the same implementation as TerminalsTokenTypeToPartitionMapper
-- getSupportedPartitionTypes() returns an array of only two elements: the id of the element where spell-checking should be supported and IDocument.DEFAULT_CONTENT_TYPE
3. write my own SpellingReconcileStrategy extends XtextSpellingReconcileStrategy and override shouldProcess()
-- bind this directly plus a factory that creates instances of it.
Effect:
- syntax highlighting for this element works OK
- spell checking works exactly as desired.
- error is logged as shown.
Should I worry? Should I file a bug? Should I change my customization (how?)?
cheers,
Stephan
|
|
|
Re: Spell checking for custom construct - DocumentPartitioner is confused [message #896432 is a reply to message #895957] |
Wed, 18 July 2012 07:42   |
Eclipse User |
|
|
|
Hi Stephan,
this is a diagnostic message that tries to identify a long standing bug
with dangling error markers in Xtext editors. We spotted some suspicious
code in the document partitioner and decided to log a messages as soon
as this code is executed. It was simply to late in the Juno train to
change that crucial component.
I'd say a ticket would be helpful but otherwise you may ignore the
logged error.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 16.07.12 18:15, schrieb Stephan Herrmann:
> Hi,
>
> after happily migrating to Xtext 2.3 and enjoying the compatibility with
> Eclipse 3.7.2 I added support for spell checking into my tool.
>
> Since I need spellchecking for a custom syntax element (none of the
> predefined COMMENT rules) I had to apply some tweaks which now cause the
> DocumentPartitioner to log this error
>
> ERROR org.eclipse.xtext.ui.editor.model.DocumentPartitioner - Detected
> unexpected state in document partitioner. Please file a bug with the
> following information attached:
> Document content after the event was applied:
>>>> content of my file
> <<<
> Document event: offset: 375, length: 1, timestamp: 3
> text:><
>
>
> Is this a bug in xtext or is that caused by one of my customizations?
> Basically I did 3 things:
>
> 1. write and bind my own AntlrTokenToAttributeIdMapper, copied mainly
> from DefaultAntlrTokenToAttributeIdMapper and adding my elements to
> calculateId()
>
> 2. let the same class implement ITokenTypeToPartitionTypeMapper and bind
> it for this type, too. -- getPartitionType() has the same implementation
> as TerminalsTokenTypeToPartitionMapper
> -- getSupportedPartitionTypes() returns an array of only two elements:
> the id of the element where spell-checking should be supported and
> IDocument.DEFAULT_CONTENT_TYPE
>
> 3. write my own SpellingReconcileStrategy extends
> XtextSpellingReconcileStrategy and override shouldProcess()
> -- bind this directly plus a factory that creates instances of it.
>
> Effect:
> - syntax highlighting for this element works OK
> - spell checking works exactly as desired.
> - error is logged as shown.
>
> Should I worry? Should I file a bug? Should I change my customization
> (how?)?
>
> cheers,
> Stephan
>
|
|
|
|
|
Re: Spell checking for custom construct - DocumentPartitioner is confused [message #991073 is a reply to message #897189] |
Mon, 17 December 2012 04:56  |
Eclipse User |
|
|
|
Hello,
I encountered the same kind of error with a very simple test case.
My grammar start with a simple entry point:
Container:
'Container' (id=STRING)? '{'
[...]
'}';
But when one guy from the test team entered :
Container "Hello World //without ending double quote and neither parenthesis
and hit the back space key, he got this error
org.eclipse.xtext.ui.editor.model.DocumentPartitioner - Detected unexpected state in document partitioner. Please file a bug with the following information attached:
Document content after the event was applied:
>>>Container "Hello Worl<<<
Document event: offset: 21, length: 1, timestamp: 20
text:><
The test case is very tricky to reproduce mainly because by default the Xtext Editor automatically add the closing double quote (with both double quotes there is no Error Log entry).
I understand that I should ignore this issue and this is definitely not blocking, but I would like, at least, to hide it so the test team doesn't complain about it anymore.
Any advice/thoughts ?
Should I add my test case to the existing ticket ?
BR,
Charles Bonneau
|
|
|
Powered by
FUDForum. Page generated in 0.04322 seconds