Eclipse Code Templates with Cobol - eclipse

People,
My team is just beginning to learn how to use COBOL on Eclipse (as part of the Rational Developer for System Z package) and one of our most desired features are code templates or code snippets.
What we'd like to have is a code completion based on snippets just like we have on Java. For example, when I type try and hit ctrl-space Eclipse shows me a list of completion options, where one of those is create a try/catch block. Well, in COBOL one could leverage this when creating, for example, embedded SQL blocks, like
EXEC SQL
SELECT field, field, field,
FROM table
WHERE field = value,
field = value
END-EXEC.
However, for some reason, it seems that Eclipse treats COBOL a little differently (no wonder why) from other languages. As such, when looking for the code templates in the preferences menu for COBOL, its appearance is very different from the Java one.
The question is: how does one uses Eclipse's code templates with COBOL?

[Fair disclosure - I work for the vendor I mention below]
The answer probably depends on what COBOL & plug-in you're using. If you have the Micro Focus Eclipse product (either the one for Net Express or Server Express, or the Server Express Remote Development Option), the code snippets are supported. There's a number built in but you can also build your own.
You can get more details at http://www.microfocus.com/eclipse/
I'm afraid I don't know how/if other Eclipse plug-ins have similar capabilities.

Related

Intellisense for Python keywords in Robot Framework not working in VS Code

I did my best to overcome this problem but it was in vain. I am developing tests in Robot Framework (RF) in Visual Studio Code and I want it to either show "signatures" of keywords from standard libraries or to be able to go to their definitions. Go to definition and signature displaying when hovering with Ctrl key are behaving this way:
works for my keywords written in RF (hoorah!)
works for my keywords written in Python only if a keyword consists of one word (I think conversion between undescores and spaces is failing)
does not work for keywords from standard libraries even if the keyword is one-word (e.g. "Fail"), regardless whether the keyword comes from built-in libraries or other ones (e.g. SeleniumLibrary)
When failing, Robot Framework Intellisense Server gives me message "Keyword definition 'Blah Blah' not found from the workspace".
I am using plugins Robot Framework Intellisense FORK and/or Robot Framework Language Server. I tried to configure them carefully according their documentation (Details), but the best state I reached is described above.
Can you help me please? I do not need to use a specific plugin, I just need to have the signature or documentation (or implementation) of every keyword in my code to be one click far.
According to their documentation they support
Goto definition
For variables
For user keywords
I was able to partially solve this when I not only open the folder with source code, but create a workspace and add the folder containing standard libraries to it as well (Add Folder to Workspace). I do not know exactly which folder is the best to add, it seems ...\Python\Python37\Lib\site-packages\ to me.

Need brief understanding on how eclipse autocomplete works

Hi I am interested in understanding how eclipse autocomplete works. I want to understand how eclipse distinguishes between local and global variables in a piece of Java code. I would also like to understand how eclipse stores method signatures for an infinite number of classes and how it associates a method to a given class. And is it possible for one person to develop an autocomplete feature for a language like JavaScript.
There is already an AutoComplete feature for Javascript. You just need to let Eclipse install the appropriate extensions.
Eclipse maintains a model of your program, including the project and all the dependencies. It's big, but it's not infinite. When you hit the dot, it figures out based on the variable type what the target type can be, and then displays the relevant methods based on its internal model.
This is easy for Java because you can usually know the static type. Much harder in other languages.
The Eclipse plug-in developer's guide discusses how different things, including the internal model and auto completion works. There are extension points to implement yiur own.

New Editor in Eclipse: Xtext vs. Plugin Development

I am trying to create a new editor plugin for Eclipse that I can distribute to others to help edit input files for a scientific computing program.
Features I would like in the program include:
Syntax Highlighting
Error Parsing
Content Assist
In general these files contain a set of related objects of the format:
ObjectType,
Field 1, !- Comment describing Field 1
Field 2, !- Comment describing Field 2
...
Field N; !- Comment describing Field N
! more
! comments
Where fields can be strings, numeric values or references to other objects depending on the object type.
Error parsing would check to make sure that each field is of the correct type, that referenced objects exist, and that each object ends in a semi-colon, etc. Content assist would provide a list of valid references for a field, provide defaults where available, etc.
Background
So far I've done a little bit of exploring in Xtext, and it seems to be able to handle most of what I'd like to do and much more, but I'm wondering if the Xtext plugin for our input file syntax would be distributed and used by other users.
I am looking for something that will be easy for users to install and use who are not already familiar with Eclipse and/or programming. Maybe there is an even better solution than Eclipse, but I would like it to be cross-platform and free (in both senses).
Question 1:
Do plugins created with Xtext require Xtext to generate the language artifacts on every machine that wants to use my editor and its features?
Question 2:
If so, what alternatives are there to create an editor with these features?
Regarding Question 1:
Do plugins created with Xtext require Xtext to generate the language artifacts on every machine that wants to use my editor and its features?
Nooooo. Simply put: You as a "toolsmith" forge the tool "Eclipse Editor Plugin". You deliver your tool to the users of the tool. You do NOT deliver the steps to reproduce the tool to the users.
Back to technical terms: You write the grammar, generates the Xtext artefacts, flesh out a few hooks and then you export the UI project as an Eclipse Plugin and/or as a "deployable feature". This will generate a few files (<10) which other users can install using the standard SW installation procedures of Eclipse.
Regarding Question 2:
If so, what alternatives are there to create an editor with these features?
Obsolete.

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)

Does anyone know some cool PL/SQL plugin for IntelliJ Idea?

I've evaluated some plugins from official IntelliJ repository, but none of them seems to provide more then basic syntax highlighting. Even highlighting is limited. For example, Database Navigator doesn't highlight IF. It would be great to have proper highlighting. And if it would have auto-complete feature and provide file structure view I would be completely happy.
I use SQL Query Plugin when I need to post some little stuff to database or to query something from it. I use PL/SQL Developer when I need to make more complex things, or when I need to modify PL/SQL. But most of the time I need to navigate through mix of Java, JavaScript and PL/SQL code. Unfortunately, SQL Query Plugin doesn't help with that as well as PL/SQL Developer.
Have you tried SQL Query Plugin? It comes with a great host of features, including multiple query windows, direct editing of tables, and of course, proper highlighting for PL/SQL syntax and a browser of the internal database structure.
It also integrates well with the main editor: you can right-click on any selected Java string containing SQL and "Send to SQLPlugin" to strip out all of the quotes and non-SQL syntax.
I've started using the SQL Code Assistant plugin that instantly has recognised my PL/SQL packages and all these PL/SQL constructs (cursors etc) which the out-of-the-box IntelliJ functionality couldn't understand and was marking red. As of now it cannot only recognise dblinks but that's fair enough. Of course you'll have to associate *.sql file types with the plugin but it will intellij-ently inform you after you install/restart the IDE.