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

chore: update flake.lock #566

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/rustaceanvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ rustaceanvim.dap.adapter.types.server *rustaceanvim.dap.adapter.types.server*


*rustaceanvim.dap.client.Config*
rustaceanvim.dap.client.Config : Configuration
rustaceanvim.dap.client.Config : dap.Configuration

Fields: ~
{type} (string) The dap adapter to use
Expand Down
90 changes: 45 additions & 45 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ftplugin/rust.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---@type rustaceanvim.Config
local config = require('rustaceanvim.config.internal')
local compat = require('rustaceanvim.compat')

if not vim.g.loaded_rustaceanvim then
require('rustaceanvim.config.check').check_for_lspconfig_conflict(vim.schedule_wrap(function(warn)
Expand All @@ -22,7 +23,7 @@ if not vim.g.loaded_rustaceanvim then
vim.lsp.commands['rust-analyzer.gotoLocation'] = function(command, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id)
if client then
vim.lsp.util.jump_to_location(command.arguments[1], client.offset_encoding)
compat.show_document(command.arguments[1], client.offset_encoding)
end
end

Expand All @@ -37,6 +38,7 @@ if not vim.g.loaded_rustaceanvim then
local cached_commands = require('rustaceanvim.cached_commands')
cached_commands.set_last_debuggable(args)
local rt_dap = require('rustaceanvim.dap')
---@diagnostic disable-next-line: invisible
rt_dap.start(args)
end

Expand Down
1 change: 1 addition & 0 deletions lua/rustaceanvim/cached_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ M.execute_last_debuggable = function(executableArgsOverride)
args.executableArgs = executableArgsOverride
end
local rt_dap = require('rustaceanvim.dap')
---@diagnostic disable-next-line: invisible
rt_dap.start(args)
else
local debuggables = require('rustaceanvim.commands.debuggables')
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/commands/code_action_group.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local M = {}
---@field arguments? any[]

---@param action rustaceanvim.RACodeAction | rustaceanvim.RACommand
---@param client lsp.Client
---@param client vim.lsp.Client
---@param ctx table
function M.apply_action(action, client, ctx)
if action.edit then
Expand Down
2 changes: 2 additions & 0 deletions lua/rustaceanvim/commands/debuggables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ local function dap_run(args)
local rt_dap = require('rustaceanvim.dap')
local ok, dap = pcall(require, 'dap')
if ok then
---@diagnostic disable-next-line: invisible
rt_dap.start(args, true, dap.run)
local cached_commands = require('rustaceanvim.cached_commands')
cached_commands.set_last_debuggable(args)
Expand Down Expand Up @@ -131,6 +132,7 @@ local function add_debuggables_to_nvim_dap(debuggables)
if not debuggable then
return
end
---@diagnostic disable-next-line: invisible
rt_dap.start(debuggable.args, false, function(configuration)
local name = 'Cargo: ' .. build_label(debuggable.args)
if not _dap_configuration_added[name] then
Expand Down
4 changes: 3 additions & 1 deletion lua/rustaceanvim/commands/open_cargo_toml.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local M = {}

local compat = require('rustaceanvim.compat')

local function get_params()
return {
textDocument = vim.lsp.util.make_text_document_params(0),
Expand All @@ -13,7 +15,7 @@ local function handler(_, result, ctx)

local client = vim.lsp.get_client_by_id(ctx.client_id)
if client then
vim.lsp.util.jump_to_location(result, client.offset_encoding)
compat.show_document(result, client.offset_encoding)
end
end

Expand Down
3 changes: 2 additions & 1 deletion lua/rustaceanvim/commands/parent_module.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local M = {}

local rl = require('rustaceanvim.rust_analyzer')
local compat = require('rustaceanvim.compat')

local function get_params()
return vim.lsp.util.make_position_params(0, nil)
Expand All @@ -20,7 +21,7 @@ local function handler(_, result, ctx)

local client = vim.lsp.get_client_by_id(ctx.client_id)
if client then
vim.lsp.util.jump_to_location(location, client.offset_encoding)
compat.show_document(location, client.offset_encoding)
end
end

Expand Down
1 change: 1 addition & 0 deletions lua/rustaceanvim/commands/rustc_unpretty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ local function get_vim_range(range, buf)
-- Use the value of the last col of the previous row instead.
erow = erow - 1
if not buf or buf == 0 then
---@diagnostic disable-next-line: assign-type-mismatch
ecol = vim.fn.col { erow, '$' } - 1
else
ecol = #vim.api.nvim_buf_get_lines(buf, erow - 1, erow, false)[1]
Expand Down
3 changes: 3 additions & 0 deletions lua/rustaceanvim/commands/ssr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ local M = {}
local function get_opts(query, visual_mode)
local opts = vim.lsp.util.make_position_params()
local range = (visual_mode and vim.lsp.util.make_given_range_params() or vim.lsp.util.make_range_params()).range
---@diagnostic disable-next-line: inject-field
opts.query = query
---@diagnostic disable-next-line: inject-field
opts.parseOnly = false
---@diagnostic disable-next-line: inject-field
opts.selections = { range }
return opts
end
Expand Down
13 changes: 13 additions & 0 deletions lua/rustaceanvim/compat.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---@diagnostic disable: deprecated, duplicate-doc-alias

---@mod rustaceanvim.compat compativility layer for
---API calls that are deprecated or removed in nvim nightly

Expand All @@ -15,4 +17,15 @@ function compat.get_line_diagnostics()
return vim.lsp.diagnostic.get_line_diagnostics()
end

---@param location lsp.Location|lsp.LocationLink
---@param offset_encoding 'utf-8'|'utf-16'|'utf-32'?
---@return boolean `true` if the jump succeeded
function compat.show_document(location, offset_encoding)
local show_document = vim.lsp.show_document
if not show_document then
vim.lsp.util.jump_to_location(location, offset_encoding)
end
return show_document(location, offset_encoding, { focus = true })
end

return compat
2 changes: 1 addition & 1 deletion lua/rustaceanvim/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
---@alias rustaceanvim.dap.adapter.types.executable "executable"
---@alias rustaceanvim.dap.adapter.types.server "server"

---@class rustaceanvim.dap.client.Config: Configuration
---@class rustaceanvim.dap.client.Config: dap.Configuration
---@field type string The dap adapter to use
---@field name string
---@field request rustaceanvim.dap.config.requests.launch | rustaceanvim.dap.config.requests.attach | rustaceanvim.dap.config.requests.custom The type of dap session
Expand Down
1 change: 1 addition & 0 deletions lua/rustaceanvim/config/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ local function load_dap_configuration(type)
stopOnEntry = false,
}
if type == 'lldb' then
---@diagnostic disable-next-line: inject-field
dap_config.runInTerminal = true
end
---@diagnostic disable-next-line: different-requires
Expand Down
1 change: 1 addition & 0 deletions lua/rustaceanvim/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ function M.start(args, verbose, callback, on_error)
---@param value string
:map(function(value)
local is_json, artifact = pcall(vim.fn.json_decode, value)
---@diagnostic disable-next-line: redundant-return-value
return is_json, artifact
end)
---@param is_json boolean
Expand Down
Loading
Loading