Last active
June 7, 2023 11:43
-
-
Save Janiczek/27dbddfee07d3e9cf961cd481db8f522 to your computer and use it in GitHub Desktop.
elm-vim-tailwind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Plug 'neovim/nvim-lspconfig' | |
Plug 'williamboman/nvim-lsp-installer' | |
Plug 'lifepillar/vim-mucomplete' | |
" LSP Elm+Tailwind tries: | |
lua << EOF | |
require("nvim-lsp-installer").setup({ | |
ensure_installed = { "tailwindcss" } | |
}) | |
require('lspconfig').tailwindcss.setup{ | |
filetypes = { "html", "elm" }, | |
init_options = { | |
userLanguages = { | |
elm = "html", | |
html = "html" | |
} | |
}, | |
settings = { | |
tailwindCSS = { | |
includeLanguages = { | |
elm = "html", | |
html = "html" | |
}, | |
classAttributes = { "class", "className", "classList", "ngClass" }, | |
experimental = { | |
classRegex = { | |
"\\bclass[\\s(<|]+\"([^\"]*)\"", | |
"\\bclass[\\s(]+\"[^\"]*\"[\\s+]+\"([^\"]*)\"", | |
"\\bclass[\\s<|]+\"[^\"]*\"\\s*\\+{2}\\s*\" ([^\"]*)\"", | |
"\\bclass[\\s<|]+\"[^\"]*\"\\s*\\+{2}\\s*\" [^\"]*\"\\s*\\+{2}\\s*\" ([^\"]*)\"", | |
"\\bclass[\\s<|]+\"[^\"]*\"\\s*\\+{2}\\s*\" [^\"]*\"\\s*\\+{2}\\s*\" [^\"]*\"\\s*\\+{2}\\s*\" ([^\"]*)\"", | |
"\\bclassList[\\s\\[\\(]+\"([^\"]*)\"", | |
"\\bclassList[\\s\\[\\(]+\"[^\"]*\",\\s[^\\)]+\\)[\\s\\[\\(,]+\"([^\"]*)\"", | |
"\\bclassList[\\s\\[\\(]+\"[^\"]*\",\\s[^\\)]+\\)[\\s\\[\\(,]+\"[^\"]*\",\\s[^\\)]+\\)[\\s\\[\\(,]+\"([^\"]*)\"" | |
} | |
}, | |
lint = { | |
cssConflict = "warning", | |
invalidApply = "error", | |
invalidConfigPath = "error", | |
invalidScreen = "error", | |
invalidTailwindDirective = "error", | |
invalidVariant = "error", | |
recommendedVariantOrder = "warning" | |
}, | |
validate = true | |
} | |
} | |
} | |
-- vim.lsp.set_log_level 'trace' | |
EOF | |
set completeopt+=menuone,noselect,noinsert | |
set completeopt-=preview | |
" set pumheight=8 | |
set shortmess+=c | |
" dont hide the autocomplete on dash when writing eg. text-underline | |
augroup elm_css_class_dash_autocompletion | |
autocmd FileType elm,html autocmd! elm_css_class_dash_autocompletion InsertEnter <buffer> set isk+=- | |
autocmd FileType elm,html autocmd elm_css_class_dash_autocompletion InsertLeave <buffer> set isk-=- | |
augroup END | |
autocmd Filetype elm,html call SetLspOptions() | |
function SetLspOptions() | |
set omnifunc=v:lua.vim.lsp.omnifunc | |
MUcompleteAutoOn | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment