How to add your own programming language to IDE? - ide

There is the simple interpretive programming language and, actually, console interpreter.exe.
Need to make colorizing of syntax, autocomplete and executing by press F5.
(if it is possible to make 'debug' - that will be awesome!)
I never did such things.
There are many IDE, which allow to add lang.: eclipse, NetBeans, emacs, ...
But I did not found complete instruction to add or they are ununderstandable.
What IDE is best to use? to add lang. as easy as possible?
(it will be cool, if IDE can work in Windows)
How to add my language there?
Please, if it is possible to give complete instruction.

Depending on how far you really want to go there are multiple options:
Dumb Autocompletion for text editors:
There are editors like scite aka Notepad++, that take a simple textfile with all the keywords to give you autocompletion, but they don't take into account the syntax nor the context. All they do is to highlight the words they know (e.g. you have given to them) and to autocomplete just these terms.
Smarter Syntax Highlighting:
This would require you to get used to the tools lex and yacc, if we are talking open source. I don't know which proprietary source tools are out there. If you want to get into that, there are several good pages on that topic, and this is one of them.
Compile it all the time:
A simple but effective method for small projects would be just to compile it once every few seconds, and interpret the output. This would be the messy version, but might be fun to look into.

The documentation for adding a new editor to Eclipse looks fairly straightforward:
http://wiki.eclipse.org/FAQ_How_do_I_write_an_editor_for_my_own_language%3F
This covers syntax color highlighting and autocomplete. I imagine you can also create a launch profile in the same plugin

Related

How are you supposed to use text editors without debugging tools?

The thing I haven't been able to understand is how I am supposed to use a plain ol' text editor like TextWrangler or Atom to code, as opposed to a full-blow IDE like Xcode or Visual Studio. There are no debugging tools, so you can't know if you made an error, and their isn't autocomplete (prebugging, heh heh) which makes it much easier to make mistakes. I feel like I am missing something; how do people debug with their text editor workflow?
Using a text editor without debug tools forces you to write beautiful code that works first time 100% of the time. Each line of code is carefully crafted and does exactly what you expect it to do.
I personally use VIM for all my programming, it takes a while to learn but it's definitely worth it.
You end up writing code which is easy to read, because you have to read and re-read you code before you run it.
Debugging is more than just pressing a button and someone else software tells you whats wrong with yours. It's about deeply understanding your code and exactly what it is doing. I'll admit that sometimes finding a missing comma can be a pain, but the tradeoff is definitely worth it.
At the end of the day it depends on whether you just want to turn out 800 line of code an hour, or if you want to build software which is robust and easily extendable by anybody.
Atom and almost all this ide VIM ...
their is a plugins https://atom.io/packages
You install what plugins that you want
I believe that this is the power of this editors. You decide what plugins you want.
For atom for example
linter https://atom.io/packages/linter is a tool for visualize errors.
autocomplete https://atom.io/packages/autocomplete is a tool for auto complete.
The only difference is you have to compile manually.
If the error happens at compile time, the compiler will tell you, otherwise you have to find & fix the error yourself.
For the auto-complete, it's still available in most text editors(Atom, notepad++ etc...), however it's not always as good as intellisense.

Can Intellij IDEA (14 Ultimate) generate regex based TODO-comments?

A few years back i worked in a company where i could press CTRL+T and a TODO-comment was generated - say my ID to be identified by other developers was xy45 then the generated comment was:
//TODO (xy45):
Is something available from within Intellij 14 Ultimate or did they write their own plugin for it?
What i tried: Webreserach, Jetbrais documentations - it looks like its not possible out of the box (i however ask before i write a plugin for it) or masked by the various search results regarding the TODO-view (due to bad research skills of mine).
There is no built-in feature in IntelliJ IDEA to generate such comments, so it looks like they did write their own plugin.
Found something that works quite similar but is not boundable to a shortcut:
File -> Settings -> Live Templates
I guess the picture says enoth to allow customization (consult the Jetbrains documentation for more possibilities). E.g. browse to the Live Template section within the settings, add a new Live Template (small green cross, upper right corner in the above picture) and set the context where this Live Template is applicable.
Note: Once you defined the Live Template to be applicable within Java (...Change in the above image where the red exclamation marks are shown) context you can just type "t", "todo" and hit CTRL+Space (or the shortcut you defined for code completion).
I suggest to reconsider using that practice at all. Generally you should not include redundant information which is easily and more reliably accessible through your Version Control System (easily available in Idea directly in editor using Annotate feature). It is similiar to not using javadoc tag #author as the information provided with it is often outdated inaccurate and redundant. Additionaly, I don´t think author of TODO is that much valuable information. Person who will solve the issue will often be completly different person and the TODO should be well documented and descriptive anyway. When you find your own old TODO, which is poorly documented, you often don't remember all the required information even if you were the author.
However, instead of adding author's name, a good practice is to create a task in you issue management system and add identifier of this task to the description of the todo. This way you have all your todos in evidence at one place, you can add additional information to the task, track progress, assign it etc. My experience is that if you don´t use this, todos tend to stay in the code forever and after some time no one remembers clearly the details of the problem. Additionaly, author mentioned in the todo is often already gone working for a different company.
Annotated TODO with issue ID

C++14 supporting editor/IDE

I'm looking for some powerful programming environment for C/C++. In fact the only think i need is powerful source navigating + creating tool. Doesn't matter if its free or commercial. I prefer some linux tool, but it doesn't have to be necessary linux app.
What i need is some kind of editor with following capabilities:
more open files + tabs/buffers switching
highlighting (+ bracket matching, folding, etc...)
save sessions
preview window(when the cursors stops on some symbol, i have also an preview window, that shows me the definition of that symbol)
searching for uses of the symbol through code
intelligent completion (must support c++ 14!)
What would be nice:
code beautifizier or something similar
utf-8 support
editor templates(for example automatic comment header for modules, functions...)
other editor scripting
a terminal/console accessible from program || compiling debugging capabilities(just for to be able to compile the whole project without switching extensively to command line)
program flow visualization
Please do anyone around the whole world knows anything, that knows all of that?
I've tried several editors/IDEs, but all of them misses something. I've decided to emphasise missing support for new c++14 - it's now probably the biggest problem:
VIM
Amazing scripting capabilities
4 and 6: i've tried to use vim+ctags+cscope and vim+gtags + omnicomplete. But its not that usable. This doesn't work properly. Vim doesn't know c++ and it does not know the symbol context. Though i've been able to achieve basically the desired behaviour after hours of learning vim scripting, i'm not able to use it in even a little more complicated manner.(Lets say i have global variable and local variable with same names and different types - vim ofc does not recognize if im seeing now global or local only variable. And i'm not even talking about namespaces, etc....). Actually VIM now support c++14 with the help of clang(libclang) and there is awesome plugin called YouCompleteMe, that can use libclang, and its auto-complete really workds with c++14 code! And it makes the vim the only editor supporting c++14.. This plugin is now more or less usable in more editors(vim, emacs, sublime). It adds autocomplete, jump to definition and error messages.
c++14 supported
Source Insight
Amazing highlighting capabilities(different font for highlighting is amazing(especially for function names in function defintion header for example), also there is possibility to assign keyboard shortcut to cancel font differences, and leave only color highlighting(when you are bothered with different code alignment(due to different fonts)
Problems with 1) (though a hacked library for this called TabsSiPlus exists)
no terminal/console
Software is not maintained anymore, its not open source(and even not free) :(((
c++14 support missing
SlickEdit
Amazing customizing possibilities, can emulate vim editing style(WOW!)
no terminal/console(actually there is one, but not that good, however it has builtin compiling capabilities
it has strange GUI - a lot of space is occupied by scrollbars, different window captions, etc..
its kinda expensive(comparing to others)
c++14 support missing
Kdevelop4
Very pleasant GUI, nice console, very fast, can emulate vi editing style(not too well though)
miss force rescan/retag project (sometimes there are wrong symbol references, especially in bigger projects - this bugs me a lot)
its preview window doesn't show definition, only reference to definition, the definition then is showed in main editing window.. - cannot see actual code and the symbol definition at once :((
c++14 support missing
Eclipse
nice environment with lots of functionality.
don't have ad4), however it has some sort of preview bubble. When you hover mouse cursor upon symbol, it will show a bubble with symbol definition. Its nice functionality, but unfortunately you need to use mouse, and its noway that user friendly as separate preview window.
also its a little slow, but i think its due to realtime syntax checking, and it probably will be disablable.
c++14 support missing
Emacs
Support c++14 by similar plugins as vim(YouCompleteMe)(see in Vim section).
Please can some proficient Emacs user fill in this section?
c++14 supported
Sublime Text 3
Not free
Support c++14 by similar plugins as vim(YouCompleteMe)(see in Vim section). Though i had some problems with it. Plugin was more unstable than in Vim for me.
Through different plugins it support more or less the same functionality(from user view) as vim.
c++14 supported
Do any of you use some different editor, that can do anything from the list above, or maybe some plugins/scripts that can achieve the demanded functionality?
Regarding VIm and your point 6, I have heard that clang_complete, which is leveraging clang from LLVM compiler was quite accurate but I have not yet tested myself.
Try Eclipse, can handle almost everything (from Java to C with GNU Tools)
Eclipse supports c++14, all you need to do is to add -std=c++1y in your prefrences->C/C++->Build->Settings->Discovery
for "CDT Cross GCC Built-in Compiler Setting" add "-std=c++1y" at the end of compiler specs.
You also set the dialects in your project setting to support c++14,
Go to your project setting->C/C++ Build->Settings->GCC C++ Compiler->Dialect and select -std=c++1y

How to encourage positive developer behavior with an IDE?

The goal of IDEs is increase productivity. They do a great job at that. Refactoring, navigation, inline documentation, auto completion help increase productivity immensely.
But: Every tool is a weapon. The very same IDE helps to produce chunk code. Some IDE features are an invitation to produce bad code: code generation, code formatting tools, refactoring tools.
IDE overuse tends to isolate developers from the necessary details. It is a good thing that you can start working but at some point in your career you have to be able to figure out how to start a process. You can ignore this detail for some time, in the end they are important to write a working product (vs. bolted together stuff that works 90% of the time).
How do you encourage positive behavior of other developers working with an IDE? This is a question as old as copy and paste.
To get the right impression: developers have to have the maximum freedom to mobilize their maximum creativity and motivation. They may use IDEs and all the related tools as they see fit. Nobody should impose draconian measures on them. I don't want to demotivate and force someone to do something. Good behavior has to be encouraged. It has to itch little a bit if you do the wrong thing. In the same line as the SO "accept rate" metric (and reputation). You can ignore it but life is better if you follow the rules.
(The solution should work in a given setting. You can ignore reviews, changing the staffing or more education as potential solutions.)
Train your IDE, instead of being trained by it.
Set up code formatting the way you (or your team) wants it. Heck, even disable it in cases where it makes sense. I've never seen an IDE align something like this with a sensible combination of tabs and spaces (where \t is obviously the tab character):
{
\tcout << "Hello "
\t << (some + long + expression +
\t to_produce_the_word(world))
\t << endl;
}
In languages like Java, you cannot avoid boilerplate. The best option you have is to check generated code, ensuring that it is the same as what you'd have written by hand. Modify it as necessary. Configure your IDE to generate the exact code that you need, if possible. Eclipse is pretty good at this.
Know what's going on under the hood.
Know that your IDE is actually invoking the compiler. Have some insight into the flags that it passes. Be able to invoke the compiler from the command line.
Know about the runtime system. Be aware of the flags that are used or needed to launch your program. Be able to launch the program from a command line.
I think before anyone uses a RAD tool of any type they should be able to write the application from scratch (scratch being wiring together the framework components) in notepad potentially on a computer that is 10 years older than current technology :P. Not knowing the ins and outs of a paradigm/framework leads to bad code from novice developers who only learn things at a mile high view of the platforms they develop for. Perhaps they should do this in a few technologies -- i.e., GTK programming is completely different to MVC which is then also different to SWING and .NET.
I think the end result should be a developer that thinks of the finer details of a problem before they jump to thinking of how they will write an interface to it in a specific RAD environment.
its an open ended question, but...
We have a Eclipse format file that everyone shares, so that we all format the code in the same manor. (Except the one lone InteliJ guy we have).
Everyone shares a dictionary file. It helps to remove all the red lines from the code. Making it look cleaner and more readable.
I run EMMA over the code to find out who isn't testing their code, and then moan at them.
The main problems we face is that most of the team don't know all the features/power of the IDE (eclipse). The didn't know about CTRL + O (twice), or auto code gen. All I can do as a 'hot key wizard' is keep sharing my knowledge with them to help them become more productive.
I look forward to the day when my problem is that they auto gen as much as possible.
Rather than me finding bugs where the wrong value is returned from a getter method due to a typo.
Attempt development (at least occasionally) using only a text editor and launching the compilation, testing, etc. from the command line.
Typing the commands will get tedious very quickly so create scripts or (even better) learn rake, ant, msbuild.
If the IDE does code generation for you and that code generation is really important (such as generating classes from xsd or proxy classes from wsdl), try to find out how to run the code generation from the command line - then hook the code generation into a build (so you'll never be tempted to edit the generated code).
The idea of autoformatting code is great but it usually just turns your code into a mess. If you have less code, minor formatting inconsistencies are just not a big deal.
Adding code quality tools into your build - style checks, class and method sizes, complexity, code duplication, test coverage, etc (complexian, simian, flog, flay, ndepend, ncover, etc.) will discourage IDE generated code.

Why use Intellij, or what to do during the evaluation

I downloaded IntelliJ IDEA and started with the 30 day evaluation.
Now I'm just wondering, why should I use IntelliJ for plain old java developement (so no Hibernate, JSP, etc)? It doesn't look that different from eclipse or NetBeans, so I hope some IntelliJ guru can give some examples of things IntelliJ can do to justify investing the money in it. I'm trying to use the evaluation to it's fullest and don't want to miss an important feature.
A list of things possible in IntelliJ but not in eclipse is already available, but I'm more interested in the daily workflow than some obscure features that will be used twice a month.
I've been using IntelliJ for about 5 years now (since version 4.5) and I also read through most of the Manning book "IntelliJ in Action" and I still wouldn't consider myself a guru on it. In fact, I also wanted to do "plain old Java development" with it, and honestly I have to say that it's quite good at that. Like the other answers, I can only say that there's a definite edge in it's helpfulness that really puts it over the top. We use Eclipse here at work also, and while I don't have as much experience, I can tell you that there are definitely a lot of basic things lacking in it. I put in some serious time and effort to learn Eclipse, looking up how to do the everyday sorts of things I take for granted in IntelliJ, and they're mostly not there or very poorly implemented. The refactoring stuff is definitely the thing that helps a lot.
Aside from the refactoring, I think there are just a ton of small touches that really make this helpful. I think an example might help clarify...
Try this:
Create a new, empty class. Move the cursor inside the braces and do psvm and hit Ctrl-J - this expands the "psvm" into "public static void main(String[] args)". There's a whole list of commonly-used idioms that this shortcut will handle (and it's configurable, too). Inside the main code block, enter this code:
public static void main(String[] args) {
int x = 1000;
sout
}
At the end of "sout", do Ctrl-J again - you'll see another popup that let's you choose from some different expansions, but in general this expands to "System.out.println("")" and helpfully puts the cursor between the double-quotes (it's small touches like this that really make it shine, I think. Compare with Visual Studio's "IntelliSense" - a total crock if you ask me).
Anyway, backspace over the first double-quote - notice it deletes the matching double-quote? It does the same thing with braces and brackets, too. I think there are a few corner cases where I prefer it doesn't do this, but the large majority of the time it helps a lot. Back to the code editing: just type x so the code now looks like this:
public static void main(String[] args) {
int x = 1000;
// add a few blank lines here too - the need for
// this will be obvious a little later
System.out.println(x);
}
Now, move the cursor over to the declaration of x, and do Shift-F6 - this is the refactoring in-place dialog (I dunno what to call it, so I just made that up). The name "x" gets a colored box around it, and you can start typing a new name for it - as you type, all uses of that name get dynamically updated too. Another neat touch I really like.
Try this: put a really long line comment somewhere, like so:
// this is a really long comment blah blah blah i love to hear myself talking hahaha
Now say you decide the comment is too long, so you move the cursor to the middle of it somewhere and hit Enter. IntelliJ will put the remaining portion of the comment with a "// " prepended - it "knows" this is a continuation of the previous comment, so it comments it for you. Another neat touch.
// this is a really long comment blah
// blah blah i love to hear myself talking hahaha
Another big bonus I like about IntelliJ compared to Eclipse is that it's much less intrusive - I really hated how Eclipse would manage to get popups on top of popups, and mouse focus would be somewhere but keyboard focus is stuck on something underneath, etc. I think it's possible to work in such a way that these sorts of things don't happen, but it annoyed me immensely in the first place. That reminds me, in IntelliJ if you move the mouse cursor over the package or file navigator in the left pane, that panel gets the mouse focus automatically, so I got accustomed to using the mouse wheel immediately to look around. In Eclipse? You mouse over, but focus stayed on the editing pane, so you have to CLICK with the mouse to transfer focus, and then be able to use the mouse wheel to look around. Like I said, it's a lot of small touches like that which help with productivity.
As you code around, pay attention to the left gutter bar for red "light bulb" type symbols on the current line - this is IntelliJ telling you there are possible things it can do. Use Alt-Enter to bring up a small in-place dialog box, and it will tell you what it can take care of automatically. Say you type in a method definition named "getFoo()" and there's no foo member - it will offer to create it for you. Or if you're using a class and call a non-existing method on it like getFoo() - it will offer to create a getter and a member, or a regular method. It's just plain helpful.
Overall, I'd say small touches are not what IntelliJ gurus will really want to talk about, but I really appreciate how these sorts of things are just "well done". They take care of small details so you don't have to spend so much mental runtime checking your own syntax. I think of it as a butler helping me out with my coding - it takes care of small chores for me so I don't have to. Batman has his Alfred, and I have my IntelliJ. All the settings are excruciatingly laid out for you to modify if you like, but it just seems like the defaults are all geared toward improving your productivity, instead of bothering you all the time with really mundane decisions (especially those which you would almost always make the same choice anyway).
There are some definite drawbacks to IntelliJ - the price is a bit high, and it's quite large that it can take a while to load up on a large project. I'm lucky in that my company pays for the license as well as a very nice workstation so it loads up reasonably quick, but your mileage will vary.
I have a day job where I use Eclipse (because that's all that is permitted). I also have my own company where I "moonlight" doing contract work and use IntelliJ.
I would say their feature sets are about the same. Pretty much the same refactorings, same code assists, same style of use, etc. Eclipse arguably has better plug-ins, and probably many more, than IntelliJ. IntelliJ just "knows" things right out of the box like Spring and Hibernate, and these things are better integrated than Eclipse plug-ins of similar functionality.
The reason I choose to use IntelliJ when allowed (personally purchased and upgraded several times) is that everything it does just feels cleaner. Its hard to put my finger on it, but the exact same functionality in IntelliJ feels more streamlined and easier to use than in Eclipse - enough that I would pay for it even though there is a full-featured free IDE available.
So, the activities you should do to decide are this: use IntelliJ everyday for all your development tasks for 30 days. Push through the curve of learning new shortcuts and ways of searching, refactoring, etc. and I suspect you will prefer it. If not, Eclipse is still there for you.
I've just moved back to Eclipse after 2 years with Intellij (due to a client's preferences).
I'm finding Eclipse to be less helpful. I know that's a nebulous term, but Intellij's feedback was clearer, the UI gave me better information on what was going on, the automatic building seemed more seamless. The project setup/configuration seems more intuitive.
This is perhaps subjective, but sometimes that's why you prefer one over the over. It just feels that little bit slicker, that little bit friendlier...
(I don't think the VIM plugin for Intellij is better, but that's another story!)
2weiji: use Tab instead of Ctrl+J :-) It's much handy :-))
sout then Tab
psvm then Tab
iter then Tab
etc... :o)
Why use IntelliJ? Because I find it more consistent in it's user interface and more polished. It allows you to keep your hands on the keyboard longer, rather than switching back and forth between keyboard and mouse. As other people have said, it's the little things that add up.
I found the user-intentions functionality a huge time-saver, and the way it reviews the code and suggests optimizations and corrects bad practices. That I can hit Alt-Enter in a lot of contexts and the IDE is able to figure out and insert what should be there. Pesky things like type declarations, optimizing an old-style for-loop to use the new JDK-5 type of loop, removing redundant value assignments or unused variables.
Being able to first type in the usage of a method that doesn't exist, and then hitting a key combination and having the IDE write out the bare structure of the method - huge timesaver. It makes for a better workflow for me, because it allows you to first think about how you'll be using a method, what it looks like when you read it in context.
Refactoring support - this was the big selling point when I first started using it in 2003, and I think it still leads the way (but I hear Netbeans is also pretty good now)
Highly recommend that you have a look at the IntelliJ KeyMap Reference.
Have a look at this discussion for often-used shortcuts: What are the most useful Intellij IDEA keyboard shortcuts?
I'm not an IntelliJ IDEA guru but what the fanboys usually like about IntelliJ are the great refactoring and code assist features. They often claim this product is far superior to its competitor from this point of view.
Personally, I'm a partisan of the following principle: use the IDE with which you feel the most productive, not the one somebody else prefer.