-
Notifications
You must be signed in to change notification settings - Fork 1
Editor Setup
Install the server first — either grab a prebuilt binary from the
releases page
(Linux/macOS tarballs and Windows zips, x86_64 and aarch64/arm64), or cargo build --release and put
target/release/opensips-lsp on PATH.
All examples pass the same three initializationOptions documented
in docs/ADMIN.md.
Novice? Use the Getting Started guide instead — one-command install and full usage walkthrough. The notes below are for building the extension from source.
Use the bundled extension in client/:
cd client && npm install && npm run compile
npx @vscode/vsce package # produces opensips-lsp-ext-<version>.vsix
code --install-extension opensips-lsp-ext-*.vsixSettings: opensipsLsp.serverPath, opensipsLsp.opensipsPath,
opensipsLsp.opensipsSrc, opensipsLsp.checkTimeoutMs.
vim.filetype.add({ filename = { ["opensips.cfg"] = "opensips-cfg" } })
vim.api.nvim_create_autocmd("FileType", {
pattern = "opensips-cfg",
callback = function()
vim.lsp.start({
name = "opensips-lsp",
cmd = { "opensips-lsp" },
init_options = {
opensipsPath = "/usr/local/sbin/opensips",
opensipsSrc = "/path/to/opensips",
checkTimeoutMs = 10000,
},
})
end,
})~/.config/helix/languages.toml:
[language-server.opensips-lsp]
command = "opensips-lsp"
[language-server.opensips-lsp.config]
opensipsPath = "/usr/local/sbin/opensips"
opensipsSrc = "/path/to/opensips"
[[language]]
name = "opensips-cfg"
scope = "source.opensips"
file-types = [{ glob = "opensips.cfg" }, "cfg"]
comment-token = "#"
language-servers = ["opensips-lsp"](define-derived-mode opensips-cfg-mode prog-mode "OpenSIPS-cfg"
(setq-local comment-start "# "))
(add-to-list 'auto-mode-alist '("opensips\\.cfg\\'" . opensips-cfg-mode))
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
`(opensips-cfg-mode
. ("opensips-lsp"
:initializationOptions
(:opensipsPath "/usr/local/sbin/opensips"
:opensipsSrc "/path/to/opensips"
:checkTimeoutMs 10000)))))if executable('opensips-lsp')
au User lsp_setup call lsp#register_server({
\ 'name': 'opensips-lsp',
\ 'cmd': {server_info->['opensips-lsp']},
\ 'initialization_options': {
\ 'opensipsPath': '/usr/local/sbin/opensips',
\ 'opensipsSrc': '/path/to/opensips'},
\ 'allowlist': ['opensips-cfg'],
\ })
endif
au BufRead,BufNewFile opensips.cfg setfiletype opensips-cfgPreferences → Package Settings → LSP → Settings:
{
"clients": {
"opensips-lsp": {
"enabled": true,
"command": ["opensips-lsp"],
"selector": "source.opensips",
"initializationOptions": {
"opensipsPath": "/usr/local/sbin/opensips",
"opensipsSrc": "/path/to/opensips"
}
}
}
}Settings → Configure Kate → LSP Client → User Server Settings:
{
"servers": {
"opensips-cfg": {
"command": ["opensips-lsp"],
"highlightingModeRegex": "^INI Files$",
"initializationOptions": {
"opensipsPath": "/usr/local/sbin/opensips",
"opensipsSrc": "/path/to/opensips"
}
}
}
}Clients that cannot pass initializationOptions can export:
export OPENSIPS_LSP_BIN=/usr/local/sbin/opensips
export OPENSIPS_LSP_SRC=/path/to/opensips
export OPENSIPS_LSP_CHECK_TIMEOUT_MS=10000Generated from the repository docs — edit docs/ in the repo, not the wiki.