galaxyproject / galaxy-language-server

Galaxy Language Server to help in Galaxy (https://galaxyproject.org/) tool wrappers development.
Apache License 2.0
23 stars 15 forks source link
galaxy-project language-server vscode-extension

Galaxy Tools Extension and Galaxy Language Server

Actions Status License PyPI - Python Version PyPI GitHub release (latest SemVer) Open in Visual Studio Code

This repository contains two projects:

This project has the following main goals:

Please note this is still a work in progress so bugs and issues are expected. If you find any, you are welcome to open a new issue.

Table of Contents

Getting Started

Using the project

If you just want to use the features provided by the Galaxy Language Server, the easiest and recommended option is to install the VSCode extension from the Market or, if you prefer, you can use VSCodium and the Open VSX registry. Additionally, you can download the VSIX package from the releases page and install it manually.

Contributing

If you are considering contributing, please read the contribution guide.

To setup your development environment, please check this guide.

Features

You can watch a (somewhat old) short video with a tour of some of the features of the Galaxy Tools extension here:

Galaxy Tools features video

Tag and attribute auto-completion

Demo feature auto-completion

The tags and attributes are suggested based on the Galaxy.xsd schema. They will appear in the same order that they are declared in the schema, so they can comply with the best practices recommendations defined in the Galaxy IUC Standards Style Guide.

Documentation on Hover

Demo feature hover documentation

The documentation of tags and attributes is retrieved from the Galaxy.xsd schema.

Please note that some elements in the schema are still missing documentation. This will probably be improved over time.

Document validation

Demo feature validation

In addition to basic XML syntax validation, the tools are validated against the Galaxy.xsd schema.

Since version 0.8.0 the full Galaxy linting is directly reported on the document diagnostics.

Document auto-formatting

Demo feature auto-formatting

When the tool file is saved it gets auto-formatted to comply with the Galaxy IUC Standards Style Guide.

Tag auto-closing

Demo feature auto-close tags

Whenever you write a closing (>), the corresponding closing tag will be inserted. You can also type / in an open tag to close it.

Snippets

Demo snippets

Snippets can be really helpful to speed up your tool wrapper development. They allow you to quickly create common blocks and let you enter just the important information by pressing tab and navigating to the next available value.

If you want to add more snippets check the guide in the contribution guidelines.

Embedded syntax highlighting

Demo feature embedded syntax highlighting

Basic support for Cheetah and reStructuredText syntax highlighting inside the <command>, <configfile> and <help> tags. The embedded code should be inside a CDATA block.

Auto-generate tests

Demo feature auto-generate tests

After you define the <inputs> and <outputs> of the tool, you can press Ctrl+Alt+t (or Cmd+Alt+t in Mac) to create a <tests> section with a basic structure and some test cases. This is especially useful when using conditionals and other nested parameters since you can get right away most of the boilerplate XML. You can always change the key bindings to your personal preference, see the documentation.

Auto-generate command section

Demo feature auto-generate command section

Similar to the auto-generate tests command, but this time it will generate boilerplate Cheetah code for the <command> section.

Auto-sort param attributes

Demo feature auto-sort param attributes

Now you can automatically sort the attributes of param elements according to the IUC Coding Style guidelines using a key-shortcut or the command palette. This can be done for each <param> element individually or for the full document.

Run planemo tests in the Test Explorer

Demo feature planemo tests explorer

You can now run planemo test for the currently opened tool directly from the Test Explorer.

The failing tests will be marked in red and the reason for failure can be seen directly beside the test definition (or you can right click the icon next to your test definition and choose Peek Error). You can also directly navigate to each of the tests XML source from the Test Explorer. This can be very convenient especially when having a large number of tests in your tool.

Improved macros support

Since version 0.5.0 we added some interesting features around the use of macros. For example, you can now better troubleshoot validation errors caused by some included macro. The error messages will be more detailed and you can even navigate to a expanded version of the tool to see what the real tool document look like and what was causing the error.

Demo feature expanded macros

There are also a lot of features around macros auto-completion. You can now navigate to macro and token definitions with F12 or get dynamic attribute auto-completion with parametrized macros and more.

Demo feature macros support

Extract macro

You can select (a complete) XML element and then extract it to a local macro (directly in the tool wrapper) or into an external macro file. If there are several imported macro files, you can choose where to put them or if there is no imported file it will be created and imported directly.

Demo feature expanded macros

Document Outline

You can now see a document outline of the currently opened tool document. This is especially useful when working with large tool documents. You can navigate to the different sections of the document in a quick and convenient way.

Demo feature document outline

Insert Param Reference

Now you can use new commands to insert input parameter references into your wrapper. To insert a parameter reference in the command section, place your cursor in the desired position and then invoke the Insert a reference to a param element. command from the command palette (ctrl+shift+p) or directly use the default key binding for that command ctrl+alt+i ctrl+alt+p.

Demo feature insert param reference

In a similar way, you can also invoke a command but for inserting a param reference that can be used inside an output filter. The default key binding for that is ctrl+alt+i ctrl+alt+f.

Demo feature insert param filter