Code Rewriting Tools
Last updated
Last updated
This section covers several essential tools designed to aid developers in managing and modifying their code efficiently.
Near the top of the Script Editor context menu is the Revert File
command. Revert File
resets an unsaved script to the last saved change.
Servoy keeps a record of all saved changes to a file.
Use the Compare With
command towards the bottom of the context menu in Script Editor. A file revision history will be shown on the right History view, with the last saved dates and times.
Double-click on your desired save date/time. The Script Editor will show a split pane window containing the current and previous versions, along with change indicators and navigational buttons to assist you in reviewing changes.
Use the buttons on the top right of the comparison editor window to scroll through and make changes to the original file:
a = Swap Left and Right view
b = Copy all non-conflicting differences from right to left
c = Copy current (selected difference) from right to left
d = Next difference (scrolls through line differences)
e = Previous difference
f = Next change (jumps to actual character or piece of code that changed within a difference)
g = Previous change
Save
the file and close the compare window.
Note All changes made in the left pane will be reflected in all open instances of the file (ie, the existing editor screen), even without saving.
Note You can find more information about the Compare Editor here.
Select Replace With > Previous From Local History
from the context menu. The editor window will revert to the last saved version.
Select Replace With > Local History
. A Compare Window will appear.
Double-click on the desired date/time for the file you would like to replace the current version.
A split pane will appear highlighting the changes.
Review the changes using the navigational buttons provided.
Click on Replace
to complete the replace process.
Note In the Replace With mode, there is no option to replace each change individually.
The Toggle Block Selection feature is available from the main toolbar, next to the Mark Occurrences
button.
This feature allows users to select a block of text (column select) and make identical changes to each line. In the example below, the first four parts of the code are selected using Toggle Block Selection mode:
The selected block of text can then be replaced with new code parts, with the user typing only once.