Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333322 - Syntax Coloring - Not colored in some cases
Summary: Syntax Coloring - Not colored in some cases
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 430312
Blocks:
  Show dependency tree
 
Reported: 2010-12-29 19:59 EST by Toshihiro Izumi CLA
Modified: 2020-05-14 11:08 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 Toshihiro Izumi CLA 2010-12-29 19:59:12 EST
'Deprecated members' for example

Steps to reproduce:
1. Reset syntax coloring (Restore Defaults)
2. Edit php script as
|<?php
|/**
| * @deprecated
| */
|class Foo {}
|?>
(now you can see "Foo" with strikethrough)
3. Open Preferences>PHP>Editor>Syntax Coloring
4. Enable 'Classes' (select 'Classes' and check 'Enable')
5. Check 'Bold'
6. Click 'OK' to close preference

=> Now you can see "Foo" in bold, not with strikethrough [NG]

7. Delete "@deprecated"
8. Undo delete

=> Now you can see "Foo" with strikethrough [OK]

9. Edit script as
|class Foo {-}
10. Undo edit (revert to "class Foo {}")

=> Now you can see "Foo" in bold, not with strikethrough [NG]
Comment 1 Toshihiro Izumi CLA 2010-12-29 20:37:21 EST
The main reason is...
1. "Foo" has "Classes" and "Deprecated members" highlightings.
2. org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingReconciler ignores existed same highlighting.

step2 above,
    Foo has [Deprecated] => Deprecated
step6,
    Foo has [Classes]+[Deprecated(=previous Deprecated)]
	    => reconciler rejects [Deprecated] because same one existed => Classes
step8,
    Foo has [Classes(!=previous Classes)]+[Deprecated] => Deprecated
step10,
    Foo has [Classes]+[Deprecated(=previous Deprecated)]
	    => reconciler rejects [Deprecated] because same one existed => Classes


Workaround?
org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingReconciler.addPosition(Position, HighlightingStyle, boolean)

	private void addPosition(Position position, HighlightingStyle highlighting, boolean isReadOnly) {
		boolean isExisting = false;
		// TODO: use binary search
/* delete loop since this doesn't care priority of multi highlightings */
//		for (int i = 0, n = fRemovedPositions.size(); i < n; i++) {
//			HighlightedPosition highlightedPosition = (HighlightedPosition) fRemovedPositions.get(i);
//			if (highlightedPosition == null)
//				continue;
//			if (highlightedPosition.isEqual(position, highlighting)) {
//				isExisting = true;
//				fRemovedPositions.set(i, null);
//				fNOfRemovedPositions--;
//				break;
//			}
//		}
		if (!isExisting) {
			fAddedPositions.add(fJobPresenter.createHighlightedPosition(position, highlighting, isReadOnly));
		}
	}
Comment 2 Dawid Pakula CLA 2014-06-05 08:30:05 EDT
This was fixed in latest SSE (luna release):
http://git.eclipse.org/c/sourceediting/webtools.sourceediting.git/commit/?id=2f0f662df276264f8e3119843b283099e40e28ef
Comment 3 Sylvia Tancheva CLA 2015-05-29 11:15:51 EDT
I can still reproduce the last case (points 9 and 10):

9. Edit script as
|class Foo {-}
10. Undo edit (revert to "class Foo {}")

=> Now you can see "Foo" in bold, not with strikethrough [NG]

I need do close-reopen the file to see it back with strikethrough (nightly from 27.05.2015). Reopening the bug
Comment 4 Eclipse Genie CLA 2016-05-02 06:52:44 EDT
New Gerrit change created: https://git.eclipse.org/r/71768
Comment 6 Thierry BLIND CLA 2016-05-02 10:53:06 EDT
Merged patch https://git.eclipse.org/r/71768 corrects only a part of the problem, this bug report also depends on bug 430312 and can be closed once patch from bug 430312 was merged.

Thierry.
Comment 7 Thierry BLIND CLA 2019-06-18 10:47:15 EDT
Bug 430312 was fixed, close this one now.

Thierry.