tree-sitter-grammars / tree-sitter-hyprlang Goto Github PK
View Code? Open in Web Editor NEWhyprlang grammar for tree-sitter
License: MIT License
hyprlang grammar for tree-sitter
License: MIT License
Add instructions for Helix Editor
Hey there! Only a super small issue, but i don't get syntax highlighting on this part of my hyprland.conf
device:tpps/2-elan-trackpoint {
accel_profile = flat
}
It seems to be related to the fact that the name of my device includes a slash, as removing it makes the highlighting show up (obviously now the config doesn't work)
Similarly, it seems the highlighting also does not work if the device name begins with a number.
Right now commentstring
is not set, thus preventing automatic commenting (e.g. comment.nvim) from working.
Example:
Or in lua as:
vim.bo.commentstring = "# %s"
Hi,
i installed the grammar and thought everything was working. Looking into the plugin, the grammar registration is missing and only the filetype handling is given. Thus, after the plugin is installed i must register the parser by hand.
Was there a reason to not include the parser_config extension?
Kind regards
Alexander
.config/hypr on master [✘!+?]
❯ tree
.
├── hyprland.conf
├── hyprpaper.conf
└── scripts
└── scratchpads
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/nix/store/i9pwb2zpdz1r5dfv8ldfckzj129zwf32-neovim-unwrapped-0.9.1/share/nvim
"
tree-sitter --version
)No response
The bug lies in defining a variable in Treesitter where placing another variable or just having a comma in a variable definition results in the parser not parsing correctly.
Expected Behavior for me would be to allow ',' in variables (allow it as part of the variable value) or maybe add params
to the _value
for a variable.
$notify=notify-send
# $mirror=hyprctl keyword monitor $($notify "Select Mirror" && $select),preferred,auto,1,mirror,$($notify "Select Host" && $select)
$mirror_changed=hyprctl keyword monitor (notify-send "Select Mirror" && test),preferred,auto,1,mirror,(notify-send "Select Host" && test)
$hyprconf=$home/.config
In readme we have a suggestion to use
vim.filetype.add({
pattern = { [".*/hyprland%.conf"] = "hyprlang" },
})
to automate config file detection.
Is there a reason that's not a default?
Include detection by default with the plugin. It's something everyone would need to set up anyway.
Considering that Hyprland supports multiple config files via source, it makes more sense to use
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})
No response
tree-sitter --version
)No response
Unable to install the parser using nvim-treesitter.
Following the README.md
file of this repo it states
You can install the hyprlang parser in neovim using nvim-treesitter and use the following code snippet for automatic filetype detection
So I paste the snippet for automatic filetype detection to my neovim config and try to install the parser via :TSInstall
command
It does not work. So I add this repo as a plugin to my neovim config but nothing happens. So againg (whit this repo as plugin added to my config) I issue again :TSInstall hyprlang
but it doesn't work.
Fortunately I remembered a old version of this plugin that had a snippet for manual parser configuration and try to add that snippet (of course with the relevant modifications to repo URL).
So I added this repo as a plugin to my neovim config, configured the automatic filetype detection and issued again :TSInstall hyprlang
and it just worked.
Maybe you should add these steps to your README.md
file? Just to make simple for new users to install this parser.
:TSInstall hyprlang
in neovimBased on what the README states the parser should be installed automatically
No response
No, Not related to a problem
The hyprland logo looks nice, but it is not shown in any other file.
e.g if I source my keymaps.conf file from hypr
dir. or for hyprlock/hypridle
in general.
No response
No response
No license is given for hyperlang
Add an MIT license
No response
No response
tree-sitter --version
)tree-sitter 0.22.6
Copied from the config here: https://wiki.hyprland.org/Configuring/Monitors/
monitor=eDP-1, 2256x1504@60, 0x0, auto
does not parse properly
I get a similar error on lines like these:
bindl=...,switch:off:[switch name],exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1"
params is parsed as strings (or some other type)
tree-sitter generate
echo 'monitor=eDP-1, 2256x1504@60, 0x0, auto' >conf
tree-sitter parse conf
(configuration [0, 0] - [1, 0]
(keyword [0, 0] - [1, 0]
(name [0, 0] - [0, 7])
(params [0, 8] - [0, 38]
(string [0, 8] - [0, 13])
(ERROR [0, 14] - [0, 19])
(string [0, 19] - [0, 27])
(ERROR [0, 28] - [0, 31])
(number [0, 31] - [0, 32])
(string [0, 33] - [0, 38]))))
tree-sitter --version
)No response
my current config is:
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
lazy = true,
event = { "UIEnter" },
version = false,
dependencies = {
-- ...
{
"JoosepAlviste/nvim-ts-context-commentstring",
lazy = true,
},
-- ...
},
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
init = function(plugin)
require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates")
end,
config = function()
local treesitter_status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
if not treesitter_status_ok then
print("treesitter not found!")
end
vim.g.skip_ts_context_commentstring_module = true
require("ts_context_commentstring").setup({
enable_autocmd = false,
languages = {
hyprlang = "# %s",
},
})
require("nvim-treesitter.install").prefer_git = true
---@diagnostic disable-next-line: missing-fields
treesitter.setup({
ensure_installed = {
-- ...
"hyprlang",
-- ...
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
})
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})
end,
}
but it still doesnt work
note that im in ~/.config/hypr
, nvim ~/.config/hypr/hyprland.conf
from another directory doesnt work anyway
it should work
No response
Problem: Cannot install from archive on Windows due to symlinks (usr/bin/python3
, which doesn't even look like it should be tracked in the repo?), which are not supported on Windows (outside admin/developer mode).
Remove symlinks.
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.