Skip to content

Conversation

@PerMalmberg
Copy link
Contributor

Hi,

Here's a fix to automatically set the detached state for delve based on the OS. Gives a better first-time experience when delve doesn't crash :)

@PerMalmberg
Copy link
Contributor Author

Updated as requested, works on my machine :)

delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = not vim.fn.has 'win32',
Copy link
Contributor

@dam9000 dam9000 May 10, 2024

Choose a reason for hiding this comment

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

Hmm I think this will always be false
vim.fn.has will return 0 or 1, and in lua not 0 and not 1 will both be false
so I think this needs to be:

detached = vim.fn.has 'win32' == 0,

can you please test that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right, Lua does that funny thing with numbers and boolean ops. My bad, will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@dam9000 dam9000 left a comment

Choose a reason for hiding this comment

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

LGTM

@feoh feoh merged commit 5aeddfd into nvim-lua:master May 10, 2024
@PerMalmberg PerMalmberg deleted the fix-delve-for-windows branch May 10, 2024 18:04
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.

3 participants