Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Long paths (for workspace) seem to be being cut #394

Open
2 tasks done
Sarctiann opened this issue Apr 10, 2024 · 0 comments
Open
2 tasks done

Long paths (for workspace) seem to be being cut #394

Sarctiann opened this issue Apr 10, 2024 · 0 comments

Comments

@Sarctiann
Copy link

Problem description

I'm using this with lua-language-server in neovim (Lazyvim).

I have this configuration:

return {
  "luals/lua-language-server",
  config = function()
    require("lspconfig").lua_ls.setup({
      on_init = function(client)
        local path = client.workspace_folders[1].name
        if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then
          return
        end

        client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
          runtime = {
            -- Tell the language server which version of Lua you're using
            -- (most likely LuaJIT in the case of Neovim)
            version = "LuaJIT",
          },
          -- Make the server aware of Neovim runtime files
          workspace = {
            checkThirdParty = false,
            library = {
              vim.env.VIMRUNTIME,
              path,
            },
          },
        })
      end,
      settings = {
        Lua = {},
      },
    })
  end,
}

I started a project called TGE.

If I have the project into "/Users/sebastianrodriguezcapurro/Documents/SARCTIANN/LUA/TGE"

But the client.workspace_folders[1].name comes just to "/Users/sebastianrodriguezcapurro/Documents/SARCTIANN" (where I have a lot of other projects in other languages, etc.) So when lsp starts to analyze that folder reach a limit and dies.

If I move TGE to a closer to ~ folder like "/Users/sebastianrodriguezcapurro/Documents/TGE"
everything works as expected.

Why do you think this is an issue with mason-lspconfig.nvim?

I'm not sure, I'm new in nvim and lua. But I assume the client table is coming from lspconfig.
if is not the case I will replicate this issue in lua-language-server repo

Neovim version (>= 0.7)

NVIM 0.9 LUAJIT 2.1

Operating system/version

macOS 14.4.1

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

  • Yes

Affected language servers

lua-language-server

Steps to reproduce

Try to work on a lua project inside a large nested path

Actual behavior

lua_ls tries to scan a huge folder that is not the workspace folder and dies in the try.

Expected behavior

get the lua_ls working

LspInfo

Language client log: /Users/sebastianrodriguezcapurro/.local/state/nvim/lsp.log
 Detected filetype:   lua
 
 1 client(s) attached to this buffer: 
 
 Client: lua_ls (id: 1, bufnr: [5])
 	filetypes:       lua
 	autostart:       true
 	root directory:  /Users/sebastianrodriguezcapurro/Documents/SARCTIANN
 	cmd:             /Users/sebastianrodriguezcapurro/.local/share/nvim/mason/bin/lua-language-server
 
 Configured servers list: taplo, jsonls, tsserver, marksman, ruff_lsp, pyright, eslint, tailwindcss, lua_ls

LspLog

[WARN][2024-04-10 12:50:48] ...lsp/handlers.lua:537	"More than 100000 files have been scanned. The current scanned directory is `/Users/sebastianrodriguezcapurro/Documents/SARCTIANN`. Please see the [FAQ](https://luals.github.io/wiki/faq/#how-can-i-improve-startup-speeds) to see how you can include fewer files. It is also possible that your [configuration is incorrect](https://luals.github.io/wiki/faq#why-is-the-server-scanning-the-wrong-folder)."

Healthcheck

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-04-10-phony-organ` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.4.0 (x86_64-apple-darwin23.0) libcurl/8.4.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.58.0`
- OK gzip: `Apple gzip 430.100.5`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- OK Ruby: `ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]`
- OK node: `v20.10.0`
- OK luarocks: `/opt/homebrew/bin/luarocks 3.11.0`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK RubyGem: `3.0.3.1`
- OK python: `Python 3.12.2`
- OK JAVA_HOME: `openjdk version "17.0.9" 2023-10-17 LTS`
- OK java: `openjdk version "17.0.9" 2023-10-17 LTS`
- OK npm: `10.2.3`
- OK javac: `javac 17.0.9`
- OK pip: `pip 24.0 from /opt/homebrew/lib/python3.12/site-packages/pip (python 3.12)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 1. Remaining: 59. Limit: 60. Reset: Wed Apr 10 13:28:52 2024.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant