Customizability of the IDEs - eclipse

I am thinking of modifying an existing IDE (Ex : By developing a plugin) to provide support for a proprietary scripting language. I just need to implement few features like syntax highlighting, Autocompleting etc. (i.e the requirements are really simple). What would be the best IDE or Text editor to integrate the feature. As an example if I think to develop an eclipse plugin for that it would be a pain.
What do you think about Notepad ++?

You might want to give the NetBeans Generic Language Framework a try.
NetBeans project called Generic Languages Framework allows you to define a programming language and integrate it to NetBeans IDE. In the first step you should describe the language - lexical part (define tokens using regular expressions) and syntax (grammar rules). In the second step you can define how to visualize this language in NetBeans. You can define colors for tokens (syntax coloring) or folding (based on grammar rules). You can define what parts of this language should be displayed in the navigator, and how to indent this language plus many other features.
This tutorial should guide you through the process of creating new NetBeans module, adding languages support into it, describing lexical and syntax structure of your language and adding support for all standard editor # features for your language.

Notepad++ allows you to define custom syntax highlight files in a very easy way, but it's not a very good solution for auto-completion (look at this SO question).
If you want a real IDE to extend, I suggest you to use Eclipse.
Update: Tutorial on how to develop an Eclipse plugin.

In vim you can easily add your custom syntax highlighting rules by adding another file in the syntax folder; for the details it is best to look at the help.
If I remember correctly notepad++ also allows defining custom syntax files.

Related

How to setup a new language IDE

