Giter Club home page Giter Club logo

tree-sitter-hyprlang's People

Contributors

aserowy avatar clason avatar luckasranarison avatar matt1432 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aserowy korigamik

tree-sitter-hyprlang's Issues

syntax highlighting issue on device categories starting with a number or including a slash (/)

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
}

image

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.

Incorrect highlighting when the device has a complex name

The touchpad has a weird device name with colons in between. When I remove them the highlighting works properly but not the configuration.
photo_2024-01-15_11-07-36

This shows the proper device name with hyprctl devices (first device in the list):
photo_2024-01-15_11-07-20

Highlighting after removing colons:
photo_2024-01-15_11-07-45
photo_2024-01-15_11-07-50

Initialization code missing in nvim plugin?

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

Shell script in hypr dir gets labeled as hypr filetype

.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
"

bug: Error on , and $variables in variable definition

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

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.

Screenshot-2024-03-17--12-29-29

Steps To Reproduce/Bad Parse Tree

  1. Add new variable in a hyprland config
  2. insert ',' and/or '$somevariable' in its definition

Expected Behavior/Parse Tree

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.

Repro

$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

feature: Detect filetype by default

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

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?

Describe the solution you'd like

Include detection by default with the plugin. It's something everyone would need to set up anyway.

Describe alternatives you've considered

Considering that Hyprland supports multiple config files via source, it makes more sense to use

vim.filetype.add({
    pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})

Additional context

No response

Unable to install parser

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

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.

Steps To Reproduce/Bad Parse Tree

  1. add automatic filetype detection to neovim config
  2. issue :TSInstall hyprlang in neovim

Expected Behavior/Parse Tree

Based on what the README states the parser should be installed automatically

Repro

No response

feature: List to specify the filename that user is sourcing

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

No, Not related to a problem

Describe the solution you'd like

image
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.

Describe alternatives you've considered

No response

Additional context

No response

feature: Add a license

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

No license is given for hyperlang

Describe the solution you'd like

Add an MIT license

Describe alternatives you've considered

No response

Additional context

No response

bug: monitor keyword params fails to parse

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.6

Describe the bug

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"

Steps To Reproduce/Bad Parse Tree

image

Expected Behavior/Parse Tree

params is parsed as strings (or some other type)

Repro

  • 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]))))

bug: Hyprland doesn't load (`:TSBufEnable`, `:TSToggle hyprland`, `:TSEnable highlight` do not work), commentstring also doesn't work

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

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

Steps To Reproduce/Bad Parse Tree

image

note that im in ~/.config/hypr, nvim ~/.config/hypr/hyprland.conf from another directory doesnt work anyway

Expected Behavior/Parse Tree

it should work

Repro

No response

Remove symlinks from repo

Did you check the tree-sitter docs?

Is your feature request related to a problem? Please describe.

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).

Describe the solution you'd like

Remove symlinks.

Describe alternatives you've considered

No response

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.