intellij-quarkus icon indicating copy to clipboard operation
intellij-quarkus copied to clipboard

Initial live template support

Open sdaschner opened this issue 5 years ago • 1 comments

Added live templates suggested in #11 and others.

Suggested:

  • qds: JDBC datasource in properties
  • ijt: Inject a CDI bean
  • conf: Inject a config property
  • pdm: Create a CDI producer method
  • asd: @ApplicationScoped
  • rsd: @RequestScoped
  • dep: @Dependent
  • pct: Create an initializer method
  • pds: Create an pre-destroy method
  • tn: @Transactional
  • ph: @Path
  • projson: @Produces(MediaType.APPLICATION_JSON)
  • conjson: @Consumes(MediaType.APPLICATION_JSON)
  • getm: @GET method

sdaschner avatar Apr 21 '20 13:04 sdaschner

Codecov Report

Merging #74 into master will decrease coverage by 0.17%. The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #74      +/-   ##
============================================
- Coverage     52.44%   52.27%   -0.18%     
  Complexity      389      389              
============================================
  Files            59       61       +2     
  Lines          1798     1804       +6     
  Branches        286      286              
============================================
  Hits            943      943              
- Misses          768      774       +6     
  Partials         87       87              
Impacted Files Coverage Δ Complexity Δ
...Templates/QuarkusApplicationPropertiesContext.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...eTemplates/QuarkusApplicationTemplateProvider.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update debccec...8ac8364. Read the comment docs.

codecov[bot] avatar Apr 21 '20 14:04 codecov[bot]

@sdaschner I close this PR for snippets support, the main idea is that it the language server which manages snippets (like MicroProfile LS / Qute LS, etc) and not the LSP client (Intellij in this case).

Managing snippet on language server side gives the capability:

  • to show snippet not anywhere (according the AST node manages on language server)
  • any LSP client can benefit about those snippets, in other words snippets are consistent.

The write of snippet are written in JSON by using the LSP snippet syntax. See for instance for Quarkus

  • snippets in java file https://github.com/redhat-developer/quarkus-ls/blob/master/quarkus.ls.ext/com.redhat.quarkus.ls/src/main/resources/com/redhat/quarkus/snippets/quarkus-java.json in Java file.
  • snippets in application.properties file https://github.com/redhat-developer/quarkus-ls/blob/master/quarkus.ls.ext/com.redhat.quarkus.ls/src/main/resources/com/redhat/quarkus/snippets/quarkus-properties.json

The only main problem with Intellij LSP client is that it doesn't support Templates variables which is very bad for snippets. I created the issue at https://github.com/redhat-developer/intellij-quarkus/issues/786

@sdaschner if you wish support your snippets, please contribute to Quarkus LS JSON snippets. Thanks.

I close this issue.

angelozerr avatar Apr 20 '23 07:04 angelozerr