At work we are using a proprietary language and to program we are using Notepad++ with a simple code highlight. That is really annoying so, what I want to do is to invest some time to setup a text editor or an existing IDE to support my language.
I've googled a lot and there are so many options and before starting to work I wanna ask to you what is the best choice.
What I want to do is to have, like an IDE, a syntax highlight, a window with the function list tree, with the local function variables inside the same subtree, maybe text autocomplete (if I type "pro" I would like to see the suggestion "procedure" and if I press enter it will write for me something like
procedure "name" {
--code--
}
with the cursor on "name" ready to change it.
etc etc...
Can you suggest me the right path to follow?
Is it to keep using Notepad++? With sourcecookifier? functionlist?
Or I have to change to another text editor?
Or there is some famous IDE like Eclipse, NetBeans etc that allow to easily add my own language?
PS. my language is pretty simple, I don't have complex structures, is Pascal-like. Something like that:
variable int xyz
PROCEDURE asd
BEGIN
END PROCEDURE asd
I would recommend you to stay with Notepad++ and extend it with some plugins and configuration. This would be fairly quick and easy to set up and still give a big win, even though you might not be able to get all the nice features of something like Eclipse. But since you already know the Notepad++ it wouldn't require learning an entirely new tool.
Some plugins that I have found useful
Function List
Light Explorer
XBrackets Lite
There are probably a lot more that can be useful to you.
Notepad++ also got some built in auto-completion functionality that can be enabled in the settings.
Have you evaluated Eclipse XTEXT ?
What is Xtext?
Xtext is a framework for development of programming languages and domain specific languages.
The only IDE I have used for the last few years is Eclipse. There are lots of other IDEs available, also notable and popular is Netbeans. There are many others. It's important to note that all IDEs have their fans, but I can only speak to Eclipse.
Eclipse is a platform, which means it is an application on which you can build other applications. Eclipse provides a framework which you can customize and extend to produce a working application. It takes care of the user interface, preferences storage, modularisation using OSGi, and lots of other things.
Eclipse has facilities to support what you're looking for:
Syntax highlighting in the editor.
The Outline View provides function and variable listing in a tree
Autocompletion and Suggestions (activated by hitting ctrl-space)
Code Templates to fill out files and procedures etc.
The disadvantage is that customising and extending Eclipse to do what you want isn't trivial. Having written a language debugger for Eclipse, I can tell you that leveraging Eclipse's platform helped enormously, but there's a learning curve. You'd essentially have to be coming up with a new set of plugins to provide your highlighting, outlining, autocomplete suggestions and templates (I'm not sure if template support is built into the platform or not).
So I would say, unless you can find some sort of extensible editor for Eclipse - I know Aptana is extensible for tag-based markup - you are probably as well staying with your existing tooling.
Do explore the other IDEs though - I've heard good things about IDEA as well as Netbeans. :)
Good luck!
I can recommend SynWrite editor. Good support for external languages, fully customizable. (Editor of new lexers is there)

Eclipse plug-in: Create a new file extension for a language not supported by Eclipse

I am creating an Eclipse plug-in for it to support a new language. The problem I have is with the content type/file association and its respective editor.
The language has no base in Java or XML and let's say its extension is '.xyz'
From what I understood of research online, I would need to create a new Content Type with file extension '.xyz'. But all the information I have found online has related to either associating a new extension with java (for java syntax highlighting) or creating a new type of file which can be a variant of XML, hence having a lot of details about the describer.
Basically, I am confused about the content describer, am I also to create a new describer for a new language? And what base-type would I give for a language not related to XML or JAVA at all?
Also, since I will be adding my own syntax highlighting, would I need to create my own editor or can I just open such a file in the pre-set editorArea (editors).
The package I am looking at for content types is org.eclipse.core.contenttype.contentTypes.
I realised that I never really picked an answer for this question and eventually I found some useful information on it, so I thought I would share it.
This is the information I understood and used; I apologize if there are any errors or I have misunderstood, and I am open to any corrections.
It was actually a lot simpler than I expected.
To create a new file extension, you just need to extend
org.eclipse.core.contenttype.contentTypes
If you are using the PDE, then you can just right click on the extension (once it is added in the extensions tab) and choose New... -> content-type
Here is the xml code for it,
<extension
id="com.newLanguage.XYZ.contentType"
point="org.eclipse.core.contenttype.contentTypes">
<content-type
file-extensions="xyz,xyzz"
id="com.newLanguage.XYZ.contenttypeMod"
name="XYZ File"
priority="normal">
</content-type>
</extension>
Here you can set the properties of this content-type by defining a unique id, a human-readable name and the extension. You can also give multiple extensions for this content type. For example, my XYZ language can have 2 types of extension '.xyz, and '.xyzz'.
The content describer comes in when I have one generic file-extension: '.xy' but the content or format of the file may differentiate and so I need a describer for the editor to be able to go through the content of the file and recognize the difference. This is handy for syntax highlighting where I need to know the differences.
Since I am not very good at explaining this, this link was extremely useful to me.
But all in all, this tutorial is what set me on my pace and has actually taken me far in understanding how to implement an IDE plug-in for Eclipse. I think it is a very ideal place to start, especially for someone new.
Another place that kept my work going is the Eclipse FAQs but I would specifically like to point out to section 3.5 Implementing Support for Your Own Language which has many tutorial links.
Note: this (new language support, custom syntax highlighting, ...) is the kind of feature provided with XText.
Xtext - Language Development Framework
With Xtext you can easily create your own programming languages and domain-specific languages (DSLs).
The framework supports the development of language infrastructures including compilers and interpreters as well as full blown Eclipse-based IDE integration.
Since the sources are available, you might have a lots of clues to illustrate the usage of the packages you are currently looking.

Using (Java) Eclipse abilities in other programming language

I use Eclipse mainly for LSL (linden Scripting language). The plug-in for this language does not provide things like templates or task-tag recognition. Is there any way that these kind of features in LSL-files (or any other generic file/code for that matter) can be used?
Take look at the XText project. If you can define the grammar of LSL there it will generate full Eclipse plugin for it, complete with syntax Highlighting, code Completion, validation and quick Fixes and more.
Another one to try (one i use myself) is LSL Editor
Full Syntax highlighting, code suggest, and even a off world run time environment. plus able to test multiple scripts by building test objects with prims.
Take a Look :)
LSLForge is being actively maintained, and has most of what you describe. If there's something missing, the developer is always looking for new challenges.

Is it possible in Eclipse to define syntax highlighting for a language without resorting to Java programming?

I am looking for a way to define some syntax coloring for a language in Eclipse. I only need to highlight certain sets of keywords, so the logic is trivial. So I would like to be able to define these in a plain definition file. Is there perhaps some Eclipse plugin which allows this, or is it possible out of the box?
XText is a more generic and complex solution, which will generate for you the code for a custom Editor able to offer the usual IDE features, that are derived from a grammar (your "plain definition file"), including.
syntax coloring, but also
model navigation (F3, etc.),
code completion,
outline view, and
code templates.
The EclipseColorer plugin may fit the bill!
It's a bit fiddly, but try http://gstaff.org/colorEditor/.
It uses the jEdit syntax highlighting files. So you need to create your highlighting file and add it to the jar in the plugin, as well as editing the catalog file in there to include it.
I used jEdit itself to test and debug my custom highlighting, rather than having to exit Eclipse, make the change and reload it each time.

Is there a VSCode equivalent to Notepad++'s user defined language configuration?

I really enjoyed defining syntax highlighting rules in Notepad++ for the various build logs and artifacts I've worked on in the past to make certain text markers pop out. I was wondering if VSCode has any capabilities to do likewise.
For reference to the unfamiliar here's the Notepad++ documentation and a live demonstration:
https://npp-user-manual.org/docs/user-defined-language-system/
How to Create Custom Language Definitions in Notepad++
Looks like there is support for something in this direction. The terminology is slightly different though and there may not be a GUI interface like Notedpad++
Declarative Language Feature
Syntax Highlight Guide: VS Code uses TextMate grammar for syntax highlighting. This guide will walk you through writing a simple TextMate grammar and converting it into a VS Code extension.
Create Custom Language in Visual Studio Code
https://code.visualstudio.com/api/language-extensions/overview#declarative-language-features
https://code.visualstudio.com/api/language-extensions/language-configuration-guide