- Auto Complete does not works on Windows2000SP1. SP2 is ok.
What are Auto Complete.
Auto Complete is the function that supports your input by suggesting the candidates.
Static Auto Complete
Statice AutoComplete use the candidates that is [AutoComplete Data Path]/*.dat. This logic is simple. When you press ".", RDE gets the word(ex. "a") that is on the left of caret, searchs back the
a = [Class].new
and gets name of classes, and find the file of the same name in the [AutoComplete Data Path]. And RDE knows the definition of String, Regexp, Array and Hash class as
a = "hoge" a = /^hoge/ a = [1,2,3] a = {1=>'hoge', 2=>'gege'}
EasyParse makes data files from the current editing file in the folder "[AutoComplete Data Path]/rde_temp/*". These files are deleted by [Ruby]-[Clear TempData].
Dynamic Auto Complete
Dynamic Auto Complete starts, when you press [Ctrl]+[Space] after letters. RDE searches words that start with the same letters in the active code window, and pushes into the candidates.
First, RDE searches back from the caret, and found any words and stop. If not found, RDE searches down from the caret.
If you checked [Options]-[CodeWindow]-[SearchAll], RDE always searches all in the active code window.
example
1. you input below.
editor1 edit2 edior3
2. Second, you input only 'ed' and press [Ctrl]+[Space].
ed
Data for static autocomplete
rde_var_table.dat
You can descript the information of the included variables and classes in the rde_var_table.dat.
- Format
[variable]\t[class]
*.dat
You can descript the methods of the classes in [classname].dat
- Format
[insert data]\t[label data]\t[flag]
The structure of [flag] is below
1bit | singleton_method |
2bit | instance_method |
3bit | constants |
Look here too about the way of making the files.
Dynamic making autocomplete data files.
Input below, and try [Ruby]-[EasyParse(F12)].
class A def m1 "here in m1" end def m2 "here in m2" end end def m3(a, b) if (a == b) "equal" else "different" end end
Next, Input
a =
and try [ShowObjects(Ctrl+J)] in a popup menu of the codewindow, then you can select class A.
a = A.new a.
you can also find methods m1, m2 in a candidate list box. And you can find method m3 by [Ruby]-[ShowMethods(Ctrl+.)] after "m" on top level scope.
m
You can also select Object's private & public methods. try [Ruby]-[ShowMethods(Ctrl+.)] after below.
att req pri
attr_reader require print
Logic of EasyParse
The logic of EasyParse. 1st, pick up lines that define structures and constants from current editing file.
def|undef|require|include|private|protected|public|alias|module_function|attr_reader|attr_writer|attr_accessor
2nd, make a temporary file that is made from result of 1st step and rde_parse_template.rb.
3rd, run the temporary file and make .dat files in the direcotry ([$AutoCompleteDataPath]\rde_temp).
This function is useful for GUI library. You can show the original methods and constants of the GUI library in the candidate list.
require 'phi' include Phi # 1 class MainForm < Form # 2 def initialize @btn = Button.new self # 3 @btn.caption= "test" @btn.align= AL_BOTTOM @btn.on_click=Proc.new{close} end end a = MainForm.new a.caption= "test form" a.show_modal
Manual registration class/module type for variables.
When you input below, you want to autocompete "line"'s methods.
ARGF.each{|line|
If you know "line" is a String class, You can register this set manually.
After behind of "line."
line.
press ShowObjects(Ctrl+J) and move to "String", and press a right key.
Now listbox shows the list of Strings methods.
When you press a right key, RDE memories that "line" is String. From now, Autocomplete works for "line". you can modify these in VarTableEditor.