Skip to content

Commit 7d617c2

Browse files
committed
add support for blade
Signed-off-by: Kirill Mokevnin <[email protected]>
1 parent 130c76c commit 7d617c2

File tree

13 files changed

+189
-116
lines changed

13 files changed

+189
-116
lines changed

Makefile

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,38 @@ deps-install: deps-gem deps-composer deps-npm deps-pip deps-go
1717

1818
deps-pip:
1919
# pip2 install --upgrade pynvim
20-
pip3 install --upgrade pynvim
21-
pip3 install --upgrade vim-vint spellcheck yamllint codespell ansible-lint
22-
pip3 install --upgrade autopep8 flake8 bandit pytype # black
20+
pip3 install --break-system-packages pynvim
21+
# pip3 install --upgrade vim-vint spellcheck yamllint codespell ansible-lint
22+
# pip3 install --upgrade autopep8 flake8 bandit pytype # black
2323

2424
deps-gem:
25-
gem install --no-document neovim
26-
gem install --no-document solargraph solargraph-rails
27-
gem install --no-document rubocop rubocop-rspec rubocop-rails rubocop-performance rubocop-rake
28-
gem install --no-document sorbet sorbet-runtime
29-
gem install --no-document haml_lint slim_lint erb_lint
30-
gem install --no-document brakeman reek
25+
# gem install --no-document neovim
26+
# gem install --no-document solargraph solargraph-rails
27+
# gem install --no-document rubocop rubocop-rspec rubocop-rails rubocop-performance rubocop-rake
28+
# gem install --no-document sorbet sorbet-runtime
29+
# gem install --no-document haml_lint slim_lint erb_lint
30+
# gem install --no-document brakeman reek
3131

3232
deps-composer:
33-
composer --no-interaction global require \
34-
squizlabs/php_codesniffer \
35-
phpstan/phpstan
33+
# composer --no-interaction global require \
34+
# squizlabs/php_codesniffer \
35+
# phpstan/phpstan
3636
# phpactor/phpactor
3737

3838
deps-npm:
3939
npm install -g neovim
40-
npm install -g prettier eslint eslint-plugin-import eslint-plugin-node
41-
npx install-peerdeps -yg eslint-config-airbnb
42-
npm install -g stylelint stylelint-config-recommended stylelint-config-standard
43-
npm install -g yaml-language-server markuplint markdownlint-cli bash-language-server jsonlint
44-
npm install -g dockerfile-language-server-nodejs
40+
# npm install -g prettier eslint eslint-plugin-import eslint-plugin-node
41+
# npx install-peerdeps -yg eslint-config-airbnb
42+
# npm install -g stylelint stylelint-config-recommended stylelint-config-standard
43+
# npm install -g yaml-language-server markuplint markdownlint-cli bash-language-server jsonlint
44+
# npm install -g dockerfile-language-server-nodejs
4545

4646
deps-go:
47-
go install honnef.co/go/tools/cmd/staticcheck@latest
48-
GO111MODULE=on go install golang.org/x/tools/gopls@latest
47+
# go install honnef.co/go/tools/cmd/staticcheck@latest
48+
# GO111MODULE=on go install golang.org/x/tools/gopls@latest
4949

5050
deps-luarock:
51-
luarocks install luacheck
51+
# luarocks install luacheck
5252

5353
# nvim-log:
5454
# tail -f kjj

