Giter Site home page Giter Site logo

LazyVim LSP example? about templ HOT 8 CLOSED

ezynda3 avatar ezynda3 commented on June 4, 2024
LazyVim LSP example?

from templ.

Comments (8)

zbindenren avatar zbindenren commented on June 4, 2024 4

My PR to add it to mason.nvim got accepted: mason-org/mason-registry#2832

I plan to create a PR for the lspconfig and conform.nvim repo.

from templ.

evanlurvey avatar evanlurvey commented on June 4, 2024 2

TL;DR; install templ with go and make sure your go bin is on your path then you can do your lsp config.

local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
local util = require("lspconfig.util")

-- add custom templ lsp
configs .templ = {
  default_config = {
    cmd = { "templ", "lsp", },
    filetypes = { "templ" },
    root_dir = util.root_pattern("go.mod", ".git"),
    settings = {},
  }
}

-- setup same way you do with other lsp configs
-- assumes you have an on_attach and capabilities generation of some sort already. 
lspconfig["templ"].setup({ on_attach = on_attach, capabilities = capabilities })

If you have questions post your config.

from templ.

ezynda3 avatar ezynda3 commented on June 4, 2024 2

TL;DR; install templ with go and make sure your go bin is on your path then you can do your lsp config.

local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
local util = require("lspconfig.util")

-- add custom templ lsp
configs .templ = {
  default_config = {
    cmd = { "templ", "lsp", },
    filetypes = { "templ" },
    root_dir = util.root_pattern("go.mod", ".git"),
    settings = {},
  }
}

-- setup same way you do with other lsp configs
-- assumes you have an on_attach and capabilities generation of some sort already. 
lspconfig["templ"].setup({ on_attach = on_attach, capabilities = capabilities })

If you have questions post your config.

Thanks!

from templ.

zbindenren avatar zbindenren commented on June 4, 2024 2

That's really cool.

Do the docs need updating to explain how to get the templ LSP working with Mason, or will it be automatic since @zbindenren's PR?

When everything is done I will make a PR here to update the templ doc.

from templ.

zbindenren avatar zbindenren commented on June 4, 2024 2

Let's see how it goes:

from templ.

evanlurvey avatar evanlurvey commented on June 4, 2024 1

Should be automatic with mason if you add to your install list.
The custom LSP config will be required until someone makes a pr there. Then for most depending on what your config looks like it would be adding a single item to a table and the rest is all automatic.

from templ.

a-h avatar a-h commented on June 4, 2024 1

Great work, those two PRs are merged. Just a docs PR to go, I've just signed up to Hacktoberfest, so now's a great time to update the docs. 😁

from templ.

a-h avatar a-h commented on June 4, 2024

That's really cool.

Do the docs need updating to explain how to get the templ LSP working with Mason, or will it be automatic since @zbindenren's PR?

from templ.

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.