Sarath191181208 / LSP-from-scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating an LSP From scratch

Installing the project

Clone the repo

    git clone https://github.com/Sarath191181208/<repo_url>

if you have not installed go install. build the project using go.

go build main.go

triggering LSP in nvim

local client = vim.lsp.start_client{
  name = "test_lsp",
  -- Make sure to enter the correct path
  cmd = { "~/Projects/lsp_from_scratch/main" },
  on_attach = require("plugins.configs.lspconfig").on_attach
}

if not client then
  vim.notify("Hey, the client isn't configured properly")
  return
end

vim.api.nvim_create_autocmd('FileType', {
  pattern = "markdown",
  callback = function ()
    vim.lsp.buf_attach_client(0, client)
  end
})

References

About


Languages

Language:Go 100.0%