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

Randomly opens JSON files from project #199

Open
antoinegomez opened this issue Sep 4, 2024 · 6 comments
Open

Randomly opens JSON files from project #199

antoinegomez opened this issue Sep 4, 2024 · 6 comments

Comments

@antoinegomez
Copy link

Having I think one problem related to this plugin.

In some projects, it occurred in two different ones, while I am editing a TS/JS/React file nvim will randomly opens JSON files in the current buffer. If I am in a popup it will put it there, otherwise in the main buffer.

Cannot be 100% sure it is vtsls problem and trying to narrow it down.
For now I switched back to typescript-tools.

I will try to reproduce and if possible make it reproducible and you can understand that it is not easy to do because it happens on private company repo projects.

My config is here:

https://gitlab.com/gomezantoine/dotfiles/-/blob/master/.config/nvim/lua/antoine/lsp/typescript.lua?ref_type=heads

@yioneko
Copy link
Owner

yioneko commented Sep 5, 2024

Does this happen with enableProjectDiagnostics set to false?

@agravelot
Copy link

For reference: LazyVim/LazyVim#3857

@antoinegomez
Copy link
Author

Does this happen with enableProjectDiagnostics set to false?

No

Changed it to false and it is not happening again. So seems correlated.

@agravelot
Copy link

Does this happen with enableProjectDiagnostics set to false?

No

Changed it to false and it is not happening again. So seems correlated.

I confirm

@yioneko
Copy link
Owner

yioneko commented Oct 30, 2024

Will (try to) fix it in the next release

@adradan
Copy link

adradan commented Dec 19, 2024

Disabling this does not seem to fix this for me. Random tsconfig files are opening once the LSP is finished initializing the project's tsconfig.json. The main tsconfig uses references to other configs.

local servers = {
      clangd = {},
      lua_ls = {},
      jedi_language_server = {},
      eslint = {},
      vtsls = {
        settings = {
          typescript = {
            -- https://github.com/yioneko/vtsls/issues/199
            tsserver = { experimental = { enableProjectDiagnostics = false } },
            updateImportsOnFileMove = { enabled = "always" },
            suggest = {
              completeFunctionCalls = true,
            },
            inlayHints = {
              parameterNames = { enabled = "literals" },
              parameterTypes = { enabled = true },
              variableTypes = { enabled = true },
              propertyDeclarationTypes = { enabled = true },
              functionLikeReturnTypes = { enabled = true },
              enumMemberValues = { enabled = true },
            },
          },
        },
      },
    }

    require("mason").setup()
    vim.lsp.set_log_level("debug")
    local ensure_installed = vim.tbl_keys(servers)
    -- Add other tools to install here
    vim.list_extend(ensure_installed, {
      "stylua",
      { "ruff", version = "0.8.2" },
      "mypy",
      "vtsls",
    })

    require("mason-tool-installer").setup({ ensure_installed = ensure_installed })

    require("mason-lspconfig").setup({
      handlers = {
        function(server_name)
          -- From kickstart.nvim
          local server = servers[server_name] or {}
          server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
          require("lspconfig")[server_name].setup(server)
        end,
      },
    })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants