Class: Mbeditor::CodeSearchService

Inherits:
Object
  • Object
show all
Defined in:
app/services/mbeditor/code_search_service.rb

Constant Summary collapse

JS_GLOBS =
%w[*.js *.jsx *.ts *.tsx *.js.jsx *.js.erb *.jsx.erb].freeze

Class Method Summary collapse

Class Method Details

.call(pattern, workspace_root, globs: JS_GLOBS) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'app/services/mbeditor/code_search_service.rb', line 10

def call(pattern, workspace_root, globs: JS_GLOBS)
  if SearchReplaceService::RG_AVAILABLE
    run_rg(pattern, workspace_root, globs)
  else
    run_grep(pattern, workspace_root, globs)
  end
rescue StandardError
  []
end