Language Server and Client for XQuery/eXistdbA language server and Visual Studio Code extension for developing XQuery code targeted at eXistdb. The language server currently supports the following capabilities for XQuery:
The client extension additionally includes XQuery syntax highlighting based on https://github.com/DotJoshJohnson/vscode-xml. Workspace FoldersImportant: Most language server features require that the edited file is associated with a workspace folder, which will be used as the context to resolve XQuery import paths etc. (see configuration section below). In Visual Studio Code, use ConfigurationThe language server talks to an eXist instance in order to provide autocompletion, resolve document symbols, definitions etc. There are three places in which those settings can be provided. The language server will check them in this order:
The ~servers~ object maps one or more server ids to the corresponding settings. Right now, the language server supports only one server.
Syncing Directories to the ServerThe extension includes a task provider, which automatically registers a sync task for a workspace if the To prevent unintentional syncs, the task must be started manually. Start via status bar iconIf a workspace configuration was found, you should find two statusbar icons to the bottom right of the window: The first indicates if the database connection is active, the other shows the sync status. It should display 'off' as initial state. Click on the icon to activate sync. This will list all sync tasks available in the current workspace. Select one to start. Start via
|
Property | Description |
---|---|
server | the name of the server entry (in the 'servers' section to connect to |
ignore | an array of file path patterns which should not be synced |
Executing XQueries
An open XQuery file can be sent to the server for evaluation, using either
- the command
existdb.execute
from the command palette - pressing the keyboard shortcut
ctrl-alt-enter
(command-option-enter
on a Mac) - selecting Execute current XQuery on the server from the editor title toolbar
The result returned by eXist is displayed in a new column besides the currently open editor. If the XQuery defines serialization to HTML, the results will be shown in a web view. In all other cases, the source code of the result is displayed.
Configuration
The server side support package for the Atom editor - atom-editor
needs to be deployed on the server. The extension will try to detect if the package is already installed - if not it will ask if it should install it automatically.
The parameters required for the communication with the server can either be configured via the extension settings, or via a .existdb.json
file in the root directory of a workspace. The configuration syntax of this file is the same as for the Atom plugin.
Run
- clone the repository and open the directory in Visual Studio Code
- run
npm install
- switch to the debug panel in the sidebar and choose Launch Client from the run configurations
Packaging
Install vsce
once by running
npm install -g vsce
then package the extension into a .vsix
file with
vsce package