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

Add text selection support in code snippet #1222

Merged
merged 2 commits into from
Oct 22, 2019

Conversation

jdneo
Copy link
Contributor

@jdneo jdneo commented Oct 21, 2019

Mitigate #1220

In jdt.ui, for_array, while, do_while and if have the selection placeholder.

Besides these snippets, I also add the $TM_SELECTED_TEXT into ifnull and ifnotnull

Signed-off-by: Sheng Chen sheche@microsoft.com

Signed-off-by: Sheng Chen <sheche@microsoft.com>
@@ -69,13 +69,13 @@ public String getId() {
public static final String SYSERR_CONTENT = "System.err.println($${0});";
public static final String SYSTRACE_CONTENT = "System.out.println(\"${enclosing_type}.${enclosing_method}()\");";
public static final String FOREACH_CONTENT = "for ($${1:${iterable_type}} $${2:${iterable_element}} : $${3:${iterable}}) {\n" + "\t$${0}\n" + "}";
Copy link
Contributor

Choose a reason for hiding this comment

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

why not foreach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't add it because the template in jdt.ui do not have the selection: https://github.com/eclipse/eclipse.jdt.ui/blob/master/org.eclipse.jdt.ui/templates/default-templates.xml#L37-L39, though I don't know why either 🤔.

Do you need me to add foreach also?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please, so it's more consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Signed-off-by: Sheng Chen <sheche@microsoft.com>
@fbricon fbricon merged commit 660855a into eclipse-jdtls:master Oct 22, 2019
@fbricon
Copy link
Contributor

fbricon commented Oct 22, 2019

Thanks @jdneo!

@jdneo jdneo deleted the cs/selection-line branch October 22, 2019 13:54
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.

2 participants