Giter Site home page Giter Site logo

Comments (8)

HiPhish avatar HiPhish commented on July 3, 2024 1

You are right, the question mark was an oversight. I have corrected it now.

from rainbow-delimiters.nvim.

jczhang02 avatar jczhang02 commented on July 3, 2024

Using gentoo and compile neovim with USE flags LUA_SINGLE_TARGET="luajit

from rainbow-delimiters.nvim.

Danielkonge avatar Danielkonge commented on July 3, 2024

Based on the error it seems that this issue is caused by the nvim_buf_call added to strategy in the last commit, so for now you can probably go back one commits to get around this problem.

I can reproduce the error by setting up the (default) strategy via a function instead of setting it up immediately.

An easy fix for now is to not use nvim_buf_call for strategy (like it was before).

@HiPhish: If you switch to a setup where the functions can accept an optional bufnr, you should probably double check setting up the strategy via a function, since it has a different behavior in the current version compared to query and priority (both of those work fine with functions for me). I haven't really looked into this, but I can't immediately tell what causes this difference.

from rainbow-delimiters.nvim.

HiPhish avatar HiPhish commented on July 3, 2024

This is really weird because it works for the query. I can confirm that it is broken for strategies though, but only if using nvim_buf_call. I will switch to a function that uses an optional bufnr argument. The error is really weird, I don't understand why it is happening. It looks like returning a table that has function values is where things break. Here is a minimal example which replicates the error:

vim.api.nvim_buf_call(0, function() return {a = function() return 'x' end} end)

@jczhang02 Pleas revert one commit back for the time being. I will fix this shortly.

from rainbow-delimiters.nvim.

Danielkonge avatar Danielkonge commented on July 3, 2024

This is really weird because it works for the query. I can confirm that it is broken for strategies though, but only if using nvim_buf_call. I will switch to a function that uses an optional bufnr argument. The error is really weird, I don't understand why it is happening. It looks like returning a table that has function values is where things break.

Apparently this is a known limitation (that nvim_buf_call cannot contain functions in the return value), since quote:
"nvim_buf_call is within the general Nvim API which adheres to msgpack and thus cannot return function values."

See neovim/neovim#26531 (comment).

from rainbow-delimiters.nvim.

HiPhish avatar HiPhish commented on July 3, 2024

Please try the current master branch now, it should be fixed. The configuration function can now take the current buffer number as an argument if you want to.

from rainbow-delimiters.nvim.

Danielkonge avatar Danielkonge commented on July 3, 2024

Please try the current master branch now, it should be fixed. The configuration function can now take the current buffer number as an argument if you want to.

It works as I would expect (and LuaLS doesn't even complain about functions of the form function() return ... end which I thought it would with the given type annotations).

I have one note/question: In lib.lua line 71, we have ---@param bufnr integer? Use this buffer as the current buffer, but can bufnr ever be nil? By the type annotations of the query, we expect a function that takes a non-nil bufnr.

from rainbow-delimiters.nvim.

HiPhish avatar HiPhish commented on July 3, 2024

Closing this as done.

from rainbow-delimiters.nvim.

Related Issues (20)

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.