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

VsCode debug support #30

Open
wants to merge 17 commits into
base: NG_7.0
Choose a base branch
from
Open

VsCode debug support #30

wants to merge 17 commits into from

Conversation

Nightenom
Copy link
Contributor

@Nightenom Nightenom commented Nov 4, 2023

Adds .vscode/launch.json writer, rest of VSCode support is more or less same as Eclipse (hopefully)
Adds processResources Copy task for both VSCode and Eclipse

Things to solve before merging:

@Nightenom Nightenom marked this pull request as ready for review November 5, 2023 09:50
final RunImpl runImpl = (RunImpl) run;

// TODO: what is this and how to hook it in? tasks.json?
final TaskProvider<?> ideBeforeRunTask = createIdeBeforeRunTask(project, name, run, runImpl);
eclipse.autoBuildTasks(createIdeBeforeRunTask(project, name, run, runImpl));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not an autoBuildTask.

This is a task that needs to be ran before the actually run task. Please configure it as such.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, right now there is no way to run gradle tasks from IDE's gradle (see this issue) - the issue apparently isn't high priority nor there is any progress info in repos elsewhere (eclipse/redhat repos, etc)

I can easily run gradle task in command line via tasks.json though (which would require this tasks to have name - which should be doable? afaik the relevant ide code is also set up during invocation from command line).

I went with autoBuildTasks because it should provide logically same state (as long as the added task is called after the eclipse build task (which happens after any source file save-to-disc action)), but indeed doing so by calling the task much more times than required

Copy link

Choose a reason for hiding this comment

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

well, right now there is no way to run gradle tasks from IDE's gradle

Huh? Wasn't this exact issue solved in neo 1.20.1 using a prelaunchtask?

      "preLaunchTask": "gradle: copyVSCodeResources"

I have this as part of my runClient etc runs and it works perfectly fine, this has been required for me both in neo and fabric for recent versions.

(as a little edit, I have no issue debugging the runClient and runServer gradle tasks, which is nice as those haven't worked in the past haha)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this was possible in ng6, now there is a task that is created on demand and not available from CLI unless running gradlew runXYZ

Btw I assume your prelaunch task is cli gradle call to custom processResources made by you, if you're using microsoft gradle extension than I might add hook into it, but this extension is not part of the java pack and is not needed, ideally I would stick to having only redhat java and vscode-java-debug

I could potentially use attach debug on runXYZ if there won't be any other way, but I leave this as last option cuz it has much longer loading time, although calling the new task from cli (which is what I'm trying rn) may suffer from roughly same delay as attach to runXYZ

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this was possible in ng6, now there is a task that is created on demand and not available from CLI unless running gradlew runXYZ

Btw I assume your prelaunch task is cli gradle call to custom processResources made by you, if you're using microsoft gradle extension than I might add hook into it, but this extension is not part of the java pack and is not needed, ideally I would stick to having only redhat java and vscode-java-debug

I could potentially use attach debug on runXYZ if there won't be any other way, but I leave this as last option cuz it has much longer loading time, although calling the new task from cli (which is what I'm trying rn) may suffer from roughly same delay as attach to runXYZ

The runIdexxxx task is available to vscode.... Assuming it sets the right flags when it does the run. If it does not set the flag, then there is no way for us to support this ide properly within the specification of Gradle Toolkit, which we are bound to.

So please verify why you think the ide does not have the runIdeXxx task available.

Choose a reason for hiding this comment

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

Btw I assume your prelaunch task is cli gradle call to custom processResources made by you, if you're using microsoft gradle extension than I might add hook into it, but this extension is not part of the java pack and is not needed, ideally I would stick to having only redhat java and vscode-java-debug

Huh, yeah that's part of the microsoft gradle extension, I was always under the impression that it was part of the java pack but I guess not... and yeah the copyVSCodeResources task there is defined in my build.gradle but isn't really relevant here.

@Nightenom
Copy link
Contributor Author

Nightenom commented Nov 24, 2023

Okay, probably my last try on ideBeforeRunXYZ task (running out of ideas on what to do next...), also added Copy tasks for processResources for both Eclipse and VSCode

common/build.gradle Outdated Show resolved Hide resolved
@MommyHeather
Copy link

Is there any way I could use this at present? I'd love to be able to debug 1.20.4, which I can't currently do without IDEA (or manually crafting the runs I guess?)

@Matyrobbrt
Copy link
Member

There is PR publishing, but the author (@Nightenom) will have to merge latest to trigger it.

@Nightenom
Copy link
Contributor Author

It's stale on @marchermans 's side

@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

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

4 participants