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

Document how to debug lazygit #1697

Closed
birgersp opened this issue Jan 19, 2022 · 5 comments
Closed

Document how to debug lazygit #1697

birgersp opened this issue Jan 19, 2022 · 5 comments

Comments

@birgersp
Copy link
Contributor

birgersp commented Jan 19, 2022

Topic
(Title)

Your thoughts
Sorry if this is really obvious and/or well documented. But how to debug this project while actually seeing the UI is totally lost on me. I am using VSCode with the Go extension. I can run a debug session and any output (with fmt.Println) is written to the "debug console". But I am not seeing the lazygit UI anywhere. But if I run go run main.go in the terminal (either VSCode's internal or in different terminal) then I can see the UI but there is no debugging available.

How do you guys debug this project while running its UI?

@birgersp birgersp changed the title How do you run and debug this application from the source code? How do you run and debug this project? Jan 19, 2022
@birgersp
Copy link
Contributor Author

This helped: golang/vscode-go#124 (comment)

@birgersp birgersp changed the title How do you run and debug this project? How do you run and debug this project in VSCode? Jan 19, 2022
@jesseduffield
Copy link
Owner

You can also pass a -debug flag to lazygit and then in another terminal window run lazygit --logs to see a stream of logs. Most parts of the codebase have access to a log field e.g. gui.log.Warn("blah").

@jesseduffield jesseduffield reopened this Jan 19, 2022
@jesseduffield jesseduffield changed the title How do you run and debug this project in VSCode? Document how to debug lazygit Jan 19, 2022
@jesseduffield
Copy link
Owner

I've reopened and changed the title to be about documenting this process

@birgersp
Copy link
Contributor Author

birgersp commented Jan 19, 2022

Okay. For future readers who prefers VSCode I might add that this is the launch configuration that made me able to debug lazygit while viewing the UI in VSCode.

// .vscode/launch.json
{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "debug lazygit",
			"type": "go",
			"request": "launch",
			"mode": "auto",
			"program": "main.go",
			"console": "externalTerminal" // <-- you need this to actually see the lazygit UI in a window while debugging
		}
	]
}

(Note that as I am writing this, console is not yet added to the stable version of the VSCode Go extension. Look here. It will probably be added to stable version soon, though)

@jesseduffield
Copy link
Owner

Updated the documentation in https://github.com/jesseduffield/lazygit/tree-save/master/CONTRIBUTING.md. I'll close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants