From a93f43c0027ddc1b50715890de5393be6f9f53d5 Mon Sep 17 00:00:00 2001 From: DEMAREY Christophe Date: Fri, 22 Mar 2024 22:44:44 +0100 Subject: [PATCH 1/2] enable / disable syntax highlight in code presenter of critics browser. Fixes https://github.com/pharo-project/pharo/issues/16290 --- ...tSingleCritiqueResultListPresenter.class.st | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st b/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st index d1f6d10d1..8a42b21e5 100644 --- a/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st +++ b/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st @@ -341,7 +341,10 @@ StSingleCritiqueResultListPresenter >> isCritiqueToDo [ { #category : 'initialization' } StSingleCritiqueResultListPresenter >> newSourceCodeCritique [ - ^ SpCodePresenter new beNotEditable. + ^ SpCodePresenter new + beNotEditable; + withoutSyntaxHighlight; + yourself ] { #category : 'initialization' } @@ -414,10 +417,13 @@ StSingleCritiqueResultListPresenter >> setTextModelForClassOrMethod: aCritique [ entity := aCritique sourceAnchor entity. self flag: 'Another hack. We need a better way to display entities (because now we may get not only classes and methods. Maybe something like GTInspector presentations could work)'. - sourceCodeModel text: entity asString. - sourceCodeModel behavior: (entity isCompiledMethod + sourceCodeModel beForBehavior: (entity isCompiledMethod ifTrue: [ entity methodClass ] ifFalse: [ nil ]). + + sourceCodeModel + withSyntaxHighlight; + text: entity asString. aCritique sourceAnchor providesInterval ifTrue: [ sourceCodeModel selectionInterval: aCritique sourceAnchor interval ] ] @@ -429,8 +435,10 @@ StSingleCritiqueResultListPresenter >> setTextModelForNil [ text := rule rationale isEmpty ifTrue: [ rule name ] ifFalse: [ rule rationale ]. - sourceCodeModel text: text. - sourceCodeModel behavior: nil. + sourceCodeModel + withoutSyntaxHighlight; + text: text; + behavior: nil. toolbarModel critique: nil ] From 6e07d8655f50130718bef37c73af3b05367259fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Sat, 23 Mar 2024 20:21:29 +0100 Subject: [PATCH 2/2] Update StSingleCritiqueResultListPresenter.class.st removed the self flag: --- .../StSingleCritiqueResultListPresenter.class.st | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st b/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st index 8a42b21e5..cc11edda3 100644 --- a/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st +++ b/src/NewTools-CodeCritiques/StSingleCritiqueResultListPresenter.class.st @@ -415,8 +415,6 @@ StSingleCritiqueResultListPresenter >> setTextModelForClassOrMethod: aCritique [ | entity | entity := aCritique sourceAnchor entity. - self flag: - 'Another hack. We need a better way to display entities (because now we may get not only classes and methods. Maybe something like GTInspector presentations could work)'. sourceCodeModel beForBehavior: (entity isCompiledMethod ifTrue: [ entity methodClass ] ifFalse: [ nil ]).