Changeset 242

Show
Ignore:
Timestamp:
02/27/07 01:36:49 (2 years ago)
Author:
Ant
Message:

allow move tabs between notebooks; remove debug messages; added no used help on properties; separate lookup help display; sintaxt color broken on D files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/language/d/CodeBlock.d

    r238 r242  
    11module language.d.CodeBlock; 
     2 
     3//debug=messages; 
    24 
    35import language.d.Element; 
     
    7678    CodeBlock getContainerForLine(int lineNo, bool functionOnly = false) 
    7779    { 
    78         //writefln("checking CodeBlock for %d", lineNo); 
     80        //debug(messages)writefln("checking CodeBlock for %d", lineNo); 
    7981        //this.dumpAll(1,false); 
    8082         
     
    8284        foreach(Element e;this.elements) { 
    8385            if (!cast(CodeBlock)e) { 
    84                 //writefln("Skip"); 
     86                //debug(messages)writefln("Skip"); 
    8587                //e.dumpAll(1,false); 
    8688                continue; 
    8789            } 
    8890             
    89             //writefln("Compare %d > %d < %d", e.startLine, lineNo, e.endLine); 
     91            //debug(messages)writefln("Compare %d > %d < %d", e.startLine, lineNo, e.endLine); 
    9092            if ((lineNo >= e.startLine ) && (lineNo <= e.endLine)) { 
    9193                return (cast(CodeBlock)e).getContainerForLine(lineNo,functionOnly); 
    9294            } 
    9395        } 
    94         //writefln("returning self - only methods."); 
     96        //debug(messages)writefln("returning self - only methods."); 
    9597        if (functionOnly && !(cast(Method)this)) { 
    9698            return null; 
     
    103105    { 
    104106        // assume without '.' 
    105         writefln("getAutoCompleteList called on %s:%s", this.classinfo.name,this.name); 
     107        debug(messages)writefln("getAutoCompleteList called on %s:%s", this.classinfo.name,this.name); 
    106108        if (cast(Method)this && cast(Class)this.parent && (start.length < 5)) { 
    107109            if ( (!start.length) || (start == "this"[0..start.length])) { 
     
    119121            Class newpc = cast(Class) pc.getTypeElement(pc.extends); 
    120122            if (newpc) { 
    121                 writefln("got parent: %s", newpc.name); 
     123                debug(messages)writefln("got parent: %s", newpc.name); 
    122124                newpc.getAutoCompleteList(start, ret, false, imports); 
    123125            } else { 
    124                 writefln("getAutoCompleteList:could not find parent: %s of class %s", pc.extends, pc.name); 
     126                debug(messages)writefln("getAutoCompleteList:could not find parent: %s of class %s", pc.extends, pc.name); 
    125127                  
    126128            } 
     
    128130             
    129131        } 
    130         writefln("getAutoCompleteList:: foreach on %d elements", elements.length); 
     132        debug(messages)writefln("getAutoCompleteList:: foreach on %d elements", elements.length); 
    131133        foreach (e;elements) { 
    132134            writefln("testing %s", e.classinfo.name); 
    133135            if (cast(Definition)e) { 
    134                 //writefln("testing %s against %s", start,(cast(Definition)e).name); 
     136                //debug(messages)writefln("testing %s against %s", start,(cast(Definition)e).name); 
    135137                if ((cast(Definition)e).nameMatches(start)) { 
    136                     writefln("autoComplete add Defintion %s from %s", e.name, this.name); 
     138                    debug(messages)writefln("autoComplete add Defintion %s from %s", e.name, this.name); 
    137139                    ret ~= new String((cast(Definition)e).name); 
    138140                     
     
    141143            } 
    142144            if (cast(Class)e) { 
    143                 writefln("testing %s against %s", start,(cast(Class)e).name); 
     145                debug(messages)writefln("testing %s against %s", start,(cast(Class)e).name); 
    144146                if ((cast(Class)e).nameMatches(start)) { 
    145                     writefln("autoComplete add Class %s from %s", e.name, this.name); 
     147                    debug(messages)writefln("autoComplete add Class %s from %s", e.name, this.name); 
    146148                    ret ~= new String((cast(Class)e).name); 
    147149                } 
     
    150152            } 
    151153            if (cast(Struct)e) { 
    152                 writefln("testing %s against %s", start,(cast(Struct)e).name); 
     154                debug(messages)writefln("testing %s against %s", start,(cast(Struct)e).name); 
    153155                if ((cast(Struct)e).nameMatches(start)) { 
    154                     writefln("autoComplete add Struct %s from %s", e.name, this.name); 
     156                    debug(messages)writefln("autoComplete add Struct %s from %s", e.name, this.name); 
    155157                    ret ~= new String((cast(Struct)e).name); 
    156158                } 
     
    159161            if (cast(Method)e  && (e.getType() == FUNCTION)) { 
    160162                 
    161                 writefln("testing %s(%d) against %s", start, start.length, (cast(Method)e).name); 
     163                debug(messages)writefln("testing %s(%d) against %s", start, start.length, (cast(Method)e).name); 
    162164                if ((cast(Method)e).nameMatches(start)) { 
    163                     writefln("autoComplete add Method %s from %s", e.name, this.name); 
     165                    debug(messages)writefln("autoComplete add Method %s from %s", e.name, this.name); 
    164166                    ret ~= new String((cast(Method)e).name ~ "(" ~ (cast(Method)e).argsToAutoComplete() ~ ")"); 
    165167                } 
     
    168170            if (cast(Enum)e) { 
    169171                if ((cast(Enum)e).nameMatches(start)) { 
    170                     writefln("autoComplete add Enum %s from %s", e.name, this.name); 
     172                    debug(messages)writefln("autoComplete add Enum %s from %s", e.name, this.name); 
    171173                    ret ~= new String((cast(Enum)e).name); 
    172174                } 
     
    175177            if (imports && parents && cast(Import)e) { 
    176178                // assumes we dont have multiple references to it.. 
    177                 writefln("in %s trying to load import %s", this.name, e.name); 
     179                debug(messages)writefln("in %s trying to load import %s", this.name, e.name); 
    178180                Module m = (cast(Import)e).load(); 
    179181                if (m) { 
     
    233235        } 
    234236         
    235         writefln("looking up definition of %s on  %s/%s", match, this.classinfo.name, this.name);  
     237        debug(messages)writefln("looking up definition of %s on  %s/%s", match, this.classinfo.name, this.name);  
    236238     
    237239         
     
    246248                        continue; 
    247249                    } 
    248                     //writefln("testing %s against %s", match,(cast(Definition)e).name); 
     250                    //debug(messages)writefln("testing %s against %s", match,(cast(Definition)e).name); 
    249251                    if (e.name == match.toString()) { 
    250252                        retElements ~= e; 
     
    271273            Class newpc = cast(Class) pc.getTypeElement(pc.extends); 
    272274            if (newpc) { 
    273                 writefln("getDefinitionElement:got parent: %s", newpc.name); 
     275                debug(messages)writefln("getDefinitionElement:got parent: %s", newpc.name); 
    274276                Element e = newpc.getDefinitionElement(match, false); 
    275277                if (e) { 
     
    281283                } 
    282284            } else { 
    283                 writefln("getDefinitionElement:could not find parent: %s of class %s", pc.extends, pc.name); 
     285                debug(messages)writefln("getDefinitionElement:could not find parent: %s of class %s", pc.extends, pc.name); 
    284286                  
    285287            } 
     
    309311        if (cast(Module)this && parents) { 
    310312            foreach(importdir; (cast(Module)this).paths) { 
    311                 writefln("checking Filepath %s against %s", importdir, match); 
     313                debug(messages)writefln("checking Filepath %s against %s", importdir, match); 
    312314                Directory d = new Directory(this, importdir.toString()); 
    313315                Element e = d.getDefinitionElement(match); 
     
    326328         
    327329        if (cast(Module)this) { 
    328             writefln("hit module - giving up"); 
     330            debug(messages)writefln("hit module - giving up"); 
    329331            return; 
    330332        } 
    331333        if (!parents) { // for single level quering.. 
    332             writefln("hit no parents - giving up"); 
     334            debug(messages)writefln("hit no parents - giving up"); 
    333335            return; 
    334336        } 
     
    364366             
    365367            if (cast(Class)e) { 
    366                 writefln("getTypeElement:testing %s against %s", match,(cast(Class)e).name); 
     368                debug(messages)writefln("getTypeElement:testing %s against %s", match,(cast(Class)e).name); 
    367369                if ((cast(Class)e).name == match) { 
    368370                    return e; 
  • trunk/src/language/d/Directory.d

    r232 r242  
    11module language.d.Directory; 
     2 
     3//debug=messages; 
    24 
    35import language.d.Element; 
     
    136138    Element getDefinitionElement(String match, bool parents = true, bool imports=true) 
    137139    { 
    138         writefln("Directory::getDefinitionElement match? %s to path ing %s", match, name); 
     140        debug(messages)writefln("Directory::getDefinitionElement match? %s to path ing %s", match, name); 
    139141        String fp = Path.join(this.name, match); 
    140142         
    141143        if (checkPathIsDir(fp)) { 
    142             writefln("Matched - returning new directory"); 
     144            debug(messages)writefln("Matched - returning new directory"); 
    143145            return new Directory(this, fp.toString()); 
    144146        } 
  • trunk/src/language/d/Module.d

    r189 r242  
    1919module language.d.Module; 
    2020 
     21//debug=messages; 
    2122     
    2223private import std.stdio; 
     
    5253    static Module loadFromFile(char[] filename, String[] paths) 
    5354    { 
    54         //writefln("load From File: %s", filename); 
     55        //debug(messages)writefln("load From File: %s", filename); 
    5556        return Module.loadFromCache(filename, paths); 
    5657          
    57         //writefln("failed to load '%s', using search path '%s'" ,filename, std.string.join(paths,":")); 
     58        //debug(messages)writefln("failed to load '%s', using search path '%s'" ,filename, std.string.join(paths,":")); 
    5859        return null; 
    5960    } 
     
    6263        if (fileWithPath in Module.cacheMtimes) { 
    6364            // it's in the cache. 
    64             //writefln("file in cache:" ~ fileWithPath); 
     65            //debug(messages)writefln("file in cache:" ~ fileWithPath); 
    6566            if (Module.cacheMtimes[fileWithPath] >= dool.io.Path.Path.getMTime(new String(fileWithPath))) { 
    6667                // then the file is cached and our mtime is greater than the real file. 
     
    6970             
    7071        } 
    71         //writefln("file not in cache:" ~ fileWithPath); 
     72        //debug(messages)writefln("file not in cache:" ~ fileWithPath); 
    7273        // otherwise we need to load it.. 
    7374         
     
    8283    static Module loadFromString(char[] string, char[] fileWithPath, String[] paths) 
    8384    { 
    84         //writefln("file not in cache:" ~ fileWithPath); 
     85        //debug(messages)writefln("file not in cache:" ~ fileWithPath); 
    8586        // otherwise we need to load it.. 
    8687         
     
    107108        this.pos = 0; // so we dont skip first bit.. 
    108109        this.moduleObj = this; 
    109         writefln("module %s", this.filename); 
     110        debug(messages)writefln("module %s", this.filename); 
    110111        //super(this,-1); 
    111112        super(this); 
  • trunk/src/language/d/Parser.d

    r241 r242  
    376376                    // should we just ignore this? - or just overlay inot the current scope.. 
    377377                     
    378                     tokensUpto('('); 
     378                    tokensUpto('(', '='); 
    379379                      
    380380                      
  • trunk/src/leds/CodeEdit.d

    r230 r242  
    146146 
    147147    /** 
    148      * Get the current character position on the document 
     148     * Gets the current character position on the document 
    149149     * @return  
    150150     */ 
  • trunk/src/leds/CodeView.d

    r230 r242  
    9898private import gtkc.gtktypes; 
    9999private import gtkc.gdktypes; 
     100 
     101private import language.d.Element; 
     102private import language.d.Module; 
     103private import language.d.Directory; 
     104private import language.d.CodeBlock; 
     105     
     106 
    100107//debug=notify 
    101108 
     
    13601367    body 
    13611368    { 
    1362          
     1369        writefln("gotoElement 1"); 
    13631370        if ( elementName is null || elementName.length == 0 ) 
    13641371        { 
     1372        writefln("gotoElement 2"); 
    13651373            return false; 
    13661374        } 
     1375        writefln("gotoElement 3"); 
    13671376        Language lang = this.getLanguageHandler(); 
     1377        writefln("gotoElement 4"); 
    13681378         
    13691379        String[] fileandNum = lang.getElementLocation(elementName, lineNumber); 
    1370         if (!fileandNum.length) { 
     1380        writefln("gotoElement 5"); 
     1381        if (!fileandNum.length)  
     1382        { 
     1383        writefln("gotoElement 6"); 
    13711384            return false; 
    13721385        } 
     1386        writefln("gotoElement 7"); 
    13731387        std.stdio.writefln("goto: " ~ fileandNum[0] ~ " :: " ~ fileandNum[1]); 
    13741388        int toLine  = atoi(fileandNum[1].toString().ptr); 
    13751389         
     1390        writefln("gotoElement 8"); 
    13761391        CodeView cv = cast(CodeView)workspace.openFile(fileandNum[0]); 
    1377         if ( cv is null) { 
     1392        if ( cv is null)  
     1393        { 
     1394        writefln("gotoElement 9"); 
    13781395            return false; 
    13791396        } 
    13801397        cv.gotoLine(toLine+1); 
     1398        writefln("gotoElement 10"); 
    13811399        return true; 
    13821400         
     
    15561574         
    15571575        //printf("mouse pressed on CodeView with button %d and time %d\n",eventButton.button,eventButton.time); 
    1558         if (eventButton.button != 1) { 
     1576        if (eventButton.button != 1)  
     1577        { 
    15591578            return false; 
    15601579        } 
    1561         if (!Leds.leds.getPropValue("autoHelp",false) ) { 
     1580        if (!Leds.leds.getPropValue("autoHelp",false) )  
     1581        { 
    15621582            return false; 
    15631583        } 
    1564          
     1584 
     1585        if ( codeEdit.isAutoCompletionActive() ) 
     1586        { 
     1587            return false; 
     1588        } 
     1589 
    15651590        auto str = getLeftRightId(); 
    15661591        if (!str.length) { 
     
    15821607    void openModule(MenuItem item) 
    15831608    { 
    1584         if (!codeEdit.getSelected().length) { 
    1585             return false; 
    1586         } 
    1587          
    1588         String[] fileandNum = getLanguageHandler().getElementLocation(codeEdit.getSelected(), codeEdit.getCurrLine()); 
    1589         if (!fileandNum.length) { 
     1609        writefln("openModule 0.0"); 
     1610        String token = codeEdit.getSelected(); 
     1611        if ( token.length == 0 )  
     1612        { 
     1613            return;     // or find the position of the mouse click on the text before: 
     1614            //token = getLeftRightId(); 
     1615        } 
     1616         
     1617        writefln("openModule 0.1"); 
     1618        String[] fileandNum = getLanguageHandler().getElementLocation( 
     1619                                                    token, codeEdit.getCurrLine()); 
     1620                                                     
     1621 
     1622        LanguageD language = cast(LanguageD)getLanguageHandler(); 
     1623         
     1624        Module sourceModule = language.getCachedModule(); 
     1625        CodeBlock container =   sourceModule.getContainerForLine(getLineNumber()); 
     1626         
     1627        writefln("openModule 0.2"); 
     1628        if (!container)  
     1629        { 
     1630            popupTip("no container found?"); 
     1631        writefln("openModule 0.3"); 
     1632            return; 
     1633        } 
     1634         
     1635        String[] bits = token.split("."); 
     1636         
     1637        writefln("openModule 0.4"); 
     1638        if (bits.length < 2)  
     1639        { 
     1640        writefln("openModule 0.5"); 
     1641            // simple single entity. 
     1642            Element[] types; 
     1643            container.getDefinitionElementAll(token,types); 
     1644            if (types.length > 0 ) 
     1645            { 
     1646        writefln("openModule 0.6"); 
     1647                popupTip(types[0].getHelp()); 
     1648//              char[] str = ""; 
     1649//              foreach(type;types) 
     1650//              { 
     1651//                  str ~= (str.length ? "\n" : "") ~ type.getHelp().toString(); 
     1652//              } 
     1653//              help ~= "#2" ~ str~"\n\n"; 
     1654//              //codeview.getWorkspace().getSystemConsole.print(str); 
     1655            } 
     1656            else 
     1657            { 
     1658        writefln("openModule 0.7"); 
     1659                popupTip("no types found"); 
     1660            } 
     1661            return; 
     1662        } 
     1663        else 
     1664        { 
     1665            writefln("openModule 1"); 
     1666            Element lookupwith = null; 
     1667             
     1668            for(int i=0;i< bits.length-1; i++)  
     1669            { 
     1670            writefln("openModule 2"); 
     1671                Element type = null; 
     1672                if (!lookupwith)  
     1673                { 
     1674                    type = container.getDefinitionElement(bits[i]); 
     1675                } 
     1676                else 
     1677                { 
     1678                    type = lookupwith.getDefinitionElement(bits[i], false); // dont go up tree. 
     1679                } 
     1680                 
     1681                if (!type)  
     1682                { 
     1683                    debug(messages)writefln("cant find defintion of item named %s" , bits[i]); 
     1684            writefln("openModule 3"); 
     1685                    return; 
     1686                } 
     1687                 
     1688                // got a parent 
     1689                container = type.moduleObj; 
     1690                lookupwith = container.getTypeElement(type); 
     1691                 
     1692                if (!lookupwith)  
     1693                { 
     1694                    debug(messages)writefln("cant find defintion of type %s" , type.returnType); 
     1695            writefln("openModule 4"); 
     1696                    return; 
     1697                } 
     1698            } 
     1699             
     1700            token = bits[bits.length-1]; 
     1701            debug(messages)writefln("building help for '%s' from %s ", s, lookupwith.classinfo.name); 
     1702            //lookupwith.dumpAll(1); 
     1703             
     1704            //debug(messages)writefln("got %d elements", list.length); 
     1705             
     1706            writefln("openModule 5"); 
     1707            if ( !token.length || !cast(CodeBlock)lookupwith )  
     1708            {  
     1709                if (cast(Directory)lookupwith && token.length)  
     1710                { 
     1711                    Element de = lookupwith.getDefinitionElement(token); 
     1712                    if (de)  
     1713                    { 
     1714                        popupTip("#3" ~ de.getHelp().toString()~"\n\n"); 
     1715                        //codeview.getWorkspace().getSystemConsole.print(de.getHelp()); 
     1716                    } 
     1717            writefln("openModule 6"); 
     1718                    return; 
     1719                } 
     1720            writefln("openModule 7"); 
     1721                return; 
     1722            } 
     1723             
     1724            Element[] types; 
     1725            (cast(CodeBlock)lookupwith).getDefinitionElementAll(token,types,false); 
     1726            // last item was a '.' 
     1727             
     1728            writefln("openModule 8"); 
     1729            if ( types )  
     1730            { 
     1731            writefln("openModule 9"); 
     1732                char[] str = ""; 
     1733                foreach( type ; types )  
     1734                { 
     1735                    str ~= (str.length ? "\n" : "") ~ type.getHelp().toString(); 
     1736                } 
     1737                popupTip("#4" ~ str~"\n\n"); 
     1738                //codeview.getWorkspace().getSystemConsole.print(str); 
     1739            } 
     1740        } 
     1741 
     1742         
     1743         
     1744        if ( fileandNum.length == 0)  
     1745        { 
     1746            writefln("openModule 5"); 
    15901747            return false; 
    15911748        } 
     
    22132370    void fireAutoCompletion() 
    22142371    { 
     2372        writefln("CodeView.fireAutoCompletion entry"); 
    22152373        if ( userShortCuts() ) { 
    22162374            return; 
     
    27702928    } 
    27712929 
     2930    void popupTip(String tip, int position=-1) 
     2931    { 
     2932        if ( !codeEdit.isAutoCompletionActive() ) 
     2933        { 
     2934            if ( position < 0 ) 
     2935            { 
     2936                position = codeEdit.getCurrentPos(); 
     2937            } 
     2938            tip.replace("\n\r", "\n"); 
     2939             
     2940            codeEdit.callTipShow(position, tip); 
     2941        } 
     2942    } 
     2943     
     2944    void popupTip(char[] tip, int position=-1) 
     2945    { 
     2946        popupTip(new String(tip), position); 
     2947    } 
     2948     
    27722949    /** 
    27732950     * This notification is sent when the text or styling of the document changes or is about to change. 
  • trunk/src/leds/Docker.d

    r230 r242  
    134134         
    135135        notebook = new Notebook; 
     136        notebook.setGroupId(getDockerID()); 
    136137        //notebook.setShowTabs(false); 
    137138        notebook.popupEnable(); 
     
    145146    } 
    146147 
     148    public int getDockerID() 
     149    { 
     150        return 0; 
     151    } 
     152     
    147153    Widget getWidget() 
    148154    { 
     
    336342                    // insert before this. 
    337343                    notebook.insertPageMenu(dockable.getWidget(), tabLabel, menuLabel, i); 
    338                     //notebook.setTabReorderable(dockable.getWidget(), true); 
     344                    notebook.setTabReorderable(dockable.getWidget(), true); 
     345                    notebook.setTabDetachable(dockable.getWidget(), true); 
    339346                    inserted = true; 
    340347                    break; 
     
    349356        { 
    350357            notebook.appendPageMenu(dockable.getWidget(), tabLabel, menuLabel); 
    351             //notebook.setTabReorderable(dockable.getWidget(), true); 
     358            notebook.setTabReorderable(dockable.getWidget(), true); 
     359            notebook.setTabDetachable(dockable.getWidget(), true); 
    352360        } 
    353361         
  • trunk/src/leds/DockerFiles.d

    r230 r242  
    8989    } 
    9090     
     91    public int getDockerID() 
     92    { 
     93        return 1; 
     94    } 
     95         
    9196    public Widget getSuperWidget() 
    9297    { 
  • trunk/src/leds/DockerTools.d

    r230 r242  
    7474    } 
    7575 
     76    public int getDockerID() 
     77    { 
     78        return 0; 
     79    } 
     80     
    7681    Widget getWidget() 
    7782    { 
  • trunk/src/leds/Language.d

    r230 r242  
    2626    import dool.String; 
    2727    import dool.io.Path; 
     28    import leds.Leds; 
    2829    import leds.CodeView; 
    2930    import leds.CodeEdit; 
     
    272273    } 
    273274     
     275    /** 
     276     * requests our codeview to display a help message 
     277     * param: help The help messages 
     278     */ 
     279    protected void displayHelp(char[] help) 
     280    { 
     281        while ( help.length > 0 && help[$-1] == '\n' ) 
     282        { 
     283            help.length = help.length - 1; 
     284        } 
     285        if ( help.length > 0 ) 
     286        { 
     287            if ( Leds.leds.getPropValue("helpOnOutput", true) ) 
     288            { 
     289                codeview.getWorkspace().getSystemConsole.print(help); 
     290            } 
     291            else 
     292            { 
     293                codeview.popupTip(help); 
     294            } 
     295        } 
     296    } 
     297     
     298 
    274299} 
  • trunk/src/leds/LanguageD.d

    r240 r242  
    11module leds.LanguageD; 
     2 
     3//debug=messages; 
     4 
    25import leds.Language; 
    36 
     
    123126         
    124127        if (!sourceModule ) { 
    125             //writefln("loadBrowserData - no sourceModule?"); 
     128            //debug(messages)writefln("loadBrowserData - no sourceModule?"); 
    126129            return; 
    127130        } 
    128         //writefln("loadBrowserData - loadig Element?"); 
     131        //debug(messages)writefln("loadBrowserData - loadig Element?"); 
    129132        addBrowserElements(bv, null, sourceModule); 
    130133          
     
    135138    private void addBrowserElements(BrowserView bv, TreeIter parentIter, Element element) 
    136139    { 
    137        // writefln("Adding element: %s", element.getBrowserForm().toString); 
     140       // debug(messages)writefln("Adding element: %s", element.getBrowserForm().toString); 
    138141        TreeIter newIter = bv.addGenericElement( 
    139142            parentIter,   
     
    290293                    case "invariant" :      pixDef = Pixmaps.greenInvariant_xpm; break; 
    291294                    default: 
    292                         writefln("BrowserView.getPixbuf.BLOCK.default ", element.returnType.toString()); 
     295                        debug(messages)writefln("BrowserView.getPixbuf.BLOCK.default ", element.returnType.toString()); 
    293296                        pixDef = Pixmaps.red_xpm; 
    294297                        break; 
     
    347350    void addFoldsElement(Element element, int foldOffset, bool collapse) 
    348351    { 
     352         /* 
     353        debug(messages)writefln("got Element: ",     
     354              " Form: ", element.getBrowserForm().toString, // definition. 
     355              " Modifiers: ", element.getModifiers().toString, // return type 
     356              " Element: ", RowType.ELEMENT,     
     357              " Type: ", new String(cast(int)element.getType()), 
     358              " Line: ", new String(element.getLineInCode()), 
     359              "-", new String(element.getLastLineInCode()), 
     360            "" 
     361         ); */ 
     362          
     363         /* Types: 
     364        22 = The file? 
     365        2 = import 
     366        3 = enum 
     367        6 = var? 
     368        9 = version? 
     369        17 = interface? 
     370        20 = class? 
     371        21 = method 
     372        */ 
     373        int newFoldOffset = foldOffset; 
     374        //if (element.endLine > 0 && ( 
    349375        if ((element.endLine > 0) && (element.startLine >= foldActiveLine) && ( 
    350376                (element.getType() == Element.CLASS) ||  
     
    406432        auto tokenizer = new Tokenizer( codeview.getText().toString()); 
    407433        tokenizer.parse(); 
    408         //writefln("find token at = %d", codeview.getCurrentPos()); 
     434        //debug(messages)writefln("find token at = %d", codeview.getCurrentPos()); 
    409435        int toktype = tokenizer.tokenTypeAtPos( codeview.getCurrentPos()); 
    410         //writefln("toktype = %d", toktype); 
     436        //debug(messages)writefln("toktype = %d", toktype); 
    411437         
    412438        canAutoCompleteLastRet = (toktype != Token.STRING) && (toktype != Token.COMMENT); 
     
    428454      
    429455        foreach(str,tokval;Token.stdKeyword) { 
    430             //writefln("test %s", str); 
     456            //debug(messages)writefln("test %s", str); 
    431457            if (start.length < str.length) { 
    432458                if (str[0..start.length] == start) { 
     
    440466        CodeBlock container = sourceModule.getContainerForLine(codeview.getLineNumber()); 
    441467        if (!container) { 
    442             writefln("no container found?"); 
     468            debug(messages)writefln("no container found?"); 
    443469            return list; 
    444470        } 
    445471        String[] bits = start.split("."); 
    446         writefln("bits leng = %d", bits.length); 
     472        debug(messages)writefln("bits leng = %d", bits.length); 
    447473        if (bits.length < 2) { 
    448474            // simple single entity. 
     
    461487            } 
    462488            if (!type) { 
    463                 writefln("cant find defintion of item named %s" , bits[i]); 
     489                debug(messages)writefln("cant find defintion of item named %s" , bits[i]); 
    464490                return list; 
    465491            } 
     
    472498            } 
    473499            if (!lookupwith) { 
    474                 writefln("cant find defintion of type %s" , type.returnType); 
     500                debug(messages)writefln("cant find defintion of type %s" , type.returnType); 
    475501                return list; 
    476502            } 
     
    478504         
    479505        start = bits[bits.length-1]; 
    480         writefln("building autocomplete list for '%s' on %s", start, lookupwith.classinfo.name); 
     506        debug(messages)writefln("building autocomplete list for '%s' on %s", start, lookupwith.classinfo.name); 
    481507        //lookupwith.dumpAll(1); 
    482508        lookupwith.getAutoCompleteList(start, list, false); 
    483         //writefln("got %d elements", list.length); 
     509        //debug(messages)writefln("got %d elements", list.length); 
    484510        if (start.length) {  
    485511            return list; 
     
    505531        } 
    506532        foreach(s;searchin) { 
    507             // writefln("compare %s to %s", s,start); 
     533            // debug(messages)writefln("compare %s to %s", s,start); 
    508534            if (s.length < start.length()) { 
    509535                continue; 
     
    512538                continue; 
    513539            } 
    514             //writefln("adding: %s", s[start.length..length]); 
     540            //debug(messages)writefln("adding: %s", s[start.length..length]); 
    515541            ret ~= s.dup; 
    516542        } 
     
    578604         
    579605        auto l = Leds.leds().getPropValue("dmd","dmd"); 
    580         writefln("getPropValue(\"dmd\",\"dmd\") = ", l); 
    581  
    582       
     606        debug(messages)writefln("getPropValue(\"dmd\",\"dmd\") = ", l); 
     607 
     608        // dmd doesn't need to be a file if it's on the executables path 
     609//      if (!Path.isFile(l)) 
     610//      { 
     611//          //debug(messages)writefln("dmd command does not exist"); 
     612//          codeview.getWorkspace().getSystemConsole.print( 
     613//                  "Can not find dmd '" ~ l.toString() ~ "' so compile test does not work\n"); 
     614//          return correct; 
     615//      } 
    583616         
    584617        version(Win32) 
     
    867900    { 
    868901        // tidy it up.. 
    869        
     902 
     903        char[] help; 
     904 
    870905        String[] strs = s.split("("); 
    871906        s = strs.length ? strs[0] : new String(""); 
    872         if (!s.length) { 
     907         
     908        if ( s.length == 0 ) 
     909        { 
    873910            return; 
    874911        } 
    875         if (s.toString() in Token.stdKeyword) { 
    876             codeview.getWorkspace().getSystemConsole.print("D Keyword: " ~ s.toString()); 
     912         
     913        if (s.toString() in Token.stdKeyword)  
     914        { 
     915            help ~= "@1" ~ "D Keyword: " ~ s.toString()~"\n\n"; 
     916            //codeview.getWorkspace().getSystemConsole.print("D Keyword: " ~ s.toString()); 
    877917            return; 
    878918        } 
    879          
    880919         
    881920        Module sourceModule = this.getCachedModule(); 
    882921        CodeBlock container =   sourceModule.getContainerForLine(codeview.getLineNumber()); 
    883         if (!container) { 
    884             writefln("no container found?"); 
     922         
     923        if (!container)  
     924        { 
     925            debug(messages)writefln("no container found?"); 
     926            displayHelp(help); 
    885927            return; 
    886928        } 
     929         
    887930        String[] bits = s.split("."); 
    888         writefln("bits leng = %d", bits.length); 
    889         if (bits.length < 2) { 
     931        debug(messages)writefln("bits leng = %d", bits.length); 
     932         
     933        if (bits.length < 2)  
     934        { 
    890935            // simple single entity. 
    891936            Element[] types; 
     
    893938            if (types) { 
    894939                char[] str = ""; 
    895                 foreach(type;types) { 
     940                foreach(type;types) 
     941                { 
    896942                    str ~= (str.length ? "\n" : "") ~ type.getHelp().toString(); 
    897943                } 
    898                 codeview.getWorkspace().getSystemConsole.print(str); 
    899             } 
     944                help ~= "@2" ~ str~"\n\n"; 
     945                //codeview.getWorkspace().getSystemConsole.print(str); 
     946            } 
     947            displayHelp(help); 
    900948            return; 
    901949        } 
     950         
    902951        // do lookup on '*.*' 
    903952         
    904953        Element lookupwith = null; 
    905         for(int i=0;i< bits.length-1; i++) { 
     954         
     955        for(int i=0;i< bits.length-1; i++)  
     956        { 
    906957            Element type = null; 
    907             if (!lookupwith) { 
     958            if (!lookupwith)  
     959            { 
    908960                type = container.getDefinitionElement(bits[i]); 
    909             } else { 
     961            } 
     962            else 
     963            { 
    910964