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

feat(api) Allow adding expresion to watch #160

Closed
przepompownia opened this issue Oct 29, 2022 · 4 comments
Closed

feat(api) Allow adding expresion to watch #160

przepompownia opened this issue Oct 29, 2022 · 4 comments

Comments

@przepompownia
Copy link
Contributor

Similarly to dapui.eval it'd be good to can add (especially from visual selection) expression to watches. It seems that currently Watches:add_watch is called only for manually typed expressions.

@przepompownia
Copy link
Contributor Author

przepompownia commented Jan 26, 2023

I did not found the solution in the previous API but in the new API the example

local function watchExpression(expression)
  dapui.elements.watches.add(expression)
end

vim.api.nvim_create_user_command('DapiUIAddToWatch', function (opts)
  watchExpression(opts.args)
end , {nargs = 1})

shows that it's possible 🎉

@przepompownia
Copy link
Contributor Author

In my local env have added both cmd and visualmode:
https://github.com/przepompownia/nvim-arctgx/blob/f2350ce06ccd9fbaf6d5b0891429d9c63be308e5/bundleConfig/nvim-dap-ui.lua#L40-L51

I suspect that exposing such feature in the way similar to dapui.eval would make many users happy.

rcarriga added a commit that referenced this issue Jan 27, 2023
@rcarriga
Copy link
Owner

Ha didn't even get to post the update before you spotted it, great to hear it being used already 😄

I suspect that exposing such feature in the way similar to dapui.eval would make many users happy.

Great idea, I've added the same ability in the latest commit!

@przepompownia
Copy link
Contributor Author

Thanks. I looked into the change to ensure if it allows selection in both directions 👍

It would be good to add some docs about the new feature too.

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