Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve completion with snippet support (#786) #1006

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

angelozerr
Copy link
Contributor

@angelozerr angelozerr commented Jul 12, 2023

feat: Improve completion with snippet support (#786)

Fixes #786
Fixes #975

@angelozerr
Copy link
Contributor Author

Snippet completion starts working:

  • here a demo with Qute template

SnippetCompletionWithQute

//cc @ia3andy

  • here a demo with properties in application.properties:

SnippetCompletionWithAppProp

//cc @gastaldi

  • here a demo in Java file:

SnippetCompletioInJava

I need to clean my code

@angelozerr angelozerr force-pushed the completion-snippet branch 2 times, most recently from fe87ae7 to 14f63ed Compare July 12, 2023 12:30

private final List<String> existingVariables;

public SnippetTemplateLoader(Template template, Function<String, String> variableResolvers) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variableResolver

@angelozerr angelozerr force-pushed the completion-snippet branch 3 times, most recently from aff975d to d1ac9fb Compare July 12, 2023 15:28
* @param variableResolvers the LSP variable resolvers (ex to resolve ${TM_SELECTED_TEXT}).
* @return an Intellij Template instanced loaded from the given LSP snippet content.
*/
public static @NotNull Template createTemplate(@NotNull String snippetContent, @NotNull Project project, @NotNull Function<String, String> variableResolvers) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variableResolver

*
* @param snippetContent the LSP snippet content
* @param project the project.
* @param variableResolvers the LSP variable resolvers (ex to resolve ${TM_SELECTED_TEXT}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variableResolver

*/
public SnippetTemplateLoader(Template template, Function<String, String> variableResolver) {
this.template = template;
this.variableResolvers = variableResolver;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variableResolver

@angelozerr angelozerr marked this pull request as ready for review July 12, 2023 15:39
@fbricon fbricon merged commit cf6bbf7 into redhat-developer:main Jul 12, 2023
9 of 10 checks passed
@fbricon
Copy link
Contributor

fbricon commented Jul 12, 2023

Thanks @angelozerr!

@sonarcloud
Copy link

sonarcloud bot commented Jul 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-completion of Qute tags Improve completion with snippet support
2 participants