Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 6.37 KB

Contributing.md

File metadata and controls

92 lines (70 loc) · 6.37 KB

First Time Setup in Eclipse Desktop

The Eclipse Desktop IDE provides a convenient development workflow for the Camel Language Server, but other IDEs may be used as well.

Project setup

  1. Fork and clone the repository

  2. Install latest Eclipse Java EE from Download Packages page that will have most needed already installed. Alternately, you can get the Eclipse IDE for Java developers and just install Eclipse PDE from marketplace.

  3. Once installed use File > Open Projects from File System... and point it camel-language-server and Eclipse should automatically detect the projects and import it properly.

  4. If you discover an error on pom.xml after import about Tycho, you can use Quick Fix (Ctrl+1) to install the Tycho Maven integration.

Local debug flow with an editor

Eclipse desktop allows to debug Language Server projects being written in the same workspace. To do that:

  • Create a Content type for the file type you want to test:
    • Windows -> Preferences -> General -> Content types
    • Select Text
    • Click Add child... and provide configuration. For instance:
      • name: Camel K
      • File association *.camelk.*
  • Associate the created Content type to the Camel Language Server Launch configuration
    • Windows -> Preferences -> Language Servers
    • At the bottom, click on Add...
    • Select the added Content type in the left column (Camel K if following example)
    • Select the launch configuration Camel Language Server in the right column under Java Application
    • Select the debug option in the drop down below the right column
    • Click Ok and then Apply and close
  • Open the file you want to test with the Generic Text Editor
    • To be sure that the file opens with the Generic Text Editor, you can right-click on it and then Open With -> Generic Text Editor

Building from command line

  1. Install Apache Maven

  2. This command will build the server:

    $ mvn clean verify

How to release

  • Ensure pom is using only non-snapshot dependencies
  • Modify pom version to use a non-snapshot version
  • Provide a PR
  • Wait that it is reviewed and merged
  • Create a tag
  • Push the tag to camel-tooling organization repository ** A build will start automatically on Circle CI ** Ensure build is OK
  • Modify pom version to use an incremented snapshot version to prepare next release iteration
  • Provide a PR

Technical Overview

Dependencies

As this is an implementation of Language Server Protocol for Apache Camel, it is recommended to start by reading:

  • information about the Language Server Protocol (LSP):
    • LSP overview (a must)
    • LSP specification (can be useful to search for specific parts when needed)
    • an important point is that all API is based on position (line, column) in a text file, so the LSP for Apache Camel implementation needs to be able to always provide and understand this information
  • information about LSP4J
    • LSP4J is a Java implementation of the LSP. This is library used for writing the LSP for Apache Camel
    • it is recommended to read at least the getting started
    • LSP4J is using Future, the goal is to provide an API which is completely asynchronous for a better User Experience, see Future javadoc and Vogella doc about CompletableFuture and there is also a lot of tutorial on the web
  • information about Camel

LSP for Apache Camel architecture explanations

CamelTextDocumentService is the main entry point currently as the current implementation is dealing with a single XML file. The various methods of the CamelTextDocumentService are called by the LSP clients. When clients are implemented correctly, they are called depending on the capabilities declared in CamelLanguageServer.createServerCapabilities().

The metamodel from the Camel Catalog describing the Camel components is represented by the java class ComponentModel. The model describing the Camel URI is in com.github.cameltooling.lsp.internal.instancemodel package. The top-level Camel element is CamelURIInstance. The model describing the Camel URI is storing the position of each sub-model elements (Camel component name, path parameter, Option parameter with its key and value). The naming tries to be as close as possible as the Apache Camel one. All Camel elements of the model are inheriting from CamelUriElementInstance.

For instance, with the Camel URI "timer:timerName?delay=10s":