blob: f9730c650f2c219b89d095bab44a4e177ba569cc [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2015, 2016 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eric Poirier (Eclipse Foundation) - Initial implementation
* Christopher Guindon (Eclipse Foundation)
*******************************************************************************/
// This file must be included
if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();}
?>
<h1 class="article-title"><?php echo $pageTitle; ?></h1>
<p>
<a href="https://projects.eclipse.org/projects/tools.acute">Eclipse aCute</a> is one of the newest
community projects brought into the Eclipse Tools Project ecosystem. It is a language based extension that provides
development tools for C# and <a href="https://docs.microsoft.com/en-us/dotnet/core/">.NET Core</a>
inside the Eclipse IDE. Recent technologies have allowed aCute's C# editor to be developed with ease allowing for
more resource allocation towards other language features, making it a great example for all developers looking to
build an editor of their own.
</p>
<p>
The name aCute is derived from the C in C# and "acute" being a synonym for "sharp". However, I personally
like to think it is because the project is a "Cute" and efficient implementation of a C# editor. Beginning as a proof
of concept showing the value of using language server technology to create more efficient editors implementations,
the project has grown to include a full suite of editor features along with wizards and tools that implement
.NET Core commands within the Eclipse IDE.
</p>
<p>
If you are a C# developer, you may have already been presented with the Marketplace suggestion popup when opening a
C# file telling you that better editor support for C# files is available. However, you can find aCute within the
<a href="http://marketplace.eclipse.org/content/acute-c-edition-eclipse-ide-experimental">Eclipse Marketplace</a> by searching for
"aCute: C# edition in Eclipse IDE".
</p>
<p>
As with all community projects, aCute's priorities are chosen by the community. If you have a feature that you think
would benefit users, then join in on the discussion and help aCute grow. Also, if you wish to join the development
yourself, new contributors are always welcomed.
</p>
<p>
<h2>Behind The Editor</h2>
<p align="center">
<a href="editorDemo.gif">
<img class="img-responsive" src="/community/eclipse_newsletter/2017/august/images/editorDemo.gif" alt="aCute C# Editor Demo">
</a>
</p>
<p>
When it comes to building an editor, there are two major components: (1) Generating the content for each of its features
and (2) Displaying the content in the editor. The C# editor within aCute has all the features you'd expect to find
in a language based editor including syntax coloring, auto-complete suggestions, code diagnostics, and code navigation
tools. Each of these features is generated by the Omnisharp Language Server (excluding
syntax coloring which is provided by Textmate) and displayed using Eclipe's Generic Editor.
</p>
<h3>What are Language Servers</h3>
<a target="_blank" href="https://github.com/Microsoft/language-server-protocol">
<img class="img-responsive" src="/community/eclipse_newsletter/2017/august/images/lsp.png" alt="Explanation of the Language Server Protocol" align="right">
</a>
<p>
The <a href="https://github.com/OmniSharp/omnisharp-node-client">Omnisharp Language Server</a> that aCute
uses can be described as a C# parser that when given the text of a document and a request type, uses
the language server protocol to return the results of the requests. This means that the language server
contains all the logic for parsing the language, which obfuscates this from the actual development of the editor. It
is able to return auto-completion suggestions, information on a specific character index which is used for hover
information, and errors within the current code base. The major bonus of using the language server protocol for
communication with language servers is that it is universal for languages and consuming tools. That means that this
same language server can be used to build a C# editor in any other editor without any extra work for language parsing.
</p>
<h3>Why the Eclipse Generic Editor</h3>
<p>
The <a href="http://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Feditors_genericeditor.htm">Eclipse Generic Editor</a> is a text editor designed to be extended to supply basic support for multiple languages.
Developers can extend the Generic Editor with the content for syntax highlighting or auto-completion suggestions for a certain context type.
When a file is opened within the Generic Editor that matches a context type provided, the specified set of extensions
are applied. This means there is only one editor but uses context types to decided when to employ a specific
plugin's extensions. So in the example of aCute, C# files will be opened not in an 'aCute Editor' but instead
in the Generic Text Editor and the language server will work on the document through the Generic Editor's extension
points.
</p>
<h3>How These Work Together</h3>
<p>
These two technologies combined are the reason why providing support for new languages has become easier and faster
within Eclipse. Language Servers obfuscates code parsing away from the editor developer and the Generic Editor provides
the majority of the boilerplate code required to connect a language server to the editor. Along with functions to
start, stop and communicate with the language server, the code snippet below take from aCute's plugin.xml file is all
the coding required to connect the language server results to the Generic Editor enabling all of the features shown
above:
</p>
<pre>
<font color="#268bd2"><b>&lt;extension</b></font>
<font color="#268bd2"><b>point=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.ui.editors&quot;</i></font><font color="#268bd2"><b>&gt;</b></font>
<font color="#268bd2"><b>&lt;editorContentTypeBinding</b></font>
<font color="#268bd2"><b>contentTypeId=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.acute.csharp&quot;</i></font>
<font color="#268bd2"><b>editorId=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.ui.genericeditor.GenericEditor&quot;</i></font>
<font color="#268bd2"><b>&lt;/editorContentTypeBinding&gt;</b></font>
<font color="#268bd2"><b>&lt;/extension&gt;</b></font>
<font color="#268bd2"><b>&lt;extension</b></font>
<font color="#268bd2"><b>point=</b></font><font color="#17c6a3">&quot;org.eclipse.lsp4e.languageServer&quot;</font><font color="#268bd2"><b>&gt;</b></font>
<font color="#268bd2"><b>&lt;server</b></font>
<font color="#268bd2"><b>class=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.acute.OmnisharpStreamConnectionProvider&quot;</i></font>
<font color="#268bd2"><b>id=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.acute.omnisharp&quot;</i></font>
<font color="#268bd2"><b>label=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.acute.OmniSharp&quot;</i></font>
<font color="#268bd2"><b>&lt;/server&gt;</b></font>
<font color="#268bd2"><b>&lt;contentTypeMapping</b></font>
<font color="#268bd2"><b>contentType=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.acute.csharp&quot;</i></font>
<font color="#268bd2"><b>id=</b></font><font color="#17c6a3"><i>&quot;org.eclipse.acute.omnisharp&quot;</i></font>
<font color="#268bd2"><b>&lt;/contentTypeMapping&gt;</b></font>
<font color="#268bd2"><b>&lt;/extension&gt;</b></font>
</pre>
<p>
The language server is defined and a content type, being all .cs files, is given to both the Generic Editor and the
language server to know on what documents they should be used. That is the core of aCute's C# editor.
</p>
<h2>.NET Core Integration</h2>
<p>
The other large feature presented through aCute is that the entire life cycle of a .NET Core project can be completed
without having to leave the Eclipse IDE thanks to the integration of the
<a target="_blank" href="https://docs.microsoft.com/en-us/dotnet/core/tools/">.NET Core Command Line Interface</a>.
Each of this feature's parts should feel very natural to Eclipse users as they are integrated with similar methods
as most other languages. This is not only important to ensure easy adoption, but simplifies the development process
as the majority of the frameworks are built to accompany new language integration.
</p>
<p align="center">
<a href="wizardDemo.gif">
<img class="img-responsive" src="/community/eclipse_newsletter/2017/august/images/wizardDemo.gif" alt="aCute C# Editor Demo">
</a>
</p>
<ul>
<li>
.NET Core projects are able to be created from the New Project wizard and with .NET Core 2.0, various templates
are available for generation.
</li>
<li>
Running a project is as simple as clicking "Run" and the capability of editing the run configuration is also available.
</li>
<li>
Projects with accompanying test suites built using frameworks such as MSTest and XUnit are able to be run directly
within the Eclipse IDE against your programs. The results are currently printed to the console, but aCute can be improved
with a dedicated UI element for visualizing the results.
</li>
<li>
Finally, once a project is created, built, and tested it can be shared using the export wizard.
</li>
</ul>
<p>
To assist with .NET Core development, a debug feature can be added to aCute, which is currently missing. This along with other
additions are an opportunity for future development and will allow users to work more extensively with .NET Core projects
within Eclipse. If you are interested in being a part of these developments, the aCute Team would love to onboard new contributors.
</p>
<h2>The Future of aCute</h2>
<p>
Up until now, aCute as been focused on getting the core components in aCute to a project ready state. As aCute has achieved
this goal, its plan will be to use the influx of feedback retrieved from becoming a certified project to perfect the current
suite of features and implement further additions that are requested by the user community. After this, hopefully more
users and more contributors will join Team aCute and assist in making Eclipse a go to IDE for C# development. aCute stands
as an example of how creating language based projects for Eclipse has become simplified. Hopefully aCute will inspire more
developers to take on the task of developing other language based projects for themselves.
</p>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/DwN6e_VcdD8" frameborder="0" allowfullscreen></iframe>
</div>
<div class="bottomitem">
<h3>About the Author</h3>
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-8">
<img class="img-responsive"
src="/community/eclipse_newsletter/2017/august/images/lucas.jpg"
alt="Lucas Bullen" />
</div>
<div class="col-sm-16">
<p class="author-name">
Lucas Bullen<br />
<a target="_blank" href="https://www.redhat.com/en">Red Hat</a>
</p>
<ul class="author-link list-inline">
<li><a class="btn btn-small btn-warning" target="_blank" href="https://www.linkedin.com/in/lucasbullen/?ppe=1">LinkedIn</a></li>
<li><a class="btn btn-small btn-warning" target="_blank" href="https://www.twitter.com/thelucasbullen">Twitter</a></li>
<?php // echo $og; ?>
</ul>
</div>
</div>
</div>
</div>
</div>