-
Notifications
You must be signed in to change notification settings - Fork 7
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: automatic debugging support #2699
Conversation
3bae0bb
to
b02bb00
Compare
d34711f
to
1fdb3ea
Compare
1fdb3ea
to
a132e26
Compare
return "" | ||
} | ||
|
||
type DebugInfo struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to place types at the top of the file to make it easier to read down the file.
} | ||
|
||
// findIdeaFolder recurses up the directory tree to find a .idea folder. | ||
func findIdeaFolder(startPath string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code to that in the VSCode one, parameterise on the relative path you're looking for.
// findLaunchJSON recurses up the directory tree to find a .vscode folder | ||
// If it can't find one it creates one next to project.toml | ||
// It then returns the path to the launch.json file | ||
func findLaunchJSON(startPath string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to terminate at the project root rather than the root directory, so we don't randomly start writing into an unrelated VSCode directory. Same with the IDEA stuff.
continue | ||
} | ||
entry := map[string]interface{}{ | ||
"name": name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
configurations[pos].(map[string]interface{})["port"] = v.Port //nolint:forcetypeassert | ||
continue | ||
} | ||
entry := map[string]interface{}{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/interface{}/any/g
Nice! This is an awesome QoL change. |
a4a5f59
to
1337366
Compare
I have made a few changes:
|
1a57c23
to
a66b26c
Compare
This should be good to go now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I do find it not great that it always creates a .vscode
directory. I feel like it would be better to read either config. Also it seems possible these could get desynced anyway...eg. if you start ftl dev
, there's no IDEA config, it writes the ports for VSCode, then you start GoLand. At this point GoLand won't have the correct ports and they won't get updated?
I also think it would be a good idea to have this IDE-specific logic behind an interface of some sort, to make it simpler to add new ones.
eg.
type IDE interface {
// Used returns true if this IDE is in use in the project.
Used() bool
UpdatePorts(ports map[string]*DebugInfo) error
// ExistingPorts reads the existing ports mapped for this IDE.
ExistingPorts() (map[string]*DebugInfo, error)
}
return ret | ||
} | ||
|
||
func (r *IDEIntegration) IntoContext(ctx context.Context) context.Context { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pass this through the context? Usually that's only reserved for things that are used all over the place, like loggers.
a66b26c
to
903048d
Compare
It would get updated when the first runner starts. This would also only apply if it is the first time you opened the project with GoLand. In terms of always writing
I agree, but I think we should just get this in an test it out and then refine it from there. |
8e61508
to
ff43ab0
Compare
ff43ab0
to
a65c99a
Compare
a65c99a
to
0cb7728
Compare
Automatically start go/java processes with remote debugging enabled, and automatically create profiles for both Intellij and VSCode.