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

Surround with: trycatch only works with the selected word #3172

Closed
yuyully opened this issue Jun 29, 2023 · 2 comments
Closed

Surround with: trycatch only works with the selected word #3172

yuyully opened this issue Jun 29, 2023 · 2 comments

Comments

@yuyully
Copy link

yuyully commented Jun 29, 2023

Environment
  • Operating System: win10
  • JDK version: 17.0.3
  • Visual Studio Code version: 1.79.2
  • Java extension version: 1.20.0
Steps To Reproduce
  1. Open a java file > Paste File f = new File("demo.txt");
  2. Double click in the code to select one word > Select Surround with: trycatch in the action list
Current Result

Currently it only can detect the selected word to do the surround action.
image

Expected Result

Expect that it can automatically detect the whole line code to surround.
image

@rgrunber
Copy link
Member

I'm assuming you're using the recently contributed snippet for this. As a snippet it lacks the necessary smartness to expand its range to include other java elements. There's an existing PR, eclipse-jdtls/eclipse.jdt.ls#2727, in JDT-LS to provide a better "surround with try-catch" experience.

@rgrunber
Copy link
Member

surround-with-refactoring

Marking as closed.

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

No branches or pull requests

2 participants