camel-tooling / camel-idea-plugin Goto Github PK
View Code? Open in Web Editor NEWApache Camel Intellij IDEA plugin
License: Apache License 2.0
Apache Camel Intellij IDEA plugin
License: Apache License 2.0
and then refer to the general documentation with some kind of link.
eg so when users press F1 they see the docs about what their current endpoint is configured as. Its like the cmd hover thing we have today.
Its like this screenshot
https://github.com/davsclaus/camel-idea-plugin/blob/master/img/early6.png
And then if we have some kind of link in top so the user can see the general component docs.
As the cmd however thingy is obscure and not many people know it exists.
I wonder if these should be sorted A..Z so the options with similar key name grouped together.
Otherwise the list will jump around and its harder to quick jump down to keys starting with m etc. when the user type m.
Currently we are limited to Camel annotations such as @Produce
We should allow to edit Camel endpoints in any string, as you can use this in
So there should maybe be some quick way to determine if its a Camel endpoint or not. Which we can use the catalog to match any known component name.
Its not needed anymore
An intention or hint or something which allows you when the cursor is positioned on a Camel endpoint, to open the component documentation from the Camel website.
Look at the CamelDocumentationProvider for help
So even if you have a option that is long type, then the user should enter any long value. But we can with the ctrl + space list show a suggestion with the default value, which makes it easier to spot what the default value is.
If you are inside a route and need the from/to Usages. Same functionality you can do with Java
for example if you find usages from "timer:trigger" it should list the "timer:status"
from("timer:trigger")
.transform().simple("ref:myBean")
.to("log:out");
from("timer:status")
.bean(health, "invoke")
.log("Health is ${body}");
So you can add a new Camel component to your project classpath and have it added to your pom.xml or gradle build file as dependency.
The catalog can then show a list of all components, we may want to show by group so the list is not a big 200 lines, or have a table/spreadsheet like dialog where you can easily navigate in all four directions to find the component of choice.
Wonder if we can hook into spring / cdi / etc and get a list of beans, which the endpoints options that refer to beans, can use in the smart completion list.
eg if you have or spring boot beans or cdi beans or whatever.
So if you edit a camel endpoint such as
jms:foo?concurrentConsumers={{ CURSOR HERE
And then can press ctrl + space then we should try to find any keys from .properties files and show in the list.
Setup Travis-ci to automatic build when commits is pushed.
We could add a code inspection that discovers all your Camel endpoints and then uses the validate API from CamelCatalog to validate if they are okay or not, and then report issues.
There is more work to improve the logic to detect if we edit a option value vs add new option
Currently we only support URI parameters, eg (foo=bar&me=you).
However the Camel endpoints have the context-path part which we can have smart completion / code assistance for. This is a bit more tricky because each component can have a bit different syntax of the context-path (some uses / others : etc to separate multi values). So we need to parse the syntax and understand which value your are editing and provide the right suggestion.
When the plugin is ready we should donate the source code to Apache Camel so it comes OOTB with Apache Camel.
The ".idea" directory is add to git by mistake.
We would need the grammar from the catalog
https://issues.apache.org/jira/browse/CAMEL-10654
But until then we could hardcode the grammar in the IDEA plugin and then we could offer smart completion for simple language as well. This would be supported in the DSL where you use <simple>
or simple("...")
etc.
It should break down the uri into a table and explain each option and what it means. eg like explain endpoint can do in JMX / karaf commands in camel today.
If the user has their own camel components which has camel metadata, then we should allow to use them as well.
This requires detecting them from the project / classpath / maven pom etc. And then discover if there is Camel components and add them to the CamelCatalog, which has APIs for adding custom components.
We have some code in fabric8-forge that discovers this
https://github.com/fabric8io/fabric8-forge/blob/master/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/AbstractCamelProjectCommand.java#L541
We should add some logic in project open / close etc to detect if its a Camel project (eg has camel-core on dependency classpath) and if so only active the Camel smart completions if so.
It would be nice if there was a way to show some documentation for the option so the user can better know what it does.
We should also do smart completions for XML files so you can edit Camel endpoints there as well.
This requires an XML reference
https://github.com/davsclaus/camel-idea-plugin/blob/master/resources/META-INF/plugin.xml#L26
And find out how to do that.
There is some IDEA plugins that can do this.
https://github.com/JetBrains/intellij-community/tree/master/plugins
An intention or hint or something which allows you when the cursor is positioned on a Camel endpoint, to open the component documentation from the Camel website.
Or we can load the .adoc file from the camel-catalog, and show in some page inside IDEA itself or something.
Maybe a bean or spring bean like icon to make it stand out that its a reference to a bean of some sorts from the registry.
eg if its not
So we can have releases of the plugin out in the community for people to try. Which they can easily install from IDEA plugin manager.
The project should build using Apache Maven.
The JBoss Forge project does this for their IDEA plugin which we should do something similar as
https://github.com/forge/intellij-idea-plugin
We need to use one instance of CamelCatalog so we use the same.
Also later when we add support for adding custom Camel components, switching to version of Camel catalog based on what Camel version the user has in his/her project, we need these changes on the same instance for the entire plugin code.
We can likely use a static instance as there is one plugin only.
Maybe have a CamelCatalogService where we have this static which we then use to get hold of.
If you are editing Camel endpoints in properties file, when you are using property placeholders.
So its not only Java but also .properties files as well (text files).
Maybe using github pages to have a little website for the plugin?
We could try to build a site using adoc files which is something we are starting to use at Apache Camel and other projects. Then it can build a html site or I think github can show adoc files as well (not as sure for github pages).
We need to figure out how we can test the smart completion, documentation etc.
See here for help Plugin Testing
I wonder if there is a way to make maven build and upload the .zip file to jetbrains repository automatic.
Then we could have some release profile - goal etc and then travis CI could do it for us.
Currently we manually upload the .zip file at
https://plugins.jetbrains.com/idea/plugin/9371-apache-camel-idea-plugin?
Wonder if IDEA supports LSP or we can have some reuse of the plugin so parts of it can be used in Eclipse / Eclipse Che or other editors which can support LSP as well.
There are surely parts of this plugin that touches the camel catalog and checks the endpoint uri etc, that can be made reusable without relying on IDEA APIs.
In the img directory would be good to show this feature also
We could have an intention (alt + enter) if you position the cursor on an empty string.
Then the intention could have a dialog where you can select among the known Camel components from the project (eg on the classpath). And then the smart completion can take over to assist fill in the rest of the details of the uri.
If we use this kind of annotation its a consumer only kind.
We should filter the list of components accordingly.
In the smart completion dialog we should indicate if an option is required. Maybe with an icon in the gutter, or have a * or something
Please... I code in Scala using Camel API.
If you position the cursor on a Camel route that uses data formats or languages, we should detect from the AST what is what and try to resolve which data format or language, eg jackson-json or simple language etc, and then load and show the documentation accordingly.
We can use the camel catalog to validate the simple syntax like the maven plugin can do.
So we can have the code style using the same style as Apache Camel
IDEA has a stratch pad where you can chose a language, such as java, groovy, xpath, xml, json etc and then write some scratch code which you can run, debug etc.
Wonder if there is something we can do for Camel. Such as setting up a Camel endpoint and consume or produce a message to it easily?
Or try the simple expression language on a dummy exchange etc
The action is: new scratch file
Currently we use the 2.19-SNAPSHOT camel catalog which is embedded in the plugin.
We should find a way to detect what version the user is using, eg 2.18.1 etc in a maven project / dependency list. And find that version, and configure the camel-catalog to use that version. There is API on CamelCatalog to switch version.
Wonder if we should add a Camel icon on the lines which has detected a Camel endpoint?
For spring beans you also have an icon in the gutter when its a Spring Bean / @bean or something.
For example spring boot users may use application.yml / application.yaml file.
To parse a yaml file is a bit more trickier so we may need to use a yaml parser like snakeyaml
https://github.com/apache/camel/blob/master/components/camel-snakeyaml/pom.xml#L44
We should try to detect if its in a route with a
from/fromF = consumer
pollEnrich = consumer
Which should filter to only show endpoints capable of consuming. Otherwise they should be capable of producing.
after the latest refactor. Not sure why as the documentation provider class is unchanged.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.