Skip to content

Commit 93e1bdc

Browse files
Merge pull request #1566 from moosetechnology/documentation
Documentation + fix pending #1565
2 parents 2530d08 + 8fbd849 commit 93e1bdc

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

src/MooseIDE-BulkEditor/MiBulkEditor.class.st

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
"
2-
Bulk editor on a Java file: comment out a collection of methods
2+
Bulk editor on Java files: comment out or remove a collection of methods
33
Can be applied for example on dead methods:
44
- compute all dead methods in a file -> `deadMethodCollection`
55
- call: `MiBulkEditor new runOn: deadMethodCollection.`
6-
- Output the resulting lines in a file
6+
7+
The following will comment out or remove a list of methods from their respective source files
78
```
89
bulkEditor := MiBulkEditor new.
9-
bulkEditor runOn: deadMethods.
10-
file := 'SomeFile.java' asFileReference.
11-
file ifExists: [ file delete ].
12-
file writeStreamDo: [ :st | bulkEditor lines do: [ :line | st << line ; cr ] ].
10+
bulkEditor runOn: <deadMethodCollection>.
1311
```
12+
13+
The default is to comment out the methods: `bulkEditor commentLines`
14+
The editor can be instructed to remove the methods from their files: `bulkEditor removeLines`
1415
"
1516
Class {
1617
#name : 'MiBulkEditor',

src/MooseIDE-Famix/MiSourceTextRendererModel.class.st

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ MiSourceTextRendererModel >> addKeywordHighlight: anInterval [
8686

8787
{ #category : 'highlights' }
8888
MiSourceTextRendererModel >> clearHighlightsInComments [
89-
89+
"note: potential issue here as #clearNoncommentHighlightFrom:to: modifies the list of highlights
90+
However, it should remove only non-comment highlights, so in the end there is no harm done"
9091
self highlights copy do: [ :highlight |
9192
(highlight class = MiSourceTextCommentHighlight)
9293
ifTrue: [
@@ -142,6 +143,8 @@ MiSourceTextRendererModel >> createHighlights [
142143
self prepareSourceAnchorAdapter.
143144
self createKeywordHighlights.
144145
self createEntitiesHighlightsFor: entity.
146+
"bypassing bug in #createEntitiesHighlightsFor:"
147+
self highlights removeAllSuchThat: [ :hglght | hglght hasInterval not ].
145148
self clearHighlightsInComments
146149
]
147150

@@ -163,7 +166,7 @@ MiSourceTextRendererModel >> createKeywordHighlights [
163166
{ #category : 'highlights' }
164167
MiSourceTextRendererModel >> createKeywordHighlightsFor: aKeyWord [
165168
"Search for a keyword in the displayedText and creates a keyWordHighlight for it
166-
keywords should be whole words (after and before a word separator) or strat the text or end it"
169+
keywords should be whole words (after and before a word separator) or start the text or end it"
167170

168171
| matcher |
169172

src/MooseIDE-Tests/MiSourceTextRendererModelTest.class.st

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,17 @@ MiSourceTextRendererModelTest >> testHighlightChildWithIndexedFileAnchor [
129129

130130
{ #category : 'tests - highlighting' }
131131
MiSourceTextRendererModelTest >> testHighlightChildWithNoAnchor [
132+
"Although it uses FamixStClass and FamixStMethod, the code given in sourceAnchor is not
133+
formated as normal Pharo code.
134+
This is not a problem as long the entities' names are found in it"
135+
132136
| entity |
137+
133138
entity := FamixStClass new
134139
name: 'aClass' ;
135140
sourceAnchor: (self stubIndexedAnchorText:
136141
'code of aClass {
137-
code of aMethod()
142+
code of aClass >> aMethod()
138143
}').
139144
FamixStMethod new
140145
name: 'aMethod' ;
@@ -147,10 +152,6 @@ MiSourceTextRendererModelTest >> testHighlightChildWithNoAnchor [
147152
self assert: highlight class equals: MiSourceTextIdentifierHighlight
148153
].
149154

150-
"one highlight has an interval, the other not"
151-
self assert: (rendererModel highlights anySatisfy: #hasInterval).
152-
self assert: (rendererModel highlights anySatisfy: [ :highlight | highlight hasInterval not]).
153-
154155
]
155156

156157
{ #category : 'tests - highlighting' }

0 commit comments

Comments
 (0)