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

Changing languages doesn't seem to restart LSP #142

Open
ReKylee opened this issue Oct 31, 2024 · 9 comments
Open

Changing languages doesn't seem to restart LSP #142

ReKylee opened this issue Oct 31, 2024 · 9 comments

Comments

@ReKylee
Copy link

ReKylee commented Oct 31, 2024

My default language is set to Python, but when I use :Leet lang to change to CPP, my LSP, linter and formatter stay on Python.

I've tried opening python and cpp files by themselves and it seems like it works standalone, just not when changing through the command. I've also tried opening a python file, and then switching to a cpp file, and that works too(probably because it opens in a new buffer?)

@ReKylee ReKylee changed the title Changing languages doesn't seep to restart LSP Changing languages doesn't seem to restart LSP Oct 31, 2024
@kawre
Copy link
Owner

kawre commented Oct 31, 2024

:Leet lang also opens a new buffer. Could you switch between Python and C++, then paste your LspInfo?

@kawre
Copy link
Owner

kawre commented Oct 31, 2024

And your neovim version

@ReKylee
Copy link
Author

ReKylee commented Oct 31, 2024

Sure :D

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

LSP configs active in this session (globally) ~
- Configured servers: lua_ls, pyright, ruff, clangd
- OK Deprecated servers: (none)

LSP configs active in this buffer (bufnr: 19) ~
- Language client log: ~\AppData\Local\nvim-data\lsp.log
- Detected filetype: ``
- 0 client(s) attached to this buffer
- 1 active client(s) not attached to this buffer:
- Client: `pyright` (id: 1, bufnr: [7])
  root directory:    Running in single file mode.
  filetypes:         py
  cmd:               ~\AppData\Local\nvim-data\mason\bin\pyright-langserver.CMD --stdio
  version:           `?` (Failed to get version) Tried:
  `C:\Users\ido54\AppData\Local\nvim-data\mason\bin\pyright-langserver.CMD --version`
  `C:\Users\ido54\AppData\Local\nvim-data\mason\bin\pyright-langserver.CMD -version`
  `C:\Users\ido54\AppData\Local\nvim-data\mason\bin\pyright-langserver.CMD version`
  `C:\Users\ido54\AppData\Local\nvim-data\mason\bin\pyright-langserver.CMD --help`
  
  executable:        true
  autostart:         true

Docs for active configs: ~
- 

from :version
NVIM v0.10.2
Build type: Release

@kawre
Copy link
Owner

kawre commented Oct 31, 2024

when I use :Leet lang to change to CPP, my LSP, linter and formatter stay on Python.

By this, you mean that you are getting python auto completion on a c++ file?

@ReKylee
Copy link
Author

ReKylee commented Oct 31, 2024

{80CBF37D-6087-4684-8A89-2F00C2F9FE1F}

Well actually, it just doesn't do anything and the python linter seems to display python errors on the cpp code

EDIT: Looks like the linter is also dormant, as the warnings remain even if I delete the entire code haha.

@kawre
Copy link
Owner

kawre commented Oct 31, 2024

How does it behave when you set lang to cpp, then switch to python with :Leet lang?

@ReKylee
Copy link
Author

ReKylee commented Oct 31, 2024

Switching from CPP to Python3 works well, and pyright starts up and I get correct linting, but then switching back to CPP keeps the Python linting for some reason?

@kawre
Copy link
Owner

kawre commented Oct 31, 2024

Could you add commit = "94c16d8be8d09c0b543782b0323ce6eb1fbc95c5" to leetcode.nvim config? Does it change anything?

@ReKylee
Copy link
Author

ReKylee commented Oct 31, 2024

{4349048C-C834-4AEB-A2F9-C26BA3AFD67E}

With commit = "94c16d8be8d09c0b543782b0323ce6eb1fbc95c5" added, it seems like the previous lint is "stuck"? But the CPP lint and autocomplete work

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

2 participants