nvim/.luarc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
22
"diagnostics.disable": [
3+
],
4+
"diagnostics.globals": [
5+
"vim"
36
]
47
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
;; extends
2+
3+
; AlpineJS attributes
4+
(attribute
5+
(attribute_name) @_attr
6+
(#lua-match? @_attr "^x%-%l")
7+
(#not-any-of? @_attr "x-teleport" "x-ref" "x-transition")
8+
(quoted_attribute_value
9+
(attribute_value) @injection.content)
10+
(#set! injection.language "javascript"))
11+
12+
; Blade escaped JS attributes
13+
; <x-foo ::bar="baz" />
14+
(element
15+
(_
16+
(tag_name) @_tag
17+
(#lua-match? @_tag "^x%-%l")
18+
(attribute
19+
(attribute_name) @_attr
20+
(#lua-match? @_attr "^::%l")
21+
(quoted_attribute_value
22+
(attribute_value) @injection.content)
23+
(#set! injection.language "javascript"))))
24+
25+
; Blade PHP attributes
26+
; <x-foo :bar="$baz" />
27+
(element
28+
(_
29+
(tag_name) @_tag
30+
(#lua-match? @_tag "^x%-%l")
31+
(attribute
32+
(attribute_name) @_attr
33+
(#lua-match? @_attr "^:%l")
34+
(quoted_attribute_value
35+
(attribute_value) @injection.content)
36+
(#set! injection.language "php_only"))))

nvim/lazy-lock.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
{
2-
"LazyVim": { "branch": "main", "commit": "fe72424e77cb9c953084bbcaaa0eb7fe8056dc70" },
3-
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
4-
"SchemaStore.nvim": { "branch": "main", "commit": "5d7f8c3e7ae4e3fa5daedb83306406f95257201c" },
2+
"LazyVim": { "branch": "main", "commit": "e3bfcb9bf74292dc846f5d1710fbb2e8f36a687a" },
3+
"SchemaStore.nvim": { "branch": "main", "commit": "6eb5d8d9ec9f81b75aaa6d15d0f6dc12a066fd3f" },
54
"autosave.nvim": { "branch": "main", "commit": "feaf2d220f6a01a8f794c596145dfb2739a00203" },
6-
"bufferline.nvim": { "branch": "main", "commit": "615aeb04ae73d827e2cc0c35fa5ba15f2b77f4bb" },
5+
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
76
"catppuccin": { "branch": "main", "commit": "045e3499d9ec8d84635fb08877ae44fd33f6a38d" },
87
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
9-
"cmp-emoji": { "branch": "main", "commit": "0acd702358230abeb6576769f7116e766bca28a0" },
108
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
119
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
12-
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
13-
"conform.nvim": { "branch": "master", "commit": "34b81e70da83e26c048290204de44268eb59814e" },
10+
"conform.nvim": { "branch": "master", "commit": "5a15cc46e75cad804fd51ec5af9227aeb1d1bdaa" },
1411
"ctrlsf.vim": { "branch": "master", "commit": "32236a8b376d9311dec9b5fe795ca99d32060b13" },
1512
"dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" },
1613
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
17-
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
1814
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
1915
"headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" },
2016
"indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
21-
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
17+
"lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },
2218
"lualine.nvim": { "branch": "master", "commit": "8b56462bfb746760465264de41b4907310f113ec" },
2319
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
2420
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
@@ -29,10 +25,10 @@
2925
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
3026
"mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" },
3127
"neo-tree.nvim": { "branch": "v3.x", "commit": "459c60317cc1d251f6eb3b6f010d015d5d24b806" },
32-
"neoconf.nvim": { "branch": "main", "commit": "eb8ca458b57386b8c07e8086c59d16467177b01f" },
28+
"neoconf.nvim": { "branch": "main", "commit": "db1d1bd45f4e91da6abc898281711fa47eda0ece" },
3329
"neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
3430
"nui.nvim": { "branch": "main", "commit": "756c59f46057cd2d43619cd3a6d4e01b2aa60295" },
35-
"nvim-asciidoc-preview": { "branch": "main", "commit": "1da18f7a20ed2a662624991178fd51b034e3db4b" },
31+
"nvim-asciidoc-preview": { "branch": "main", "commit": "0d1d123339205e5a0bd51191ebd37afee464a34d" },
3632
"nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" },
3733
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
3834
"nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" },
@@ -41,11 +37,11 @@
4137
"nvim-dap-ruby": { "branch": "main", "commit": "a2248b7b31f6f096b9e847e769afd00060e0aae4" },
4238
"nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" },
4339
"nvim-dap-virtual-text": { "branch": "master", "commit": "a5fc69240869c0fee8ff176bc9e4efdf8bdfb596" },
44-
"nvim-jdtls": { "branch": "master", "commit": "382b9f625861f47d95876bcfb4c261f3b96077cb" },
40+
"nvim-jdtls": { "branch": "master", "commit": "8eb5f0dbe6e126b392ddcaf45893358619893e45" },
4541
"nvim-lint": { "branch": "master", "commit": "e824adb9bc01647f71e55457353a68f0f37f9931" },
46-
"nvim-lspconfig": { "branch": "master", "commit": "e5e600232188ed9fb960f5df6bb06084ae8bf3ec" },
42+
"nvim-lspconfig": { "branch": "master", "commit": "94cf4adb81158817520e18d2174963d8e1424df9" },
4743
"nvim-spectre": { "branch": "master", "commit": "3712ff0cdf4f9f877d9ca708d835a877d9a0abaf" },
48-
"nvim-treesitter": { "branch": "master", "commit": "c09932bd2de01dc9c01e870fe83060693c67de13" },
44+
"nvim-treesitter": { "branch": "master", "commit": "57205313dda0ac82ac69e21d5e2a80f3297c14cc" },
4945
"nvim-treesitter-context": { "branch": "master", "commit": "b8b7e52c1517d401d7c519787d5dc4528c41291a" },
5046
"nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
5147
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b7a0bfa3e93697ca5b61b15df633404bf8f45883" },
@@ -56,7 +52,9 @@
5652
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
5753
"sqlite.lua": { "branch": "master", "commit": "40701b6151f8883980c1548647116de39b763540" },
5854
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
59-
"telescope.nvim": { "branch": "master", "commit": "dc1ea28cc2a02cd1cebb9d80e967807d668f78f8" },
55+
"telescope-terraform-doc.nvim": { "branch": "main", "commit": "e09181f76acefaf66d2b55149bebe939828234b4" },
56+
"telescope-terraform.nvim": { "branch": "main", "commit": "072c97023797ca1a874668aaa6ae0b74425335df" },
57+
"telescope.nvim": { "branch": "master", "commit": "7472420f8734c710bd7009081cef9b97f08a3821" },
6058
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
6159
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
6260
"tree-sitter-embedded-template": { "branch": "master", "commit": "6d791b897ecda59baa0689a85a9906348a2a6414" },

nvim/lazyvim.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"news": {
66
"NEWS.md": "2123"
77
},
8-
"version": 2
8+
"version": 3
99
}

nvim/lua/config/lazy.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ require('lazy').setup({
2525
{ import = "lazyvim.plugins.extras.lang.python" },
2626
{ import = "lazyvim.plugins.extras.lang.ruby" },
2727
{ import = "lazyvim.plugins.extras.lang.terraform" },
28+
{ import = "lazyvim.plugins.extras.coding.native_snippets" },
2829
{ import = "lazyvim.plugins.extras.lang.yaml" },
2930
{ import = "plugins" },
3031
},

nvim/lua/config/options.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ vim.o.linebreak = true
1111
vim.g.autoformat = false
1212

1313
vim.g.root_spec = { "cwd" }
14+
15+
vim.filetype.add({
16+
pattern = {
17+
[".*%.blade%.php"] = "blade",
18+
},
19+
})
20+
21+
vim.o.smartindent = false

nvim/lua/plugins/cmp.lua

Lines changed: 0 additions & 75 deletions
This file was deleted.

nvim/lua/plugins/lspconfig.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ return {
1111
},
1212
servers = {
1313
kotlin_language_server = {},
14+
html = {
15+
filetypes = { 'html', 'blade' }
16+
},
1417
bashls = {},
1518
lemminx = {},
16-
phpactor = {},
19+
phpactor = {
20+
filetypes = { 'php', 'blade' }
21+
},
1722
ltex = {
1823
settings = {
1924
ltex = {

nvim/lua/plugins/treesitter.lua

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
11
return {
22
{
33
"nvim-treesitter/nvim-treesitter",
4-
opts = {
5-
endwise = {
4+
opts = function(_, opts)
5+
-- https://github.com/EmranMR/tree-sitter-blade/discussions/19
6+
-- https://github.com/calebdw/dotfiles/blob/master/.config/nvim/queries/blade/injections.scm
7+
vim.list_extend(opts.ensure_installed, {
8+
"php",
9+
"php_only",
10+
})
11+
12+
opts.endwise = {
613
enable = true,
7-
},
8-
},
14+
}
15+
opts.swap = {
16+
enable = true,
17+
}
18+
19+
local tbl_filetypes = require("nvim-ts-autotag.internal").tbl_filetypes
20+
opts.autotag = {
21+
enable = true,
22+
filetypes = vim.list_extend(tbl_filetypes, { 'blade' })
23+
}
24+
25+
opts.select = {
26+
enable = true,
27+
}
28+
opts.textobjects = {
29+
lsp_interop = {
30+
enable = true,
31+
},
32+
}
33+
34+
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
35+
36+
parser_config.blade = {
37+
install_info = {
38+
url = "https://github.com/EmranMR/tree-sitter-blade",
39+
files = { "src/parser.c" },
40+
branch = "main",
41+
generate_requires_npm = true,
42+
requires_generate_from_grammar = true,
43+
},
44+
filetype = "blade",
45+
}
46+
47+
-- require("nvim-treesitter.configs").setup(opts)
48+
end,
949
},
1050
}

0 commit comments

Comments
 (0)