Is there any Eclipse plugin for writing features for cucumber with autocomplete functionality?
I guess that would be good to find and reuse steps from other features. Any ideas?
The cucumber-eclipse plugin illustrates one possible approach.
As Xtext seems not to be the perfect solution for this special case, it is more like a case study then a working plugin.
Based on XText, it uses the cucumber grammar (as in Gherkin), it uses XText features to produce a full-fledge editor.
Related
I'm working on a tool that is able to autocomplete the necessary literals defined in a grammar. For example: in C# if a programmer enters: for with a space after it, then it's entirely possible to parse the code, determine that the programmer has started a for statement and autocomplete the necessary punctuation: ( ; ; ).
The more I think about the problem, the more I think there must already be a solution for it, because it's such a common use case, but I can't find anything.
Is there a tool that can do this using a given grammar?
If you don't mind using ANTLR v3 instead of v4 you can use Xtext in order to generate an editor that features auto-complete and error-highlighting. This will happen in form of a plugin for eclipse and apparently also for IntelliJ IDEA.
If you want to use a different IDE or simply want to make use of ANTLR v4's powerfull features you could still have a look at the Xtext Sources as they have to do what you are searching for in order to provide the above mentioned features properly...
This package looks very promising at first glance... You might find the respective code in there.
Be aware though that Xtext is mainly written with Xtend so you either have to do so as well or you have to rewrite it a bit
In Java projects I use UCD for cleaning dead/unnecessary code, and I love it.
Is there an equivalent in Groovy/Grails land?
Given the highly dynamic nature of Groovy it would be very difficult (if at all possible) to do something similar to this.
I haven't seen any tools that are capable of what you are looking for and I doubt any exist for the reasons above.
The codenarc project (Static Analysis for Groovy) has some rules to detect unused and unnecessary code.
I'm thinking it might be easiest if I modify the Java syntax used in Rascal to better fit our Java-like language.
Is there a way I can build Rascal from the source? I've cloned the repo from Github and imported it as a project into Eclipse but there are some compilation errors regarding org.eclipse.imp. Before I head down the rabbit-hole of trying to get this all to work in Eclipse I thought I would post here to see if there is an easy way to handle this.
Thanks!
Sure you could build Rascal from scratch; following the developer instructions at https://github.com/cwi-swat/rascal/wiki/Rascal-Developers-Setup---Step-by-Step
On the other hand, if you wish to simply adapt the Java syntax definition it would be better to clone it into your own files. Grammars may look modular, but in reality there are complex interactions between different parts of the grammar. Better to clone and manage the whole thing as your own than depend on two co-evolving definitions.
If you clone the Java grammar Rascal will generate new parsers for you on-the-fly. If this generation becomes cumbersome, a "cached parser" can help you to optimize the deployment of your tools. Please contact us if you need help with that.
I have a genric BNF grammar and I would like to implement an editor, starting from that grammar and through an automatic completion feature, that can suggest phrases and signle strings belonging to a language derived from that grammar.
What can be the best approach to implement this editor?
Thank you for your attention.
I suggest KDE's "kate" editor:
mature and flexible editor
Qt based, so cross platform
excellent highlighting engine
working autocompletion engine
usable standalone or embedded
Using such an existing editor just leaves the task to implement a syntax description and load it into the editor. This approach is much less error prone as starting from scratch trying to implement editor number 29583659.
I am using Grails 2.0.3 as platform and Netbeans 7.1 as an IDE. Which of the available plugins for code analysis in groovy works best? Codenarc and GMetrics are on my list.
Anyone who have tried these? Which one is better?
CodeNarc and GMetrics both analyze different things. CodeNarc checks code for style, best practices and other inconsistencies. GMetrics analyzes the complexity of your code and will tell you the cyclomatic complexity and line counts and whatnot.
If I was only going to use one of these plugins, I would use CodeNarc because it helps train you to follow best practices in your code and will improve your code quality. However, there is no reason why you shouldn't or can't use both.