Code Monkey home page Code Monkey logo

Comments (4)

mechatroner avatar mechatroner commented on May 16, 2024

Hi, this looks strange, I tested your file and autodetection worked for me as expected.
BTW, you can try to set vim.g.rcsv_delimiters = [";", ","] it should be an array, not a dictionary.
Maybe you can also try to update rainbow_csv if you are using not the latest version.
Also, autodetection doesn't work if the number of lines is less than 5, but in the case of your file, it should be fine since it has exactly 5 lines.

from rainbow_csv.

jweckman avatar jweckman commented on May 16, 2024

Thanks for quick reply.
Sorry i forgot to mention that i configure global variables and most other things in lua, which is why the assignment looks strange (everything is a "table" in lua). Running :echo g:rcsv_delimiters returns [';', ',']. I tried with your specific suggestion and still same result on the test file and larger "real" ones. I also tried with a minimal config that only imports your plugin and sets the global but no luck.

Also using latest version of the plugin.

Do you think you could make a quick check using latest stable neovim? Should be very easy to install from here:
https://github.com/neovim/neovim/releases/tag/stable
If you are on linux you can simply download and execute the appimage.

This is the init.vim config i used:

" auto-install vim-plug
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

autocmd VimEnter * PlugInstall | source $MYVIMRC
endif

" Plug
call plug#begin('~/.vim/plugged')
Plug 'mechatroner/rainbow_csv'

call plug#end()

lua << EOF
vim.g.mapleader = " "
vim.opt.termguicolors = false
vim.g.rcsv_delimiters = {";", ","}
EOF

Alternatively it would be nice to have an explanation on how the autodetect works. To my eyes it looks like it does some kind of caching not to keep setting the type for the same file over and over. If my cache is somehow acting up it would be nice to know how it works.

from rainbow_csv.

mechatroner avatar mechatroner commented on May 16, 2024

Thanks, I might try to reproduce this when I have more time. If you want you can also try to debug this further by using "echo"/"echom"/"messages" commands inside the autodetection call stack.
The extension caches autodetection results in `~/.rbql_table_index' text file so you can also try to clean/remove the file or see if it contains suspicious entries and remove them.

from rainbow_csv.

jweckman avatar jweckman commented on May 16, 2024

I removed the rbql_table_index and found that its contents are set correctly for my file if i do it manually via RainbowDelim. What is very interesting is that even if the only file contents are as follows:
/home/joakim/ksjgsg.csv ; quoted @auto_comment_prefix@

The delimiter loading fails when i open the file. Even more interesting is that it DOES load correctly if i e.g. add this echoerr to the following location:

func! rainbow_csv#handle_syntax_change()
    let [delim, policy, comment_prefix] = rainbow_csv#get_current_dialect()
    echoerr 'delim:' .. delim

Then it prints the correct delimiter ";", stops executing certain code and highlighting works as expected. Looks to me like there is some code that resets the delimiter or makes the highlighting fail.

from rainbow_csv.

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.