Outreachy Final Report

FsAutoComplete support for .NET Template Engine

This post is my final report of work done under the project “FsAutoComplete support for .NET Template Engine” during my Outreachy 2019 internship. FsAutoComplete (FSAC) is an F# compiler service API exposed via a con-sole application std I/O or http or Language Server Protocol (LSP). FSAC is a backend service for rich editing such as autocomplete, tooltips, etc in editors. It can be hosted as command-line interface (stdio mode) or ashttp server (http mode), both using the same json protocol. As of now, FSAC is used by Emacs, Vim And Visual Studio Code. I hope this post will be beneficial for future contributors/Outreachy applicants of FSAC and gives futher notion about the future work on FSAC.

Ionide is a Visual Studio Code (VSCode), a source-code editor developed by Microsoft for Windows, Linux and macOS, package suite for cross platform F# development. FsAutoComplete (FSAC) is a backend F# compiler service API that communicates with Ionide and provides F# specific features including advanced editor features (autocomplete, go-to definition, tooltips, rename, various refactorings and quick fix suggestions), integration with .Net project system, and lot more.

The internship project work involved creating FsAutocomplete(FSAC) support for .NET Template Engine (dotnet new). The internship aimed at creating FSAC support for .NET Template Engine i.e. to introduce commands and functions that allows a user to query and discover .NET templates through the editor’s user interface and doesn’t have to involve a user interaction through terminal or command line prompt. A developer should be able to query for a list of installed templates and their details and create new project from template such as a Console Application. In other words, the project aims at enhancing user experience on editors by adding the backend support in FSAC for creating new .NET projects by searching .NET templates from the editor’s UI. Prior to the predefined internship tasks I also implemented a command named FSDN command in order to increase my knowledge about the FSAC codebase and the workings of F# development.

Listing Installed Templates

FsAutoComplete didn’t have a built-in function that would let a developer select templates from the VSCode interface at the time of creating a new F# project. So, to add this feature the first step was to list all the available .NET templates. This required a F# function calling a command to list all the .NET templates. The user can also insert a keyword in the search to list only a few results that the user is interested in and not just the whole set of installed .NET templates.

Details of selected Template

Each .NET template has details such template name and description, its author and a set of options or parameters with their description and default values, such as –no-restore and –framework. After selecting the required .NET template from the list this feature helps in listing the details and options of the selected template. The user also has the option of changing the values of the options or the default values can remain unchanged.

Create New Project

As it is known by now that to create a new project using .NET it required to use “dotnet new” command in the terminal or command line prompt. After the user sets all the option values of the selected .NET template a command line query is sent through the console to create a new project. A function was implemented to call a defined command which takes details of the required .NET template and the option or parameter values as input and output a command line query of “dotnet new” command with relevant attributes. The result of the command will create a new F# project from the selected .NET template.

Adding Tests

Each feature was supported by unit tests and integration tests for testing happy path of the functionality of the commands and their handling or support functions and to avoid invalid values as it gives fatal errors.

Contribution before official start of Outreachy

FSDN Command

In F#, there are two syntaxes - one for normal (value) expressions, and one for type definitions. F# Signatures[3] can be of a set of program elements, such as types, namespaces, and modules. It can be used to specify the accessibility of these program elements. All this information is stored in signature file. F# function signatures tell about the input data type and return data type of a function. To search for F# library function which has a signature matching to what a user requires, they can search using the FSDN command. This command sends an http request to the fsdn website, which allows to query for the signature of a function, and return the list of matching functions. This command improved the development time as the search feature was directly available in the editor and a developer would not need to search them from separate sources.

Further discussion

I have experienced that the developing ecospace of F# community is brilliant and the work that the contributors are putting in has helped in rise the excellent tooling and interesting projects that have matured over this time period. My internship work resulted in an assisted user experience for creating new development projects by querying for a list of installed templates and their details and creating new project from template such as a Console Application. In other words enhancing user experience on editors by adding the backend support in FSAC for creating new .NET projects by searching .NET templates from the editor’s user interface. I can happily annouce that my internship was thus successfully completed.

The interesting extensions and further line of potential work for this project can be to implement more features that help in discovering .NET templates online and installing the templates from the source code editor’s user interface.

Final Words :)

I’m truely glad that I had received an opportunity to be a part of Outreachy this summer. The feeling of being intimidated by large codebases is far gone. The opportunity of doing an internship with F# Software Foundation has helped me develop variety of technical skills as software developer. The internship provided me with a rich experience in the spectrum of industrially accepted production level support code in a software. I have gained knowledge about project collaboration and contribution in development of a production level backend server software. As a developer it is also crucial to understand the significance of testing and debugging in software development.

The internship experience with the company has assisted me in maintaining the software development standards in a community based project. Also the experience has taught me the relevance of documentation and its detailed structured that assist a software developer in maintaining the production level standards of development.

I’d like to thank Outreachy and F# Software Foundation for providing this opportunity. I, wholeheartedly thank Enrico Sada (Mentor, FSAC) for having faith in me, selecting me to be a part of this valuable project and for constantly motivating me to do better. Enrico was and is always there to show me the right track when needed help. With help of his brilliant guidance and encouragement, I was able to complete my tasks properly and was to the mark in all the evaluations done. Last but not the least, I would like to express immense gratitude towards Shoeb Patel (Ex-President, Aficionados, NIT Goa) for encouraging and guiding me to apply for Outreachy.

Thanks for reading the post. :)
Happy Coding!