-
Notifications
You must be signed in to change notification settings - Fork 39
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: Enable always jumping to discussion tree #352
Feat: Enable always jumping to discussion tree #352
Conversation
This PR makes it possible to customize the behavior when pressing the `move_to_discussion_tree` keybinding and there is no diagnostic under cursor. Users can now do any combination of: - show warning - jump to last position in discussion tree
Hi @harrisoncramer, this PR changes the current behaviour - the new default is to always jump to the discussion tree even if there is no diagnostic under the cursor, as I believe this behaviour will be preferred by the majority of users. If, instead, you'd like the default to be that only a warning is shown (same as the old behaviour), I'll make the necessary changes. |
local warning = "No diagnostics for this line." | ||
if state.settings.reviewer_settings.no_diagnostic_actions.jump then | ||
warning = warning .. " Jumping to last position in discussion tree." | ||
vim.api.nvim_win_set_cursor(M.split.winid, { M.last_row, M.last_column }) | ||
vim.api.nvim_set_current_win(M.split.winid) | ||
end | ||
if state.settings.reviewer_settings.no_diagnostic_actions.warn then | ||
u.notify(warning, vim.log.levels.WARN) |
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.
This is a pretty simple feature, and I don't think it merits two new fields in the configuration table. I'd like to keep the API surface as small as possible for users.
Let's have it be a single option called jump_with_no_diagnostics
and if it's enabled, do not show any warning and do the jump. Otherwise (it should be the. default case) do not jump and show the warning.
if state.settings.reviewer_settings.jump_with_no_diagnostics then
vim.api.nvim_win_set_cursor(M.split.winid, { M.last_row, M.last_column })
vim.api.nvim_set_current_win(M.split.winid)
else
local warning = "No diagnostics for this line."
u.notify(warning, vim.log.levels.WARN)
end
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.
OK, fixed. Thanks for the review.
Small change, but once you make that I'll merge this in. Sorry this took me so long to get to. |
This PR makes it possible to customize the behavior when pressing the
move_to_discussion_tree
keybinding in the reviewer and there is no diagnostic under the cursor. Users can now set up any combination of:Closes #309.