Coder Social home page Coder Social logo

Comments (8)

lewis6991 avatar lewis6991 commented on June 20, 2024 1

One benefit (and design requirement) of vim.treesitter.language.add is that it can be called from multiple sources. I think that requirement should apply to LSP too, i.e. servers can be specified in multiple sources: config, plugins, etc.

from neovim.

lewis6991 avatar lewis6991 commented on June 20, 2024 1

Just to throw in another idea.

I've been debugging some LSP stuff and wondering whether something like this would also be useful:

vim.lsp.log.set_level(vim.lsp.log.levels.DEBUG)
-- vim.lsp.log.set_format_func(vim.inspect)

api.nvim_create_user_command('LspLog', function()
  local log_path = vim.lsp.get_log_path()
  vim.cmd.split(log_path)
end, {})

Something like this could reduce friction with LSP issues, since atm, getting the log file is rather tedious, and can quickly solve certain kinds of issues. Just an idea. A similar treesitter analogue is :InspectTree.

With that said, the LSP logging does need some improvements because currently the log is shared between all servers and nvim sessions and grows indefinitely unless it is manually cleared.

from neovim.

justinmk avatar justinmk commented on June 20, 2024

Nvim core would need the concept of "registering" or "managing" a client without it being started. For example, a vim.lsp.register API that makes Nvim aware of a client configuration without actually starting it.

Do we only need a way to "define" clients and add them to a list, or is there more involved (such as lifecycle, cleanup, ... which is the usual unpleasantness implied by a "registry")? Maybe vim.lsp.add_client() or vim.lsp.def_client() could be the name. Or vim.lsp.config()

from neovim.

lewis6991 avatar lewis6991 commented on June 20, 2024

+1, but I would prefer we add :Lsp with stop, restart and info sub-commands.

Ah sorry, didn't read OP fully, that's what you are already proposing.

from neovim.

lewis6991 avatar lewis6991 commented on June 20, 2024

Nvim core would need the concept of "registering" or "managing" a client without it being started. For example, a vim.lsp.register API that makes Nvim aware of a client configuration without actually starting it. This same functionality would be needed for :LspStart as well, if we want to include that.

Note we already have vim.treesitter.language.register/add which serves a similar purpose, would be nice if we could mirror that, or have them align.

from neovim.

justinmk avatar justinmk commented on June 20, 2024

we already have vim.treesitter.language.register/add which serves a similar purpose, would be nice if we could mirror that, or have them align.

Definitely. gpanders mentioned vim.lsp.config, I wonder if that can be the interface for "defining a client". See also #24054

from neovim.

clason avatar clason commented on June 20, 2024

We definitely want to support "language server plugins" as a first-class use case here (not for every server, mind you, but for those that require more work to set up or have custom commands that are out of scope for core).

from neovim.

gpanders avatar gpanders commented on June 20, 2024

Something like this could reduce friction with LSP issues, since atm, getting the log file is rather tedious

Not opposed to it, but just to point this out: :checkh lsp prints the path to the log file and you can use gf or <C-W>f on that to open it. It's admittedly not the most straightforward, but it's not too bad in a pinch.

from neovim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.