IDE Integration

xgrep in Other Editors (LSP)

Connect Neovim, Vim, Helix, Emacs, Sublime Text, JetBrains, and any LSP-capable editor to xgrep's Language Server.

xgrep in Other Editors (LSP)

Every editor other than VS Code connects to xgrep through its built-in Language Server Protocol server — the single integration point for Neovim, Vim, Helix, Emacs, Sublime Text, JetBrains IDEs, and any other LSP-capable editor:

xgrep lsp                  # built-in rules (security + secrets categories)
xgrep -f rules/ lsp        # a custom rule pack instead

The server communicates over stdio. Without -f it runs the embedded rule corpus filtered to security,secrets, the same out-of-the-box default as xgrep scan. For what the server provides once connected — live diagnostics, quickfixes, and workspace scans — see the IDE overview.

Editor setup

Neovim (0.11+)

vim.lsp.config('xgrep', {
  cmd = { 'xgrep', 'lsp' },
  filetypes = {
    'python', 'go', 'java', 'javascript', 'typescript', 'typescriptreact',
    'ruby', 'rust', 'c', 'cpp', 'php', 'kotlin', 'cs', 'scala', 'sh',
  },
  root_markers = { '.git' },
})
vim.lsp.enable('xgrep')

Trigger project-wide or changed-files scans with user commands:

vim.api.nvim_create_user_command('XgrepScanWorkspace', function()
  vim.lsp.buf_request(0, 'workspace/executeCommand',
    { command = 'xgrep.scanWorkspace' })
end, {})
vim.api.nvim_create_user_command('XgrepScanChanged', function()
  vim.lsp.buf_request(0, 'workspace/executeCommand',
    { command = 'xgrep.scanChanged' })
end, {})

Vim (vim-lsp)

if executable('xgrep')
  au User lsp_setup call lsp#register_server({
        \ 'name': 'xgrep',
        \ 'cmd': {server_info->['xgrep', 'lsp']},
        \ 'allowlist': ['python', 'go', 'java', 'javascript', 'typescript', 'ruby'],
        \ })
endif

Kakoune (kakoune-lsp)

[language_server.xgrep]
command = "xgrep"
args = ["lsp"]
filetypes = ["python", "go", "java", "javascript", "typescript", "ruby"]
root_globs = [".git"]

Helix

In ~/.config/helix/languages.toml, define the server and add it to the languages you want scanned (it runs alongside the primary server):

[language-server.xgrep]
command = "xgrep"
args = ["lsp"]

[[language]]
name = "python"
language-servers = ["pyright", "xgrep"]

Emacs (lsp-mode)

lsp-mode runs xgrep as an add-on server next to the main one:

(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection '("xgrep" "lsp"))
  :activation-fn (lsp-activate-on "python" "go" "java" "javascript" "typescript")
  :add-on? t
  :server-id 'xgrep))

(eglot supports only one server per buffer, so prefer lsp-mode for running xgrep alongside a language server.)

Sublime Text (LSP package)

In the LSP package settings:

{
  "clients": {
    "xgrep": {
      "enabled": true,
      "command": ["xgrep", "lsp"],
      "selector": "source.python | source.go | source.java | source.js | source.ts"
    }
  }
}

JetBrains IDEs

Use the LSP4IJ plugin and add a server definition with command xgrep lsp, mapped to the languages you want scanned.

Zed

Zed configures language servers through extensions; there is no xgrep extension yet.

Any other LSP client

Any generic LSP-client extension that can spawn a stdio server works with command xgrep lsp.

On this page