Code Completion: how to build own dictionary ?

Started by Stefan, January 24, 2009, 01:16:42 PM

Previous topic - Next topic

Stefan

Code Completion: how to build own dictionary ?

from the HippoEDIT help:


Code Completion
You can use feature to get list of available functions, subroutines, macros and etc
only by pressing Ctrl + Space in you code, after selecting one of the item it will be inserted in your code.

If there is only one item available, it will be inserted automatically, without displaying of the list.
You can select area where to search available items:

Using of internal dictionary with keywords.
Using external dictionary (load keywords list on request with support of icons and insert pattern requests).
Using of simple completion dictionary. Suggested items extracted from already typed or loaded text.
Auto Completion results can be also filtered in a list (when more then one type of data displayed) by data type with additional filter buttons.


Question:
i get words from current document and from syntax spec xml-file,
but how can i build an own dictionary ?
What is the file to modify?

Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hello Stefan,

Sorry have not answered this question before..

I am planning to have some user dictionary, that can be handled in easy way, and where you an add your user keywords.
But for know this does not exist.

But this does not mean that you could not achive this, with some small effort ;)
Because keywords are defined in syntax shemas and HE support inhertance of schemas, all you need to add you keywords to defualt schema. Then all syntaxes (mostly all are direclty or indirectly inherited from default) would get them.

Here is an example. Change description of the normal style in your def_spec.xml to something like this:
      <Style id="normal" name="Normal" dbkclr="false" bold="0" italic="0" underline="0" clr="Window Text" bkclr="#FFFFFFFF" overview="3">
        <Keywords>
          <Keyword text="Hello"/>
          <Keyword text="Best regards,"/>
          <Keyword text="Glad to here you once more"/>
        </Keywords>
      <Style>

And then everythere in code with normal style (this is base style, so not strings or comments etc ) you would see these keywords in Code Hints and completion list. And because they are part of normal style they would be colored same way as whole text.
Or you can create another style in def_spec.xml, give it any id/name, and you would get same possibilities plus you can define, color, images, styles where this keywords allowed and so on. If you dont want to see this user style in settings (Fonts and Colors) you can set attribute abstract of style to true.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

#2
I can't say that i understood anything :D

Here are the steps i tried (with try to describe the things a lil bit)
625
- i have an plain text file *.txt
- plain text is defined in txt_spec.xml
- txt_spec.xml is inherited from deftext_spec.xml
- deftext_spec.xml is inherited from def_spec.xml
- in def_spec.xml i have modified the line
<Style id="normal" name="Normal" dbkclr="false" bold="0" italic="0" underline="0" clr="Window Text" bkclr="#FFFFFFFF" overview="3"/>

to

      <Style id="normal" name="Normal" dbkclr="false" bold="0" italic="0" underline="0" clr="Window Text" bkclr="#FFFFFFFF" overview="3">
      <Keywords>
        <Keyword text="Hello"/>
        <Keyword text="Best regards"/>
        <Keyword text="Glad to here you once more"/>
      </Keywords>
    </Style
>


And i get it to work :D  thanks :thumpsup:

Note: see >here< for more info about format of syntax file.


--

To modify    def_spec.xml     instead of   txt_spec.xml     itself
has the advantage that i have later this templates
in all syntaxes inherited from basic/default def_spec.xml
and not  only  in  *.txt  files.

If one want some templates for *.txt files only write them in   txt_spec.xml  , of course.
--


Puh, first step is done. :D :D :D
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-