Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338583 - [Documentation] Explain how to extend/customize auto edit and partitioning (was: Multiple MultiLineTerminalsEditStrategy can be applied)
Summary: [Documentation] Explain how to extend/customize auto edit and partitioning (w...
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-01 15:10 EST by Ed Willink CLA
Modified: 2012-08-13 04:09 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2011-03-01 15:10:05 EST
2.0M5 and a bit.

The AutoEdit strategies use a simple partitioning that can fail.

As a result the backwards search may find, with the aid of comment content, multiple 'unclosed' (), [], {}, /* */ etc.

As a result a new line may perform multiple multipleline insertions. I've seen 4! with the DefaultAutoEditStrategy.

Surely at most one, for the narrowest range should apply?
Comment 1 Sebastian Zarnekow CLA 2011-03-01 15:20:42 EST
Please provide a sample input file including the cursor position that fails with teh default auto edit strategies. Thanks.
Comment 2 Ed Willink CLA 2011-03-01 16:13:52 EST
With M5 plus the latest N-builds of Xtext, OCL: editing 

/org.eclipse.ocl.examples.xtext.tests/src/org/eclipse/ocl/examples/test/xtext/models/OCL-2.3.oclstdlib

goto to end of file
place cursor after final **/
hit return 

inserts

)*

)*/

when just a new line was appropriate.
Comment 3 Sebastian Zarnekow CLA 2011-03-01 16:21:05 EST
Could you please attach the complete file or provide an http url to it? Thanks in advance.

Did you define own terminal rules in your OCL language? If yes - did you customize / configure the document partitioning accordingly (see org.eclipse.xtext.ui.editor.model.TerminalsTokenTypeToPartitionMapper)?
Comment 4 Ed Willink CLA 2011-03-02 12:20:28 EST
(In reply to comment #3)
> Could you please attach the complete file or provide an http url to it? Thanks
> in advance.
> 
> Did you define own terminal rules in your OCL language? If yes - did you
> customize / configure the document partitioning accordingly (see
> org.eclipse.xtext.ui.editor.model.TerminalsTokenTypeToPartitionMapper)?

The grammar with terminal in is:

http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.mdt/org.eclipse.ocl/examples/org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/EssentialOCL.xtext?root=Modeling_Project&view=log

An extending grammar demonstrating the problem is:

http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.mdt/org.eclipse.ocl/examples/org.eclipse.ocl.examples.xtext.oclstdlib/src/org/eclipse/ocl/examples/xtext/oclstdlib/OCLstdlib.xtext?root=Modeling_Project&view=log

I suspect that one my definitions of /**...**/ documentation comments as distinct from /*...*/ comments and/or /'...'/ multi-line strings is interacting badly. Perhaps my grammar is stupid, perhaps it's just not what you anticipated, perhaps my subsequent value converters or cross reference setializers are ill-matched.

As well as bad new-line behaviour, I also get very bad single quoted string editing; auto-edit invariably provides the opposite polarity insert/delete to what is required.
Comment 5 Ed Willink CLA 2011-03-02 17:35:34 EST
It looks like use of the default TerminalsTokenTypeToPartitionMapper is incompatible with custom terminals; my partitioning seems pretty wierd.

Perhaps this is a WONTFIX/INVALID idiotic user.

Perhaps you want to try to auto-generate a TerminalsTokenTypeToPartitionMapper, or at least diagnose the user idiocy.
Comment 6 Sven Efftinge CLA 2011-03-03 02:47:13 EST
This is something for the documentation.