Skip to content

when source is 'rg' it stop working on macvim but vim is fine #71

Open

Description

@ApolloTang

Not sure what happen, but Far stop working on MacVim when source is ripgrep.
Debug log shows that this line is different between vim and macvim:

macvim:

[21:15:51] invoke res:{'items': []}

vim:

[21:17:15] invoke res:{'items': [{'fname': 'test.txt', 'items': [{'lnum': 1, 'cnum': 1, 'text': 'a'}]}]}

Complete log for both case below:

Vim log

debug enabled!
[21:17:15] =============== FIND ================
[21:17:15] cmdline: a %
[21:17:15] far#find({'pattern': 'a', 'file_mask': '%', 'range': [-1, -1], 'replace_with': 'a'},['--result-preview=0'])
[21:17:15] assemble_context({'pattern': 'a', 'replace_with': 'a', 'range': [-1, -1], 'limit': 1000, 'file_mask': '%', 'cwd': '/Users/apollotang/Desktop/far-debug', 'source': 'rg'},{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:17:15] source: {'args': {'cmd': ['rg', '--no-heading', '--column', '--no-messages', '--max-count={limit}', '--smart-case', '--ignore-case', '--glob={file_mask}', '{pattern}'], 'fix_cnum': 'next', 'items_file_min': 30, 'expand_cmdargs': 1}, 'executor': 'py3', 'fn': 'far.sources.shell.search'}
[21:17:15] executor: far#executors#py3#execute
[21:17:15] s:param_proc()
[21:17:15] invoke cmd:['def far_rpc_invoker():', ' import far.sources.shell', ' return far.sources.shell.search({"pattern":"a","replace_with":"a","range":[-1,-1],"limit":1000,"file_mask":"test.txt","cwd":"/Users/apollotang/Desktop/far-debug","source":"rg"},{"cmd":["rg","--no-heading","--column","--no-messages","--max-count={limit}","--smart-case","--ignore-case","--glob={file_mask}","{pattern}"],"fix_cnum":"next","items_file_min":30,"expand_cmdargs":1},[])']
[21:17:15] farpy:search({'pattern': 'a', 'replace_with': 'a', 'range': [-1, -1], 'limit': 1000, 'file_mask': 'test.txt', 'cwd': '/Users/apollotang/Desktop/far-debug', 'source': 'rg'}, {'cmd': ['rg', '--no-heading', '--column', '--no-messages', '--max-count={limit}', '--smart-case', '--ignore-case', '--glob={file_mask}', '{pattern}'], 'fix_cnum': 'next', 'items_file_min': 30, 'expand_cmdargs': 1}, [])
[21:17:15] farpy:cmd:['rg', '--no-heading', '--column', '--no-messages', '--max-count=1000', '--smart-case', '--ignore-case', '--glob=test.txt', 'a']
[21:17:15] farpy:end of proc. break
[21:17:15] invoke res:{'items': [{'fname': 'test.txt', 'items': [{'lnum': 1, 'cnum': 1, 'text': 'a'}]}]}
[21:17:15] assemble_context_callback()
[21:17:15] open_far_buff({'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:17:15] new bufcmd: botright vertical 100 new FAR\ 1
[21:17:15] apply_default_mappings()
[21:17:15] update_far_buffer(2, 2)
[21:17:15] build_buffer_content(...,{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 60, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:17:15] content:
[21:17:15] Files:1  Matches:1  Time:0.090ms
[21:17:15] - test.tx/test.txt (1 matches)
[21:17:15]   1     a
[21:17:15] syntax:
[21:17:15] syn match FarNone ".*" contains=FarSearchVal,FarReplaceVal,FarItem
[21:17:15] syn match FarLineCol "^..\d*" contains=FarSearchVal,FarReplaceVal,FarItem
[21:17:15] syn region FarStatusLine start="\%1l^" end="$"
[21:17:15] syn region FarFilePath start="\%2l^.."hs=s+2 end=".\{16\}"
[21:17:15] syn region FarFileStats start="\%2l^.\{20\}"hs=e end="$" contains=FarFilePath keepend
[21:17:15] syn region FarItem matchgroup=FarSearchVal start="\%3l\%8c"rs=s+2,hs=s+1 matchgroup=FarReplaceVal end="" oneline
[21:17:15] resize timer started #5
[21:17:15] far#show_preview_window_under_cursor()
[21:17:17] resizing buf 2 to 59
[21:17:17] update_far_buffer(2, 2)
[21:17:17] build_buffer_content(...,{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 60, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:17:17] content:
[21:17:17] Files:1  Matches:1  Time:0.090ms
[21:17:17] - test.tx/test.txt (1 matches)
[21:17:17]   1     a
[21:17:17] syntax:
[21:17:17] syn match FarNone ".*" contains=FarSearchVal,FarReplaceVal,FarItem
[21:17:17] syn match FarLineCol "^..\d*" contains=FarSearchVal,FarReplaceVal,FarItem
[21:17:17] syn region FarStatusLine start="\%1l^" end="$"
[21:17:17] syn region FarFilePath start="\%2l^.."hs=s+2 end=".\{16\}"
[21:17:17] syn region FarFileStats start="\%2l^.\{20\}"hs=e end="$" contains=FarFilePath keepend
[21:17:17] syn region FarItem matchgroup=FarSearchVal start="\%3l\%8c"rs=s+2,hs=s+1 matchgroup=FarReplaceVal end="" oneline

MacVim log:

debug enabled!
[21:15:50] =============== FIND ================
[21:15:50] cmdline: a %
[21:15:50] far#find({'pattern': 'a', 'file_mask': '%', 'range': [-1, -1], 'replace_with': 'a'},['--result-preview=0'])
[21:15:50] assemble_context({'pattern': 'a', 'replace_with': 'a', 'range': [-1, -1], 'limit': 1000, 'file_mask': '%', 'cwd': '/Users/apollotang/Desktop/far-debug', 'source': 'rg'},{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:15:50] source: {'args': {'cmd': ['rg', '--no-heading', '--column', '--no-messages', '--max-count={limit}', '--smart-case', '--ignore-case', '--glob={file_mask}', '{pattern}'], 'fix_cnum': 'next', 'items_file_min': 30, 'expand_cmdargs': 1}, 'executor': 'py3', 'fn': 'far.sources.shell.search'}
[21:15:50] executor: far#executors#py3#execute
[21:15:51] s:param_proc()
[21:15:51] invoke cmd:['def far_rpc_invoker():', ' import far.sources.shell', ' return far.sources.shell.search({"pattern":"a","replace_with":"a","range":[-1,-1],"limit":1000,"file_mask":"test.txt","cwd":"/Users/apollotang/Desktop/far-debug","source":"rg"},{"cmd":["rg","--no-heading","--column","--no-messages","--max-count={limit}","--smart-case","--ignore-case","--glob={file_mask}","{pattern}"],"fix_cnum":"next","items_file_min":30,"expand_cmdargs":1},[])']
[21:15:51] farpy:search({'pattern': 'a', 'replace_with': 'a', 'range': [-1, -1], 'limit': 1000, 'file_mask': 'test.txt', 'cwd': '/Users/apollotang/Desktop/far-debug', 'source': 'rg'}, {'cmd': ['rg', '--no-heading', '--column', '--no-messages', '--max-count={limit}', '--smart-case', '--ignore-case', '--glob={file_mask}', '{pattern}'], 'fix_cnum': 'next', 'items_file_min': 30, 'expand_cmdargs': 1}, [])
[21:15:51] farpy:cmd:['rg', '--no-heading', '--column', '--no-messages', '--max-count=1000', '--smart-case', '--ignore-case', '--glob=test.txt', 'a']
[21:15:51] farpy:end of proc. break
[21:15:51] invoke res:{'items': []}
[21:15:51] assemble_context_callback()
[21:15:51] open_far_buff({'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:15:51] new bufcmd: botright vertical 100 new FAR\ 1
[21:15:51] apply_default_mappings()
[21:15:51] update_far_buffer(2, 2)
[21:15:51] build_buffer_content(...,{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
[21:15:51] content:
[21:15:51] Files:0  Matches:0  Time:0.090ms
[21:15:51] syntax:
[21:15:51] syn match FarNone ".*" contains=FarSearchVal,FarReplaceVal,FarItem
[21:15:51] syn match FarLineCol "^..\d*" contains=FarSearchVal,FarReplaceVal,FarItem
[21:15:51] syn region FarStatusLine start="\%1l^" end="$"
[21:15:51] resize timer started #6
[21:15:51] far#show_preview_window_under_cursor()

Activity

  1. ApolloTang commented on Apr 16, 2019

    @ApolloTang
    Author

    for your reference Macvim and vim both work when source is vimgrep the only line different is time:

    MacVim:

    [21:28:59] Files:1  Matches:1  Time:0.021ms
    

    vim:

    [21:29:35] Files:1  Matches:1  Time:0.030ms
    

    Complete log for both case:

    macvim:

    debug enabled!
    [21:28:58] =============== FIND ================
    [21:28:58] cmdline: a %
    [21:28:58] far#find({'pattern': 'a', 'file_mask': '%', 'range': [-1, -1], 'replace_with': 'a'},['--result-preview=0'])
    [21:28:58] assemble_context({'pattern': 'a', 'replace_with': 'a', 'range': [-1, -1], 'limit': 1000, 'file_mask': '%', 'cwd': '/Users/apollotang/Desktop/far-debug', 'source': 'vimgrep'},{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
    [21:28:58] source: {'args': {'cmd': 'silent! {limit}vimgrep! /{pattern}/gj {file_mask}', 'escape_pattern': '/'}, 'executor': 'vim', 'fn': 'far#sources#qf#search'}
    [21:28:58] executor: far#executors#basic#execute
    [21:28:58] s:param_proc()
    [21:28:58] qf.search(a,test.txt,{'cmd': 'silent! {limit}vimgrep! /{pattern}/gj {file_mask}', 'escape_pattern': '/'},[])
    [21:28:58] qfcmd: silent! 1000vimgrep! /a/gj test.txt
    [21:28:58] assemble_context_callback()
    [21:28:58] open_far_buff({'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
    [21:28:58] new bufcmd: botright vertical 100 new FAR\ 1
    [21:28:59] apply_default_mappings()
    [21:28:59] update_far_buffer(2, 2)
    [21:28:59] build_buffer_content(...,{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
    [21:28:59] content:
    [21:28:59] Files:1  Matches:1  Time:0.021ms
    [21:28:59] - test.tx/test.txt (1 matches)
    [21:28:59]   1     a
    [21:28:59] syntax:
    [21:28:59] syn match FarNone ".*" contains=FarSearchVal,FarReplaceVal,FarItem
    [21:28:59] syn match FarLineCol "^..\d*" contains=FarSearchVal,FarReplaceVal,FarItem
    [21:28:59] syn region FarStatusLine start="\%1l^" end="$"
    [21:28:59] syn region FarFilePath start="\%2l^.."hs=s+2 end=".\{16\}"
    [21:28:59] syn region FarFileStats start="\%2l^.\{20\}"hs=e end="$" contains=FarFilePath keepend
    [21:28:59] syn region FarItem matchgroup=FarSearchVal start="\%3l\%8c"rs=s+2,hs=s+1 matchgroup=FarReplaceVal end="" oneline
    [21:28:59] resize timer started #6
    [21:28:59] far#show_preview_window_under_cursor()
    

    Vim:

    debug enabled!
    [21:29:35] =============== FIND ================
    [21:29:35] cmdline: a %
    [21:29:35] far#find({'pattern': 'a', 'file_mask': '%', 'range': [-1, -1], 'replace_with': 'a'},['--result-preview=0'])
    [21:29:35] assemble_context({'pattern': 'a', 'replace_with': 'a', 'range': [-1, -1], 'limit': 1000, 'file_mask': '%', 'cwd': '/Users/apollotang/Desktop/far-debug', 'source': 'vimgrep'},{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
    [21:29:35] source: {'args': {'cmd': 'silent! {limit}vimgrep! /{pattern}/gj {file_mask}', 'escape_pattern': '/'}, 'executor': 'vim', 'fn': 'far#sources#qf#search'}
    [21:29:35] executor: far#executors#basic#execute
    [21:29:35] s:param_proc()
    [21:29:35] qf.search(a,test.txt,{'cmd': 'silent! {limit}vimgrep! /{pattern}/gj {file_mask}', 'escape_pattern': '/'},[])
    [21:29:35] qfcmd: silent! 1000vimgrep! /a/gj test.txt
    [21:29:35] assemble_context_callback()
    [21:29:35] open_far_buff({'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 100, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
    [21:29:35] new bufcmd: botright vertical 100 new FAR\ 1
    [21:29:35] apply_default_mappings()
    [21:29:35] update_far_buffer(2, 2)
    [21:29:35] build_buffer_content(...,{'highlight_match': 1, 'preview_layout': 'bottom', 'result_preview': '0', 'preview_width': 100, 'layout': 'right', 'preview_height': 11, 'width': 60, 'height': 20, 'auto_preview': 1, 'collapse_result': 0})
    [21:29:35] content:
    [21:29:35] Files:1  Matches:1  Time:0.030ms
    [21:29:35] - test.tx/test.txt (1 matches)
    [21:29:35]   1     a
    [21:29:35] syntax:
    [21:29:35] syn match FarNone ".*" contains=FarSearchVal,FarReplaceVal,FarItem
    [21:29:35] syn match FarLineCol "^..\d*" contains=FarSearchVal,FarReplaceVal,FarItem
    [21:29:35] syn region FarStatusLine start="\%1l^" end="$"
    [21:29:35] syn region FarFilePath start="\%2l^.."hs=s+2 end=".\{16\}"
    [21:29:35] syn region FarFileStats start="\%2l^.\{20\}"hs=e end="$" contains=FarFilePath keepend
    [21:29:35] syn region FarItem matchgroup=FarSearchVal start="\%3l\%8c"rs=s+2,hs=s+1 matchgroup=FarReplaceVal end="" oneline
    [21:29:35] resize timer started #6
    [21:29:35] far#show_preview_window_under_cursor()
    
  2. brooth commented on May 25, 2019

    @brooth
    Owner

    Try to run this command (or change it accordingly) in your terminal to see the actual rg results:
    rg --no-heading --column --no-messages --max-count=1000 --smart-case --ignore-case --glob=test.txt a

  3. ApolloTang commented on May 26, 2019

    @ApolloTang
    Author

    Here is the result (screen shot):

    Screen Shot 2019-05-26 at 3 23 40 AM

  4. atomdmac commented on Aug 10, 2021

    @atomdmac

    @ApolloTang To clarify: is the issue that Far is returning 0 results when you use rg as your source? FWIW, I'm using Neovim with the rgnvim source and it returns search results but Fardo doesn't appear to do anything. Using the default source does allow Fardo to work, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions