Upgrade to Pro — share decks privately, control downloads, hide ads and more …

_COSCUP2013__MonoDevelop__how_modern_C__IDE_and_text_editor_works.pdf

 _COSCUP2013__MonoDevelop__how_modern_C__IDE_and_text_editor_works.pdf

Atsushi Eno

August 19, 2013
Tweet

More Decks by Atsushi Eno

Other Decks in Programming

Transcript

  1. MonoDevelop: how
    modern C# IDE and code
    editor works
    Atsushi Eno

    View Slide

  2. Mono and Xamarin
    Mono
    open source C#/.NET framework for linux, mac, win
    mono, gtk-sharp, monodevelop (IDE)
    today Xamarin drives mono development
    mobile product company
    iOS and Android, with IDE "Xamarin Studio"

    View Slide

  3. Atsushi Eno (@atsushi_eno)
    ex-mono hacker
    working at Xamarin
    living in Tokyo/Japan =>

    View Slide

  4. Xamarin Studio / MonoDevelop
    Xamarin Studio
    basically it is MonoDevelop w/ commercial extensions
    MonoDevelop
    cross platform IDE (linux/mac/win/...)
    Unity, PSMobile uses MD
    the making of Xamarin Studio (modernizing the UI):
    http://blog.xamarin.com/the-making-of-xamarin-studio/

    View Slide

  5. Demo: what MonoDevelop can do

    View Slide

  6. Language Service
    Also, "Compiler as a Service" (CaaS)
    on-the-fly code parsing and analysis, as a
    service
    To learn about this, let's have a look at code
    editor evolution...

    View Slide

  7. IDE text editor prior to LS/CaaS
    syntax highlighting based on regexp

    View Slide

  8. IDE text editor prior to LS/CaaS
    get error / warning from stdout / stderr
    jump to error location.

    View Slide

  9. Integrated code parser
    IDE to have its own parser
    supposed to process incomplete sources
    provide basic source structure (AST) to editor
    "where is Type T in namespace N?"
    in-memory source parsing
    type/member selector

    View Slide

  10. Type system database
    A type can be from sources or a reference
    (library).
    Complete type definition list can be built.
    Semantic analysis of sources is doable now.
    e.g. collect all members including base types.

    View Slide

  11. Integrated code parser + type DB
    Gives you...
    "go to definition"
    find references (usage, inheritance, overrides...)
    get code completion on ".", "::" or "->"
    opportunity for many advanced features too
    Mono.CSharp.dll contains C# implementation of it.

    View Slide

  12. Language (Compiler as a) Service
    Code analysis and transformation aid
    get type definition and their locations, find references
    and more advanced features
    Another aspect of LS / CaaS
    Historically all those features were tied to the IDE
    But they should be usable in any IDEs
    Separation of text editor and language toolkit

    View Slide

  13. LS/CaaS implementations
    ICSharpCode.NRefactory: C# so far
    for SharpDevelop, MonoDevelop, OmniSharp(vim)...
    Microsoft Roslyn: C# and VB
    will be used in Visual Studio in the future
    "pretty similar" to NRefactory
    F#, HaXe, TypeScript, jedi (Python) etc.

    View Slide

  14. use (and/or create) LS / CaaS
    using LS / CaaS from editor
    mostly out-of-process model: launch host server
    NRefactory limits the scope to .NET
    creating LS / CaaS - difficult!
    API should be simple, to not break compatibility
    stringly-typed API FTW!

    View Slide

  15. Extra
    Ongoing experiment: TypeScript addin

    View Slide

  16. Q&A

    View Slide