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

The type declaration snippets should generate file headers. #2813

Merged

Conversation

rgrunber
Copy link
Contributor

@rgrunber rgrunber commented Aug 24, 2023

  • class/interface/record snippets should generate a file header if defined

Before this change, the class/interface/record snippets ignored java.templates.fileHeader. Now they should respect it as seen below. This worked correctly for the quick-fixes that generated a new type declaration in a new file (eg. "Create new class '...'" since that code is a bit different.

class-snippet-context

  • Add a simple testcase for this

@hopehadfield feel free to have a look since you've been looking into the snippets recently.

@rgrunber
Copy link
Contributor Author

@hopehadfield brought up that this makes the case of nested classes annoying. Maybe there's a way I can detect the context (are we already within a type declaration), in order to include/exclude the file header.

@rgrunber rgrunber self-assigned this Aug 25, 2023
@rgrunber rgrunber force-pushed the filecomment_typedecl_snippets branch from 5beae99 to b720935 Compare August 25, 2023 17:30
@rgrunber rgrunber added this to the End August 2023 milestone Aug 25, 2023
- class/interface/record snippets should generate a file header if
  defined
- Do not generate file header if compilation unit contains a type

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
@rgrunber rgrunber force-pushed the filecomment_typedecl_snippets branch from b720935 to be28d37 Compare August 25, 2023 21:43
@rgrunber rgrunber merged commit d8e5236 into eclipse-jdtls:master Aug 25, 2023
6 checks passed
@rgrunber rgrunber deleted the filecomment_typedecl_snippets branch August 25, 2023 23:13
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.

None yet

1 participant