In the Eclipse HTML editor, is there an easy way to have custom tags available in content assist (autocomplete)? - eclipse

I'm learning to use a new hosted e-commerce system at work which uses a proprietary markup/scripting language for its page templates. They are similar to JSP pages (although the server tags don't have a prefix, i.e. there is no "xsp:") and use ${expressions} similar to Expression Language. We are transitioning from a .Net system, so all of my fellow devs are very used to having thorough IntelliSense available in our editors.
So, my question is whether it is possible to make these custom tags available in content assist, and whether it is worth the hassle if there is any. (I'm aware the latter is subjective - I'm a reasonable guy and open to opinions.)
FYI, I'm more concerned with auto-completion of tags, but expressions would be great as well depending on how much work is involved. We are using eclipse for Java EE, Juno (core IDE v4.2.1) with WTP... Sorry I'm not really sure how or what to share as far as versions and components go! Let me know if any additional info would help.
Thanks in advance.

A decidedly non-hassle-free answer would be to create an Eclipse plug-in to support your proprietary template language. One place to start might be Veloeclipse, a HTML/XML/JSP/Velocity Editor for Eclipse, which claims to have the following features which you may find interesting:
Smart indentation of velocity directives (on pressing return or when using tabs)
Code folding
Code Formatting
Smart indentation of html tags (on pressing return or when using tabs)
Syntax highlighting for both html and velocity
Autocompletion and Content assist for tags, directives and references (Ctrl + space in html attribute values or when opening or closing tags)
Sources here: http://code.google.com/p/veloeclipse/source/checkout

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)

Creating JSPs with Eclipse

I'm trying to create several JSPs, and I was told that what most people do, is open notepad and hardcode the whole thing in. I come from the origins of C#, so that option is somewhat foreign to me :)
I did try to do several complex components by hand in Java. It took quite a bit of time (mostly with arrangements) but I was able to do it.
My question is, will I be able to create JSPs inside of Eclipse and will all the UI components that I will implement be there as I positioned them?
I'm asking because I found an Eclipse plugin (http://code.google.com/javadevtools/download-wbpro.html) that allows me to drag and drop components (C# style :D) and I needed to know if it is worth downloading, because if I still have to hardcode the JSP's UI in, the download time will be a waste (slow speed here).
Create a jsp page and right click on the editor and go to open with.
Select Web Page Editor and you will have the design view opened.
On the top right corner you will have an arrow. Click on the arrow and you will have elements to drag and drop on the editor.
I think almost nobody uses notepad to create JSP's. The editing is done in text mode in IDE's or comparable tools.
I agree with #BalusC, JSP's don't have good support for drag and drop development (like Visual Studio), although there tools like Dreamweaver which had some support to create the HTML structure in a WYSYWYG environment. I would not recommend these kind of tools for JSP but it's your choice.
The plugin you mention is not for JSP's and any of the alternatives it does support won't be quick to learn.
As #BalusCmentions, JSF's is an alternative for which there are some visual editors. You might want to look into that but you'd need to do some research as JSF is an standard and there are several implementations and related tools around. There are plugins for JSF support in Eclipse.
All in all I think you need to read further on Java web development and the alternatives that exist.

Is it feasible to extract the code assist/completion part from Eclipse and use it in an other editor?

I often hear how good the code completion, coding assist features of Eclipse are compared to other editors which raises the question if these parts could be separated from the Eclipse code base.
If this part is separated with an API through which it can be told things it needs to know (where are the files of the project, what are the include paths, etc.) then it can return the necessary information (help for a symbol at the cursor, possible completions, etc.) and any editor (emacs, vim, etc.) can use it.
Why is it not done already? Are these code assist parts tied too tightly to Eclipse internals and they can't be sepaarated easily? Could someone who knows about the internal workings of Eclipe shed some light on this?
Edit: Here's a working setup with SharpDevelop for C#, emacs is the UI and the info comes from the SharpDevelop module. See the screenshot on this page. Eclipse's completion support could support emacs and other editors similarly.
The eclim project tries to solve this problem by interfacing directly with eclipse. Thus at least an headless running eclipse is required. While eclim's focus is afaik the vim integration, there also exist plugins for other editors (emacs, textmate, etc). The communication between eclim and an editor happens through a server interface.
Maybe not exactly what you where looking after, but imho worth a look:
http://www.eclim.org/
The content assist uses an internal model of the Java projects - without this model the content assist cannot work (that effectively).
I am not sure, how tightly is integrated to Eclipse internals, but I do know that it uses the Eclipse Resources API (file system handling) and other features such as Eclipse extensions (new completion providers can be added without modifying the code).
Alltogether, I believe to port this completion engine to other editors the mentioned editors would lose their (in some case relative) simplicity to Eclipse, thus it might not provide the smaller footprint of the mentioned editors - so I don't think, it is feasible to provide such engines effectively for other editors.

Netbeans - How to extend HTML vocabulary

I've been using netbeans for a couple of years now, mainly on PHP / CakePHP projects.
Recently I've started using Coldfusion, which isn't directly supported. I've found, however, that if I use PHP as a project type, I can load the files and the HTML Renderer does an admirable job with the Coldfusion tags.
I want to make it better and help the renderer to understand some of the tags and, hopefully, thereby improve code indentation and syntax highlighting.
My question, then, is how can I access the HTML dictionary to extend the vocabulary?
NB: This isn't a 'which IDE' question so don't recommend them. I want to know if and how I can achieve this in NetBeans and only Netbeans.
Here are a few ideas. If you render it in HTML, you could probably add a custom name space to the HTML. If setup correctly it can help NetBeans realize that the tags are valid and shouldn't show as an error. It might not give you all the preview and WYSIWYG functionality, but it may be better than what you are getting now. I have only done this on other platforms, but I'm pretty sure NetBeans supports it.
Also I think that NetBeans will let you add CustomTags doing something like this:
http://wiki.netbeans.org/CustomTagActions
Just to note, in terms of ColdFusion the other alternatives are NotePad++ with the CF plugin and IntelliJ now supports CF.
I really like Eclipse - the number of plugins available (SVN, Javascript, CSS, CodCollab, Flashbuilder etc.) is what makes it indispensable IMHO.
I am, however, looking forward to the new version of CFBuilder.
This answer on the same/similar question suggests that there is nothing out there for ColdFusion on netbeans : NetBeans as an editor for ColdFusion scripts?
If you want to build your own ColdFusion plugin for netbeans you need to look at plugin development; http://platform.netbeans.org/tutorials/60/nbm-google.html You could use the Dictionary project from cfeclipse as a basis for your plugin. See this Google Group thread for a bit more information

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.