-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: follow upstream deprecate non-method clients functions #3443
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
local util = require 'lspconfig.util' | ||
local util = require('lspconfig.util') | ||
|
||
local root_files = { 'Project.toml', 'JuliaProject.toml' } | ||
|
||
local function activate_env(path) | ||
assert(vim.fn.has 'nvim-0.10' == 1, 'requires Nvim 0.10 or newer') | ||
assert(vim.fn.has('nvim-0.10') == 1, 'requires Nvim 0.10 or newer') | ||
local bufnr = vim.api.nvim_get_current_buf() | ||
local julials_clients = vim.lsp.get_clients { bufnr = bufnr, name = 'julials' } | ||
local julials_clients = vim.lsp.get_clients({ bufnr = bufnr, name = 'julials' }) | ||
assert( | ||
#julials_clients > 0, | ||
'method julia/activateenvironment is not supported by any servers active on the current buffer' | ||
) | ||
local function _activate_env(environment) | ||
if environment then | ||
for _, julials_client in ipairs(julials_clients) do | ||
julials_client.notify('julia/activateenvironment', { envPath = environment }) | ||
util.client_proxy(julials_client).notify('julia/activateenvironment', { envPath = environment }) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely not in favor of this PR if it requires If there's a way to make it transparent to configs, that's fine. Otherwise we should just wait until we can bump the minimum required Nvim to 0.11 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. The current command design is too fragile. The client is necessary here. So it is better to provide a default wrapper function with the switch_source_header(client, bufnr), |
||
vim.notify('Julia environment activated: \n`' .. environment .. '`', vim.log.levels.INFO) | ||
end | ||
|
@@ -35,16 +35,16 @@ local function activate_env(path) | |
_activate_env(path) | ||
else | ||
local depot_paths = vim.env.JULIA_DEPOT_PATH | ||
and vim.split(vim.env.JULIA_DEPOT_PATH, vim.fn.has 'win32' == 1 and ';' or ':') | ||
or { vim.fn.expand '~/.julia' } | ||
and vim.split(vim.env.JULIA_DEPOT_PATH, vim.fn.has('win32') == 1 and ';' or ':') | ||
or { vim.fn.expand('~/.julia') } | ||
local environments = {} | ||
vim.list_extend(environments, vim.fs.find(root_files, { type = 'file', upward = true, limit = math.huge })) | ||
for _, depot_path in ipairs(depot_paths) do | ||
local depot_env = vim.fs.joinpath(vim.fs.normalize(depot_path), 'environments') | ||
vim.list_extend( | ||
environments, | ||
vim.fs.find(function(name, env_path) | ||
return vim.tbl_contains(root_files, name) and string.sub(env_path, #depot_env + 1):match '^/[^/]*$' | ||
return vim.tbl_contains(root_files, name) and string.sub(env_path, #depot_env + 1):match('^/[^/]*$') | ||
end, { path = depot_env, type = 'file', limit = math.huge }) | ||
) | ||
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.
is stylua doing this? not required by our style guide.
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.
seems like a bug of stylua . just run
stylua ./
in shell