Git Product home page Git Product logo

matchparen.nvim's People

Contributors

lokaltog avatar monkoose avatar ngpong 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

lokaltog ngpong

matchparen.nvim's Issues

Occasional error when I use LSP reformat the buffer.

After reformatting a file with vim.lsp.buf.format{async=true} I get the error below. This occurs in Clojure file, if that matters. Then if I reformat again immediately, the error does not happen. But after a while, if I reformat, then the error occurs again.

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...rko/nvim/share/nvim/runtime/lua/vim/treesitter/query.lua:422: bad argument #2 to 'handler' (string expected, got nil)
stack traceback:
        [C]: in function 'handler'
        ...rko/nvim/share/nvim/runtime/lua/vim/treesitter/query.lua:422: in function 'match_preds'
        ...rko/nvim/share/nvim/runtime/lua/vim/treesitter/query.lua:508: in function '(for generator)'
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:45: in function 'cache_nodes'
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:59: in function 'get_skip_node'
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:158: in function 'skip_by_region'
        ...k/packer/start/matchparen.nvim/lua/matchparen/search.lua:162: in function 'match_pos'
        ...acker/start/matchparen.nvim/lua/matchparen/highlight.lua:108: in function 'update'
        ...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:63: in function <...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:63>

Issue when starting with multiple file arguments

When starting up neovim with multiple arguments (and with on_startup set to true), e.g. nvim file1 file2, I get this error:

Error detected while processing CursorMoved Autocommands for "*":
E5108: Error executing lua ....vim/bundle/matchparen.nvim/lua/matchparen/highlight.lua:59: attempt to index field 'matchpairs' (a nil value)
stack traceback:
        ....vim/bundle/matchparen.nvim/lua/matchparen/highlight.lua:59: in function 'update'
        [string ":lua"]:1: in main chunk

It seems like the update() function is getting executed before conf.matchpairs is defined. I've tried two fixes for this locally. One is to add a check for matchpairs existing before executing update()

diff --git i/lua/matchparen/highlight.lua w/lua/matchparen/highlight.lua
index abc6b7f..474deb1 100644
--- i/lua/matchparen/highlight.lua
+++ w/lua/matchparen/highlight.lua
@@ -33,6 +33,7 @@ end
 -- and then if there is matching brackets pair at the new cursor position highlight them
 function M.update(in_insert)
     M.remove()
+    if not conf.matchpairs then return end
 
     vim.g.matchparen_tick = vim.api.nvim_buf_get_changedtick(0)
     local line, col = utils.get_current_pos()

Since this plugin is so performance sensitive I'm a bit wary of adding any code to the update function, although checking if a key exists in a table should only take a fraction of a millisecond.

The other fix is a simple workaround of setting on_startup to false, and then calling MatchParenEnable on a VimEnter autocmd. I suppose this autocmd could conditionally be added in create_autocmds() if on_startup is true, which should also work. Not sure which approach you'd prefer so not opening a PR, but happy to do that if you want to go down any of those routes.

Error on terraform files

While scrolling through terraform file I get following error:

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...5efc2/share/nvim/runtime/lua/vim/treesitter/language.lua:25: no parser for 'terraform' language, see :help treesitter-parsers
stack traceback:
        [C]: in function 'error'
        ...5efc2/share/nvim/runtime/lua/vim/treesitter/language.lua:25: in function 'require_language'
        ...m/HEAD-a75efc2/share/nvim/runtime/lua/vim/treesitter.lua:39: in function '_create_parser'
        ...m/HEAD-a75efc2/share/nvim/runtime/lua/vim/treesitter.lua:94: in function 'get_parser'
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:119: in function 'get_tree_root'
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:191: in function 'skip_by_region'
        ...k/packer/start/matchparen.nvim/lua/matchparen/search.lua:162: in function 'match_pos'
        ...acker/start/matchparen.nvim/lua/matchparen/highlight.lua:99: in function 'update'
        ...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60: in function <...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60>

I do have hcl parser installed (there is no terraform parser).

matchparen.nvim version: 308dfed
Neovim: NVIM v0.8.0-dev+1517-ga75efc237

Loop or previous error loading matchparen

I installed matchparen exactly as the readme states, however in the config file when I require('matchparen') neovim throws an error. I made sure to set:
vim.g.loaded_matchparen = 1 so I am at a bit of a loss as to what to do here.

I am on the latest neovim nightly/maybe a little ahead since I built from source from git.

Edit: Tried it from a standard nightly build from a few days ago I had installed but aliased. Still doesn't work :(

Error: attempt to index a nil value

Error executing Lua callback: .../packer/opt/matchparen.nvim/lua/matchparen/highlight.lua:47: attempt to index a nil value
stack traceback:
        .../packer/opt/matchparen.nvim/lua/matchparen/highlight.lua:47: in function 'highlight_brackets'
        .../packer/opt/matchparen.nvim/lua/matchparen/highlight.lua:101: in function 'update'
        .../site/pack/packer/opt/matchparen.nvim/lua/matchparen.lua:86: in function <.../site/pack/packer/opt/matchparen.nvim/lua/matchparen.lua:83>
use { 'monkoose/matchparen.nvim',
      opt = true,
      ft = {
        'lua',
        'js', 'javascript',
        'ts', 'typescript',
        'html', 'njk', 'ejs', 'jinja',
        'fish', 'bash', 'sh',
        'json',
      },
      config = function()
        require'matchparen'.setup {
          on_startup = false,
          hl_group = 'MatchParen',
        }
      end }
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@BigSur

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.7.0/share/nvim"

Run :checkhealth for more info

bug in the recent update

Got this error message:
Error in packer_compiled: .../packer/start/matchparen.nvim/lua/matchparen/options.lua:32: bad argument #1 to 'pairs' (table expected , got nil) Please check your config for correctness

Could you fix it?

ps: related configuration:

use {
        'monkoose/matchparen.nvim',
        config = [[require('matchparen').setup()]],
}

Attempt to compare number with nil.

example

test.py

print("{([(})])}")

reproduce

  1. open exists test.py file and when the cursor crosses you will see this error:
    image
    note that if you open a empty file and write those matching paren with delimitMate or some other plugins, then you delete some character to let those paren not matching, in that case you can't see this bug.

misc

nvim version:NVIM v0.7.0-dev+839-g09d270bcea
matchparen.nvim conf: default
treesitter: installed python
This bug appears after lastest refactor so I guess you introduce some broken.

Error: `is_in_node_range` nil value

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:36: attempt to call field 'is_in_node_range' (a nil value)
stack traceback:
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:36: in function 'get_skip_node'
        ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:130: in function 'skip_by_region'
        ...k/packer/start/matchparen.nvim/lua/matchparen/search.lua:159: in function 'match_pos'
        ...acker/start/matchparen.nvim/lua/matchparen/highlight.lua:72: in function 'update'
        ...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60: in function <...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60>
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

default MatchParen is active

I get error that default MatchParen is active- even though, if I understand this correctly, I have set: vim.g.loaded_matchparen = 1 - which should disable default matchParent right?

  use {
    "monkoose/matchparen.nvim",
    disable = false, -- what idt does? - faster highlight (), [], & {} compared to vim builtin matchparen
    config = function()
      vim.g.loaded_matchparen = 1
      require("matchparen").setup()
    end,
  }

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.