Ted2Go IDE

About Monkey 2 Forums Monkey 2 Projects Ted2Go IDE

Tagged: ,

This topic contains 596 replies, has 46 voices, and was last updated by  nerobot 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 597 total)
  • Author
    Posts
  • #3610

    nerobot

    Participant

    Hi guys!

    Let me introduce my version of ted2 – Ted2Go.
    (based on original v1.0.4 sources)
    I am at the beginning of way, but I done some things and want to share and discuss with you.

    https://github.com/engor/Ted2Go

    The Main idea is in using the only Ted2CodeTextView class for all documents with code.
    I already made this class.

    How it works?

    Class CodeTextView contains components: Keywords, Highlighter and CodeFormatter, which allow us to customize text view. These componets based on Plugin system and assigned automatically according to opened file type.

    For this purposes I extend Plugin class to PluginDependsOnFileType – this kind of plugins are stored info about file type (file extension) and method CheckFileTypeSuitability, that do checking. So we can use this method to check – is this plugin designed for our file or not.

    I created 3 base plugin classes: KeywordsPlugin, HighlighterPlugin and CodeFormatterPlugin. By extending these classes you can add you own Keywords, Highlighter and CodeFormatter for any language! Easily, not need to change other parts of code.

    Now, I am thinking about auto-registering code-filetypes – to eliminate the need to specify extensions.
    That is, when we add new instance of KeywordPlugin – we’ll automatically got registration of this-plugin-specific-filetypes as part of CodeDocument and such filetypes will be opened as code files.
    The main thing here – automatically.

    [ Inheritance: Ted2CodeTextView < CodeTextView < TextViewExt < TextView (mojox) ]

    ————-
    What I done:

    TextViewExt – extended version of mojox.TextView, contains basic key and mouse processing inherent to all textual documents. also has a flashing cursor. (can be included in mojox)

    CodeTextView – extended version of TextViewExt, contains basic key processing inherent to all code documents; also contains CodeFormatter, Keywords and Highlighter components.

    ConsoleExt – extended version of mojox.Console, allow to copy selected text and select whole line by mouse double click.

    Monkey2CodeFormatter – plugin for monkey2 files, now it can only capitalize keywords.

    Monkey2Highlighter – highligher from original ted2.

    Monkey2Keywords – load keywords from json or hardcoded.

    CppKeywords – test plugin for c++ keywords
    CppHighlighter – also test plugin, is equivalent to Monkey2.

    Monkey2KeyEventFilter – key filter for .monkey2 files, for example, it catch F1 to show help.

     

    PS. sorry for my english, it’s not my primary lang.

    #3705

    cocon

    Participant

    Wow, basically you can make Ted a multi language editor that way, clever mod.

    #3707

    nerobot

    Participant

    I think – it’s good idea to continue develop inside of monkey2-fork (not separated ted2) to make merge from official easily.

    And maybe Mark pull some of changes.:)

    #3754

    nerobot

    Participant

    Hi. Here is an easy way to cancel progress dialogs.

    In this case – for cancel building dialog.

    Just add this code into buildactions.mx2 / BuildActions class / BuildMx2 method.

    #3764

    nerobot

    Participant

    I just pushed new stuff – base auto completion support!

    Now it shows keywords only, but easy to extend.

    Next step 1 – write simple monkey2-parser, so we get smart completion.

    Next step 2 – write code analyzer to check current scope and all variables (global, local, params), so we get pro-level ide

    And between these steps – add CodeTreeView and Navigation panels (each cool ide must have).

    Windows version of ted2go (dropbox)

    Issue: cursor became invisible after some time. (Timer became broken? but why)

    #3859

    nerobot

    Participant

    New stuff in my repo – code parser for monkey2 files.

    Parser is simple yet. What it can:

    1. Parse the first word after these keywords: “class”,”struct”,”enum”,”global”,”const”,”method”,”function”,”property”
    2. Parse recursively if file contains #import
    3. Check file last modified time before paring – to skip not modified files.

    And all words from parser we can see in autocomplete list.

    What todo:

    1. Improve parser – so it can know about scopes and all variable types (field, local, params, lambda – gradually)
    2. Check current scope for autocomplete
    3. Merge with latest monkey2 repo changes.

    Even now, writing code has become much easier!

    #3863

    degac

    Participant

    Wow, so many things in so few time!
    I’m still trying to understand MX2 !!!

    Just a quick question

    What does exactly mean += in this case?
    It means ‘Add a NEW event filter to (list/stack/map) etc? And of course ‘attach’ the code in the labmda() section.’

    I saw the same syntax in the module source, but it’s no so clear (to me).

    #3865

    nerobot

    Participant

    What does exactly mean += in this case?

    This mean ‘subscribe’ to KeyEventFilter function inside of App.

    This Lambda is a listener.

    So all listeners subscribed to KeyEventFilter (via += operator) will be called when App begin processing keyboard event.

    This call  is  usual function call, in our case: KeyEventFilter(event)

    If there is no one listener subscribed to then nothing happen.

    #3870

    degac

    Participant

    Ok thanks

    a little more clear!

    #3871

    degac

    Participant

    BTW, just compiled your TED2Go… nice implementation of autocomplete! Very handy (and fast compiling!)

    More to learn (for me!)

    #3872

    nerobot

    Participant

    Nice to hear you!

    and fast compiling

    Because there is just a bit of code. Ted2 is small app

    But ‘clean’ compiling (no cached files yet) makes me wait.

    #3889

    nerobot

    Participant

    Useful git command for all fork-men:

    Separate all-and-only ted2 changes into custom branch.

    Then we can easily merge with our fork – pull from branch ted2only into fork repo (if repo contains ted2 stuff only, not all monkey2).

    #4036

    AdamStrange

    Participant

    question which version of monkey2 do I need to compile?

    V1.02 and v1.04 just give loads of errors.

     

    I’m very interested in how you implemented the autocomplete

    #4037

    nerobot

    Participant

    I’m using the latest version (1.0.6).

    But my code is dirty now; I clean up it when complete common features (like checking current scope and getting variable types in := expression.

    Now I’m using ‘dev’ branch for undone things.

    #4049

    nerobot

    Participant

    Working on code parser I just added simple CodeTreeView navigator – I need it to see parsing result.

    There are idents only in the tree, that’s enough for the moment.

    All variables started with Local, Field and so on is presented here, even if they are deep inside of For, If, etc. Will be fixed later.

    CodeTreeView filled on document open, don’t adjust changes yet.

    Click on item – jump to line with it.

Viewing 15 posts - 1 through 15 (of 597 total)

You must be logged in to reply to this topic.