Results 1 to 20 of 216

Thread: QCodeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    XML does induce some nasty escaping and a more complex parsing (even though this may not remain always true if you use QXmlStreamReader) but on the other hand it allows an easy and extremely powerful hierarchization and plain text can not compete with XML in that area...
    Yes, i am a big fan of xml. But i found a custom format in that case much more managable.

    How do you map a token with a given text format? Is that handled within the lexer which sneds the info along the token?
    Each token gets a unique id when the lexer file gets parsed. With this unique id several infos about the token are saved (the name, the language, etc)

    the "caching" is line based but instead of using an additional state variable I just check the context stack. Could you define what a "group" is in your syntax engine?
    as far as i can see it's quite much the same as your context. it defines a certain "block" with a start and an end and additional rules for the text in the group.

    Even with big files (about 1meg of C++ code) QCodeEdit remains responsive, unless you're nasty enough to place a multiline comment at the begining of such a big file and switch between commented and uncommented... But even this manipulation doesn't alter the responsiveness on "normal" files ( ~3-4k lines)
    That's the part where the multithreaded model excels quite much. One other reason for me to go the threaded part were the emerging multithreaded/multicode cpus

    Some people thing that threads make things faster but they actually make them way slower... The only advantage is responsiveness but what if responsiveness can be preserved without threading? The first version of Edyuk completion engine was threaded and it was SLOW (a couple of secs to display results). As soon as I dropped threading and replaced QListWidget by a QListView with a custom model it fell to a couple of msecs!!! It made me think a little more about threading and now I only use it when the speed loss is irrelevant in front of the responsiveness... In the case of highlighting I don't think threading is such a good idea but maybe some benchmarks could prove me wrong...
    Well, making things threaded is of course more complicated then easy to get right. The lexer definitly doesn't need to be multi threaded, but i since the solution works really well, i saw no reason in changing that. I would not do the completer multithreaded tho, since the user usually expecting a response when he triggers auto completion. But for me personally any delay when typing is just not acceptable in an editor. And I didn't see any problem with lexing the stuff in an extra thread. I've ran my code on an p3 450 and it still worked rather smooth. I haven't benchmarked that entire thing tho, but iirc most of the time the lexer thread already was done with the line before the control went redrawing itself (on a single core/thread cpu)

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by kaos View Post
    Each token gets a unique id when the lexer file gets parsed. With this unique id several infos about the token are saved (the name, the language, etc)
    But then how do you handle parsing numbers for instance? It must be done with a more complex DFA than a keyword and allow for many more than one single token... I guess you meant that the id is associated with the DFA matching state or am I missing something?
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Sep 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    But then how do you handle parsing numbers for instance? It must be done with a more complex DFA than a keyword and allow for many more than one single token... I guess you meant that the id is associated with the DFA matching state or am I missing something?
    Ah, yeah.
    Well, all the tokens get compiled into one big automaton per group where the final state carries information which token id to emit when the match completes at that final state.

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    I just noticed the license syntax selection is fooled by dots in the file name.
    For example

    example/example lib/qpanellayout.cpp

    produces a correctly colourcoded file, while

    cp lib/qpanellayout.cpp a.1.cpp
    example/example a.1.cpp

    Shows no colourcoding at all. I think the extension is the text after the final dot in a file name.

  5. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    I just noticed the license syntax selection is fooled by dots in the file name.
    For example

    example/example lib/qpanellayout.cpp

    produces a correctly colourcoded file, while

    cp lib/qpanellayout.cpp a.1.cpp
    example/example a.1.cpp

    Shows no colourcoding at all. I think the extension is the text after the final dot in a file name.
    The issue must come from a use of QFileInfo::completeSuffix()... I'll correct it ASAP.
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    How do you feel about making ctrl-f always take you to the find box?
    Currently you have to first check if the find box is open, because if it is, you need to key two ctrl-f to get there. (The first one just closes the box, the second opens it again and takes you in).

    I think it would be much easier this way. Conventionally you use escape to leave a dialog, not a repeat of the key that opened it.

  7. #7
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    How do you feel about making ctrl-f always take you to the find box?
    I'll have that sorted out ASAP.

    BTW, the suffix issue has been fixed in case you didn't notice.
    Current Qt projects : QCodeEdit, RotiDeCode

  8. #8
    Join Date
    Feb 2007
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QCodeEdit

    Hi fmc,
    A couple of issues/observations for edyuk.
    • First, I don't understand... Is not the trunk in SVN repo not the most recent code??? Huh? This quite unorthodox, isn't it. I've never seen this before. Quote from the website:
      ...and, as many people dislike (or don't even know) SVN, I ended up releasing a new package to avoid confusions with the very old one left on Sourceforg donwloads servers...

      You can get it in the downloads section and enjoy all the improvements.
    • The ./build script reports a syntax error
      Qt Code:
      1. oxbo% ./build -h
      2. ./build: 60: Syntax error: Bad substitution
      To copy to clipboard, switch view to plain text mode 
    • Using qt-4.4, a Make error regarding QAtomic and QBasicAtomic (4.4 has QAtomicInt and QAtomicPointer, Before 4.4 there is no "QAtomic*" at all according to the class refs)
      Qt Code:
      1. In file included from ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/qeditor.cpp:19:
      2. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:32:19: error: QAtomic: No such file or directory
      3. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:215: error: ‘QBasicAtomic’ does not name a type
      4. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h: In member function ‘void QDocumentCursorHandle::ref()’:
      5. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:202: error: ‘m_ref’ was not declared in this scope
      6. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h: In member function ‘void QDocumentCursorHandle::deref()’:
      7. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:203: error: ‘m_ref’ was not declared in this scope
      8. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/document/qdocument_p.h:203: error: ‘m_ref’ was not declared in this scope
      9. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/qeditor.cpp: In member function ‘virtual bool QEditor::moveKeyEvent(QDocumentCursor&, QKeyEvent*, bool*)’:
      10. ../../../../src/edyuk-1.0.0-pre1/3rdparty/qcodeedit2/lib/qeditor.cpp:1973: warning: unused variable ‘prevcol’
      11. make[2]: *** [.build/4.4.0-tp1-unix/obj/release/qeditor.o] Error 1
      12. make[2]: Leaving directory `/d/bld/edyuk/src/lib'
      13. make[1]: *** [release] Error 2
      14. make[1]: Leaving directory `/d/bld/edyuk/src/lib'
      15. make: *** [sub-src-lib-lib-pro-make_default] Error 2
      16. makeobj[0]: Leaving directory `/d/bld/edyuk'
      To copy to clipboard, switch view to plain text mode 
    This was just a first look, before investigating reasons or fixes.

    Thank you,
    -travlr
    Last edited by travlr; 26th December 2007 at 15:34.

  9. #9
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Double click in the editor got broken recently. With a slightly older QCodeEdit, double clicking selects a word. In the latest svn, double click does nothing.

  10. #10
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    @travlr :
    • There must be a misunderstanding somehow... SVN repo always hold the most recent code AND from time to time I package the content of the repo and put in on Sf.net dowload servers so that more people can play with it (as some are reluctant to use SVN...)
    • Would you be running under BSD? Or some exotic UNIX system? I must admit I'm not an expert of clean shell scripting and I'd be able if someone could help me to improve the portability of the build script...
    • Do you know what I need to do in order to make it compatible with Qt 4.4 then? Looks like it's just a matter of include files. Or did the QBasicAtomic class disappear completely in the utter nothingness?
    • Some of your comments concern Edyuk ad not QCodeEdit so it may be better to post in the appropriate thread.

    @Usability : I fixed the double click regression.
    Current Qt projects : QCodeEdit, RotiDeCode

  11. #11
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Double click working again, thanks!

  12. #12
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    How do you feel about making ctrl-f always take you to the find box?
    Done.

    A couple other changes have happened lately. Among which the addition of a line change panel which indicates the modified lines since last save.
    Current Qt projects : QCodeEdit, RotiDeCode

  13. #13
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    A couple more good news :
    • caduel has just fixed the code to work with Qt 4.4 (well actually it broke Qt 4.3 backward compat but I fixed that by now so everything is fine regarding this issue
    • I achieved very significant speed improvements when editing veryl arge files (especially near the end where it used to lag...)
    • Fixed cursor auto update mechanism in combination with cursor mirrors (typing enter when using cursor mirrors used to wreck cursor positions in a somewhat weird way.)
    Current Qt projects : QCodeEdit, RotiDeCode

  14. #14
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    What was the problem with Qt 4.4? it should compile perfectly, since 4.4 is source compatible with 4.3.

  15. #15
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by elcuco View Post
    What was the problem with Qt 4.4? it should compile perfectly, since 4.4 is source compatible with 4.3.
    It's described in a previous post... Contrary to what one could expect there's been some, at least one, API changes which happened in the QBasicAtomic class (got hidden since the introduction of QAtomicInt AFAIK). This class is a low level atomic counter used in reference counting (in both text lines and cursors).
    Current Qt projects : QCodeEdit, RotiDeCode

  16. #16
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QCodeEdit

    They weren't part of the public API, were they?
    J-P Nurmi

  17. #17
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    It's described in a previous post... Contrary to what one could expect there's been some, at least one, API changes which happened in the QBasicAtomic class (got hidden since the introduction of QAtomicInt AFAIK). This class is a low level atomic counter used in reference counting (in both text lines and cursors).
    BTW, I am getting compilation problems on 4.3. What version do you support ...? 4.4? 4.3?

  18. #18
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by elcuco View Post
    BTW, I am getting compilation problems on 4.3. What version do you support ...? 4.4? 4.3?
    I'd like to support both but I can't test Qt 4.4
    As for your compile troubles could provide me the following informations :
    • OS
    • Qt version
    • compiler
    • QCodeEdit version (i.e package or SVN rev)
    • full compile log (do a make distclean first if you are using a SVN copy)
    They weren't part of the public API, were they?
    The QAtomic and QBasicAtomic class are not documented but they are accessible (i.e. not located somewhere in "private" headers) and as they are widely used throughout Qt and the only way to achieve atomic ref counting I assumed they would not be a source of troubles and used them...
    Current Qt projects : QCodeEdit, RotiDeCode

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.