liuchengxu/vim-clap

Error when enabling tree-sitter highlight for python

gcanat opened this issue · 2 comments

gcanat commented

First, thank you for your awesome work. This plugin is godsend !

Environment (please complete the following information):

  • OS: linux
  • vim-clap version: commit bc20e9ff9d4a289dc82c868910e82d0331a426c7
  • Have you reproduced with a minimal vimrc: yes
  • Have you updated to the latest plugin version: yes
  • Have you upgraded to/compiled the latest Rust binary: yes

Describe the bug
Error when enabling tree-sitter highlight for python

Clap debug

                  Vim: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 22 2023 21:16:40) Included patches: 1-2121                                                                                                  
            has ctags: ctags not found                                                                                                                                                                              
            has cargo: 1                                                                                                                                                                                            
            has maple: /home/***/.vim/plugged/vim-clap/target/release/maple                                                                                                                                         
           maple info: version 0.1.49 (git v0.49-2-gbc20e9f), compiled at: 2023-11-26 09:35:59.742400468 +01:00, built for x86_64-unknown-linux-gnu by rustc 1.74.0 (79e9716c9 2023-11-13) (Arch Linux rust 1:1.74.0
-1).                                                                                                                                                                                                                
        rustc version: rustc 1.74.0 (79e9716c9 2023-11-13) (Arch Linux rust 1:1.74.0-1)                                                                                                                             
     Current FileType: python                                                                                                                                                                                       
Third Party Providers: []                                                                                                                                                                                           
       Global Options:                                                                                                                                                                                              
    let g:clap#autoload_dir = '/home/***/.vim/plugged/vim-clap/autoload'                                                                                                                                            
    let g:clap#provider_alias = {'gfiles': 'git_files', 'hist:': 'command_history', 'hist/': 'search_history'}                                                                                                      
    let g:clap_actions = ['list-plugins', 'open-config', 'syntax/sublime-syntax-highlight', 'syntax/sublime-syntax-list-themes', 'syntax/toggle', 'syntax/tree-sitter-highlight', 'syntax/tree-sitter-highlight-disa
ble', 'syntax/tree-sitter-list-scopes', 'syntax/tree-sitter-props-at-cursor']                                                                                                                                       
    let g:clap_background_shadow_blend = 50                                                                                                                                                                         
    let g:clap_disable_bottom_top = 0                                                                                                                                                                               
    let g:clap_disable_matches_indicator = v:false                                                                                                                                                                  
    let g:clap_disable_run_rooter = v:false                                                                                                                                                                         
    let g:clap_enable_background_shadow = v:false                                                                                                                                                                   
    let g:clap_enable_debug = v:false                                                                                                                                                                               
    let g:clap_enable_icon = 0                                                                                                                                                                                      
    let g:clap_forerunner_status_sign = {'done': '•', 'running': '!', 'using_cache': '*'}                                                                                                                           
    let g:clap_insert_mode_only = v:false                                                                                                                                                                           
    let g:clap_multi_selection_warning_silent = 0                                                                                                                                                                   
    let g:clap_no_matches_msg = 'NO MATCHES FOUND'                                                                                                                                                                  
    let g:clap_open_action = {'ctrl-v': 'vsplit', 'ctrl-x': 'split', 'ctrl-t': 'tab split'}                                                                                                                         
    let g:clap_open_preview = 'always'                                                                                                                                                                              
    let g:clap_plugin_experimental = v:true                                                                                                                                                                         
    let g:clap_popup_border = 'rounded'                                                                                                                                                                             
    let g:clap_popup_input_delay = 50                                                                                                                                                                               
    let g:clap_preview = {'scrollbar': {'fill_char': '▌'}}                                                                                                                                                          
    let g:clap_preview_direction = 'AUTO'                                                                                                                                                                           
    let g:clap_preview_size = 5                                                                                                                                                                                     
    let g:clap_providers_relaunch_code = '@@'                                                                                                                                                                       
    let g:clap_search_box_border_style = 'nil'                                                                                                                                                                      
    let g:clap_search_box_border_symbols = {'nil': ['', ''], 'curve': ['', ''], 'arrow': ['', '']}                                                                                                              
    let g:clap_theme = 'material_design_dark'                                                                                                                                                                       
  Provider Variables:                                                                                                                                                                                               
    let g:clap_provider_clap_actions = {'source': function('<lambda>1'), 'mode': 'quick_pick', 'sink': function('<lambda>2')}                                                                                       
    let g:clap_provider_live_grep_delay = 100                                                     

To Reproduce

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=/path/to/vim-clap
syntax on
filetype plugin indent on
let g:clap_plugin_experimental = v:true
  1. Start (neo)vim with command: vim -u min.vim

  2. Type :e /some/python/file.py and do :ClapAction syntax/tree-sitter-highlight

  3. Error

vim-clap: Vim(echoerr):[clap#api#call] method: clap#highlighter#add_ts_highlights, args: [1, [], [[0, [[0, 6, 'Keyword'], [7, 5, 'Variable'], [13, 2, 'Keyword'], [16, 2, 'Variable']]], [1, [[0, 6, 'Keyword'], [7,
 6, 'Variable'], [14, 2, 'Keyword'], [17, 2, 'Variable']]], [2, [[0, 6, 'Keyword'], [7, 10, 'Variable'], [18, 6, 'Variable'], [25, 2, 'Keyword'], [28, 3, 'Variable']]], [3, [[0, 4, 'Keyword'], [5, 7, 'Variable'],
 [13, 12, 'Variable'], [26, 6, 'Keyword'], [33, 18, 'Function']]], [4, [[0, 4, 'Keyword'], [5, 7, 'Variable'], [13, 7, 'Variable'], [21, 6, 'Keyword'], [28, 14, 'Variable']]], [6, [[0, 2, 'Variable'], [3, 1, 'Ope
rator'], [5, 18, 'Function'], [24, 6, 'Variable'], [30, 1, 'Operator'], [31, 1, 'Operator'], [32, 1, 'Number']]], [7, [[0, 1, 'Function'], [2, 1, 'Operator'], [4, 2, 'Variable'], [7, 6, 'Variable'], [14, 5, 'Func
tion'], [20, 3, 'Number'], [25, 2, 'Number']]], [8, [[0, 1, 'Variable'], [2, 1, 'Operator'], [4, 2, 'Variable'], [7, 6, 'Variable'], [14, 7, 'Function'], [22, 1, 'Number'], [25, 1, 'Number'], [28, 3, 'Number']]],
 [9, [[0, 2, 'Variable'], [3, 3, 'Function'], [7, 1, 'Function'], [10, 1, 'Variable']]], [11, [[0, 6, 'Variable'], [7, 1, 'Operator'], [9, 2, 'Variable'], [12, 7, 'Function'], [20, 1, 'Function']]], [12, [[0, 3, 
'Variable'], [4, 1, 'Operator'], [6, 14, 'Function'], [21, 1, 'Variable'], [24, 6, 'Variable']]]]], exception: Vim(call):E970: Unknown highlight group name: 'Variable', throwpoint:function <SNR>12_out_cb[6]..clap
#client#handle[12]..clap#api#call, line 10

Expected behavior
Highlighting syntax of the python file with tree-sitter.

Additional context
Works fine with rust files.

Fixed in the latest commit, you have to recompile the binary locally. The alternative fix without recompiling the binary is to define the highlight group Variable in vimrc, e.g.,

hi link Variable Identifier
gcanat commented

Works perfectly, thanks alot!