Skip to content

Commit

Permalink
feat(pack): add hyprlang config file language support (#1063)
Browse files Browse the repository at this point in the history
* feat(pack): add hyprland config file language support

* Update lua/astrocommunity/pack/hyprland/init.lua

Co-authored-by: Micah Halter <[email protected]>

* Update lua/astrocommunity/pack/hyprland/init.lua

Co-authored-by: Micah Halter <[email protected]>

* Update lua/astrocommunity/pack/hyprland/init.lua

Co-authored-by: Micah Halter <[email protected]>

* Update lua/astrocommunity/pack/hyprland/init.lua

Co-authored-by: Micah Halter <[email protected]>

* Update lua/astrocommunity/pack/hyprland/README.md

* Update lua/astrocommunity/pack/hyprland/README.md

* Update lua/astrocommunity/pack/hyprland/README.md

---------

Co-authored-by: Micah Halter <[email protected]>
  • Loading branch information
WilliamBy and mehalter committed Jun 21, 2024
1 parent 5adae48 commit e2a5562
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/astrocommunity/pack/hyprlang/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# hyprlang Pack

This plugin pack offers language support for Hyprland config file. It does the following:

- Adds `hyprlang` filetype which will be assumed from below patterns:
- `*.hl` extension
- `.*/hypr/.*.conf`, `hypr.*.conf`
- Adds `hyprlang` Treesitter parsers

## Requirement

- Need to install `hyprls` tool first
- if (mason-tool-installer)[https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim] has been loaded, then hyprls should be
installed automatically
- Execute `:Mason` to install hyprls via mason
52 changes: 52 additions & 0 deletions lua/astrocommunity/pack/hyprlang/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---@type LazySpec
return {
-- mason ensure install hyprls
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "hyprls" })
end,
},

{
"AstroNvim/astrocore",
optional = true,
---@type AstroCoreOpts
opts = {
-- add "hyprlang" file tpye
filetypes = {
extension = {
hl = "hyprlang",
},
pattern = {
[".*/hypr/.*.conf"] = "hyprlang",
["hypr.*.conf"] = "hyprlang",
},
},
},
},
{
"AstroNvim/astrolsp",
opts = function(_, opts)
local astrocore = require "astrocore"
opts.servers = astrocore.list_insert_unique(opts.servers, { "hyprls" })

return astrocore.extend_tbl(opts, {
config = {
hyprls = { filetypes = { "hyprlang" } },
},
})
end,
},
-- treesitter support for hyprlang
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "hyprlang" })
end
end,
},
}

0 comments on commit e2a5562

Please sign in to comment.