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

Bug 358200

Summary: [Xtend] Semantic Syntax Coloring
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: Holger.Schill, sebastian.zarnekow
Version: 2.1.0Flags: sven.efftinge: indigo+
Target Milestone: SR2   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 359409    
Bug Blocks:    

Description Sven Efftinge CLA 2011-09-20 04:27:09 EDT
Especially having some visual indication whether some method call is an extension method or not, seems to be very interesting. Also the typical italics style for statics would be good.
Comment 1 Sven Efftinge CLA 2011-09-21 10:21:03 EDT
Also the following should be colored like in JDT:
 - Field declaration and references
 - Annotations
Everything which is applicable to Xbase in general should go into XbaseHighlightingCalcuator.
Comment 2 Holger Schill CLA 2011-09-22 07:19:24 EDT
pushed first version to master. 
Xtend2Fields are not handled at the moment. I will wait until Sven changes Xtend2Field to JvmField.

Please have a deeper look at the XbaseHighlightingCalculator. 
Resolving all this proxies seams to be very expensive. 
As Sebastian suggested the semantic highlighting should be invoked after linking has been done so that all proxies are already resolved.
Comment 3 Holger Schill CLA 2011-09-22 07:44:52 EDT
May be deprecated members should be highlighted like in Java. (Strikethrough && black)

Now we do handle Annotations and references to the same with only one highlightingConfigurationID. In Java they are handled with different IDs. 


Any thoughts?
Comment 4 Sven Efftinge CLA 2011-09-22 10:30:51 EDT
Looks very good :-)

The coloring of extension methods can go to Xbase as well, as we have extension method invocation there (e.g. IterableExtensions.*)

The coloring for "Field" can be overloaded like you did with annotations, such that field reference are colored like that (in Xbase) and in addition field declarations in Xtend.
Comment 5 Holger Schill CLA 2011-09-23 04:32:27 EDT
added support for fieldDeclaration in Xtend and fieldAccess in Xbase

pushed to master.
Comment 6 Sebastian Zarnekow CLA 2011-09-23 10:50:01 EDT
Just a minor remark: This code is redundant:

field.eClass().getEStructuralFeature(Xtend2Package.Literals.XTEND_FIELD__NAME.getName())

since Xtend2Package.Literals.XTEND_FIELD__NAME is already the EStructuralFeature.
Comment 7 Holger Schill CLA 2011-09-24 08:22:46 EDT
As we do not have enough informations about the state of a JvmElement concerning deprecation I will mark this bug as fixed. Please reopen if there is another concept we should highlight.
Comment 8 Sven Efftinge CLA 2011-09-26 06:06:22 EDT
We should check for @java.lang.Deprecated.

1) target of feature calls (Xbase)
2) cross references to JvmType (and subclasses) (Xbase)
3) declaration of XtendMember (only Xtend of course :-))
Comment 9 Holger Schill CLA 2011-09-28 05:26:52 EDT
Will have time on Fr. I hope.
Comment 10 Holger Schill CLA 2011-09-29 10:14:41 EDT
All the 3 different szenarios implemented. Only Bug 359409 should be resolve to see the reference to deprecated XtendMembers strikedthrough. 
Tests will follow tomorrow.

What about @deprecated in JavaDoc? Is there a way to get that information?
Comment 11 Sebastian Zarnekow CLA 2011-09-29 11:27:52 EDT
(In reply to comment #10)
> All the 3 different szenarios implemented. Only Bug 359409 should be resolve to
> see the reference to deprecated XtendMembers strikedthrough. 
> Tests will follow tomorrow.

Cool.

> What about @deprecated in JavaDoc? Is there a way to get that information?

I think the best we can do is something along these lines here:
org.eclipse.emf.mwe2.language.ui.highlighting.SemanticHighlightingCalculator.isDeprecated(JvmAnnotationTarget)

I think we should extract the code to DeprecationUtil (o.e.x.common.types.util).
Comment 12 Holger Schill CLA 2011-09-30 00:58:35 EDT
That is what I already did. :-) But I like the idea of the DeprecationUtil.

XtendAnnotationTarget is another thing we have to handle. As this is only an Xtend2 concept I will keep the implementation in org.eclipse.xtext.xtend2.ui.highlighting.XtendHighlightingCalculator and delegate to DeprecationUtil with the resolved JvmAnnotationType. May be we should have two methods in the DeprecationUtil. 

isDeprecated(JvmAnnotationTarget)

isDeprecated(JvmAnnotationType)

And delegate from the first to the second.
Comment 13 Holger Schill CLA 2011-10-03 03:40:30 EDT
pushed version with attention to @Deprecated with tests. Added a test for szenario depending on bug 359409 also but commented it out.
Comment 14 Holger Schill CLA 2011-10-10 07:18:02 EDT
Uncommented tests depending on resolve bug 359409. Now everything is fine. Feel free to reopen if there is anything to highlight.
Comment 15 Karsten Thoms CLA 2017-09-19 18:07:53 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 16 Karsten Thoms CLA 2017-09-19 18:17:26 EDT
Closing all bugs that were set to RESOLVED before Neon.0