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

:LspInfo client's root_directory seems to be always "Running in single file mode" even with single_file_support = false; Undefined global 'type' #2446

Closed
caldwell-63 opened this issue Feb 9, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@caldwell-63
Copy link

caldwell-63 commented Feb 9, 2023

Description

I tested that with tsserver and sumneko lua, so it is probably not Language Server issue, I suspect that it has something to do with Windows.

My configs are minimal taken from the readme, but with single_file_support set to false...

I did check if root_dir is resolved correctly, and it is:

  root_dir = function(fname)
    local root = util.root_pattern('.git')(fname);

    print(root, type(root)); --> C:/Users/.../.../dir   string

    return root;
  end,

Regardless, most features work properly, as if the actual root_dir were handled right under the hood.

Also, for some reason out of all globals, the type standard Lua function is not getting recognized:

image

#2366 - might be related

Neovim version

NVIM v0.8.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compiled by runneradmin@fv-az28-353

Nvim-lspconfig version

aeb7606 (latest)

Operating system and version

Windows 10

Affected language servers

tsserver, sumneko_lua, potentially all of them

Steps to reproduce

:LspInfo

Actual behavior

image

Expected behavior

It should be a path, especially with single_file_support option set to false

Minimal config

lspc.sumneko_lua.setup {
  on_attach = on_attach, -- just basic keymaps
  single_file_support = false,
  cmd = { 'lua-language-server' },
  filetypes = { 'lua' },
  log_level = 2,
  root_dir = function(fname)
    local root = util.root_pattern('.git')(fname);

    print(root, type(root));

    return root;
  end,
  settings = {
    Lua = {
      runtime = { version = 'LuaJIT' },
      diagnostics = { globals = { 'vim' } },
      workspace = {
        library = vim.api.nvim_get_runtime_file('', true),
      },
    },
  },
};

LSP log

https://gist.github.com/caldwell-63/666080bc3d8a86279e6e23f04afb70a3

@caldwell-63 caldwell-63 added the bug Something isn't working label Feb 9, 2023
@caldwell-63 caldwell-63 changed the title :LspInfo client's root_directory seems always to be "Running in single file mode"; Undefined global 'type' :LspInfo client's root_directory seems to be always "Running in single file mode" even with single_file_support = false; Undefined global 'type' Feb 9, 2023
@caldwell-63 caldwell-63 changed the title :LspInfo client's root_directory seems to be always "Running in single file mode" even with single_file_support = false; Undefined global 'type' :LspInfo client's root_directory seems to be always "Running in single file mode" even with single_file_support = false; Undefined global 'type' Feb 9, 2023
@glepnir
Copy link
Member

glepnir commented Feb 9, 2023

about diagnostic. you need workspace/diagnostic/refresh handler. lspinfo problem.I will fix it tomorrow .reply on phone

@caldwell-63
Copy link
Author

I do have a refresh handler, as you suggested in some other issue:

vim.lsp.handlers['workspace/diagnostic/refresh'] = function(_, _, ctx)
  local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id)
  local bufnr = vim.api.nvim_get_current_buf()
  vim.diagnostic.reset(ns, bufnr)
  return true
end

@glepnir
Copy link
Member

glepnir commented Feb 10, 2023

you are in windows? #2343 maybe can fix lspinfo bug.

@glepnir glepnir closed this as completed Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants