KaotoIO / kaoto-ui

Frontend for the Kaoto project to provide an easy-to-use integration framework based on Apache Camel.
https://www.kaoto.io
Apache License 2.0
88 stars 44 forks source link

Code Editor AutoCompletion #251

Closed kahboom closed 1 year ago

kahboom commented 2 years ago

Because we want Kaoto to be a good way for users to learn how to use Camel, it would be very convenient to have autocompletion in the code editor.

Related:

apupier commented 2 years ago

Completion (and all editing capacities) in the Code Editor can be improved by Camel Language Server a bit but mostly by the Yaml Language Server given that Yaml DSL is used and the uri tag is not used (if I'm not mistaken). A good thing would be to associate the yaml schema programmatically but as a first step it can be provided with the # yaml-language-server: $schema=<urlToTheSchema> modeline. This case works well for pure Yaml routes. When it is a Camel CRDs, I think some extra configuration is needed on the client side to either connect to a Kubernetes instance with Camel K CRDs deployed or provide them programmatically.

The yaml language server is written in TypeScript so should be an easy integration. The Camel Language Server is runnign in java, so will need to launch it somewhere and connect it via websocket connection.

If I understand well, the Kaoto Code Editor is based on Monaco and it is written in React.

The Monaco client implementation for the language server support is https://github.com/TypeFox/monaco-languageclient I do not know if it integrates well with React. EDIT: I remember there was an attempt to do it in Syndesis fro another language server which was connected via websocket, so woudl be closer to the usecase of Camel LS integration, see https://github.com/blafond/syndesis/commit/3847530b3cc041a4c1af8fdabda7a28ac110b94d

Delawen commented 2 years ago

Can we have both at the same time if we add the uri tag?

We can deploy the Camel LS with the backend and the YAML LS with the frontend.

apupier commented 2 years ago

Can we have both at the same time if we add the uri tag?

In theory yes, but never tried. It is working in VS code and Eclipse Desktop. It depends on the client support, so on the Monaco Editor client implementation for the Language Server Protocol. (but I do not know this client well)

Delawen commented 1 year ago

This was already implemented, why is it still open?