Fix templ file formatting

This commit is contained in:
Noah Håkansson 2024-03-03 14:44:37 +01:00
parent 1f1673571b
commit 36a671f221
2 changed files with 8 additions and 1 deletions

View File

@ -9,7 +9,7 @@ local M = {
function M.config() function M.config()
-- you can create a custom highlight group for the ghost text with the below command. -- you can create a custom highlight group for the ghost text with the below command.
-- change the `highlight` option to `parenhint` if you use this method. -- change the `highlight` option to `parenhint` if you use this method.
vim.api.nvim_exec([[ highlight parenhint guifg='#495659' ]], false) vim.api.nvim_exec([[ highlight parenhint guifg='#56633E' ]], false)
require('paren-hint').setup({ require('paren-hint').setup({
-- Include the opening paren in the ghost text -- Include the opening paren in the ghost text
include_paren = true, include_paren = true,

View File

@ -65,6 +65,13 @@ return {
return return
end end
-- Go Templ formatting
-- If filetype is templ, then we need to use the templ LSP client to format
-- So we disable the html client formatting capabilities
if vim.bo.filetype == 'templ' and client.name == 'html' then
client.server_capabilities.documentFormattingProvider = false
end
-- Create an autocmd that will run *before* we save the buffer. -- Create an autocmd that will run *before* we save the buffer.
-- Run the formatting command for the LSP that has just attached. -- Run the formatting command for the LSP that has just attached.
vim.api.nvim_create_autocmd('BufWritePre', { vim.api.nvim_create_autocmd('BufWritePre', {