📜 ⬆️ ⬇️

Adaptation of Visual Studio for development under Salesforce - Introduction

Disclaimer: This topic does not contain the implementation of what is listed in the title, and does not contain technical details. Here are just listed the problems that I am going to solve and a short plan on how this should be implemented. Given the newness of the topic and a good level of complexity for me, I can not vouch that this article will not be the first and the last. But I honestly would like to bring this undertaking to the end, parallel lighting it here. This article is, among other things, an additional motivation.

Introduction to entry


It just so happened that a few weeks ago I had to relearn from a C # developer to a Salesforce developer. And I would not mind saying that it turned out to be simple and fascinating (although it is in many ways), but one fact regularly continues to spoil my mood and makes me remember my beloved .NET. For the past 5 years I have been working exclusively with VisualStudio - developing WinForms applications, SIlverlight, pure C # backend, TypeScript as a hobby. And I perceived this tool as something that will always be with me, as something that makes development comfortable, and stupidly thought that the rest of IDEs are at about the same level of development (I tried hard to forget my experience with some Flex IDE on base of eclipse).

And then bang ... Force.com IDE - IDE based on Eclipse to work with Salesforce or Mavensmate plug-in to Sublime Text.

Short educational program

Development under Salesforce is conducted using two main languages ​​/ technologies - Apex code based on Java, and VisualForce - a framework for building a custom web part of "applications".
The peculiarity of using the entire Salesforce platform is cloudiness of the brain (not in reproach - just a fact), namely - compilation of the Apex code is performed in the cloud (and this cannot be done locally), and development can be carried out directly in the browser using the so-called Developer Console, which is a weak semblance of an IDE.
')
Ok, great, take any IDE for Java and work on it. It is impossible, because the language is really different, and the aforementioned OGM obliges us to save every sneeze into the cloud and compile it there.

What for?


It is a reasonable question - why, in fact, not relearn the new IDE as a normal person? Here, for me, everything is quite simple:


The last point should be considered a little more detailed - since I’ve only been interested in this for a couple of weeks, the list I have accumulated is small but sufficient for me:

As a topic for discussion, it would be interesting to know - and how do you feel about such features of the IDE?

And how will we solve this?


From the headline and background history, a common vector is an extension for Visual Studio, which will allow us to fully work with Salesforce code. If you disassemble the concept into principle blocks - I would single out this (in that order):
  1. Apex syntax highlighting
  2. VisualForce syntax highlighting
  3. Support for Salesforce "projects" (including separating the concepts of Save and Compile)
  4. IntelliSense implementation
  5. Syntax error display
  6. Panel for working with unit tests and logs Salesforce
  7. Build Visual Studio for Salesforce based on Visual Studio Shell for free standalon distribution
  8. The rest of the sugar as far as possible


Interesting tasks for the first stages

One of the most interesting problems (thanks to Salesforce) is the lack of grammar of both Apex and VisualForce anywhere. Yes, Apex is based on Java, but the changes are decent and build a grammar based on Java and the text reference Apex, a long and tedious task ... But I did not find any other options, so the process is running.
What is important in the formalization of grammar is what will be used to build the lexer - ANTLR or Irony (the two most interesting projects). At ANTLR, I like the format of the grammar task much more (it’s much more familiar to me, because it doesn’t mix with the code), but I don’t like the approach of the project itself — the Java application that generates the lexer automatically (in Java or C #). Irony is much more flexible and free to choose how and what to implement, but I don't like the task of the grammar - a terrible mix of code and BNF rules.
I would be grateful for any additional information on similar tools for .Net in the comments

The second problem I encountered during the week of studying materials and leisurely picking in the insides of the VS SDK is documentation and examples. I seriously always considered the documentation on msdn one of the best examples. Everything is there, great tutorials, examples, detailed information. In this case - complete garbage. Examples from msdn articles are not compiled (well, figs with them), after the banal fix for stupid errors, the code simply does not work. Information (which the cat wept for) is spread over various places and important nuances can be collected for a dozen different materials. VS SDK 2013 (namely, I intend to develop an extension for this version) is not supplied with examples, and the examples from VS SDK 2010 are incomplete and outdated (old approaches are used without the Managed Package Framework and the lexer itself is not included in the example at all - you have to use .NET Reflector for pick out the code.

Next steps


As I already wrote - I am not sure that I can bring this project to an adequate form, but I hope this will happen. Now I pick out the information on Syntax Highlighting and, in parallel, I am working on the Apex grammar. With a good set of circumstances in about a month I would like to share with you progress, but if nothing happens in a month, you know - I fell under the pressure of Apex or Visual Studio :)

I would be grateful for useful resources, articles, tips, examples of the implementation of the Language Service for Visual Studio 2010+ (IronPython is not an option) and generally on the topic.

Thanks for attention.

Source: https://habr.com/ru/post/213677/


All Articles