#tags #lsp #safety #tag-std #defined #relative-path #visual-studio-code

app safety-lsp

A lib for using safety tags defined in tag-std

1 unstable release

Uses new Rust 2024

0.4.0 Oct 9, 2025

#71 in Text editors

Download history 134/week @ 2025-10-04 44/week @ 2025-10-11 8/week @ 2025-10-18

186 downloads per month

MPL-2.0 license

44KB
379 lines

safety-lsp

Configuration for VSCode

  1. For .vscode/settings.json, SP_FILE starts from workspace root if it's a relative path:
{
  "safety-tool.env": {
    "SP_FILE": "./ostd/safety-tags.toml"
  }
}

SP_FILE can also be a absolute path.

SP_DIR is also supported, but only one of them should be specified.

  1. For remote usage, safety-lsp.env.SAFETY_LSP should be set as vscode will fail to find safety-lsp due to absence of bash env loading.
{
  "safety-tool.env": {
    "SAFETY_LSP": "/path/to/safety-lsp"
  }
}
  1. Ctrl+Space to open hover doc panel of each completion candidate if the doc is not shown.

Configuration for Neovim

vim.lsp.config["safety-lsp"] = {
  -- Command and arguments to start the server.
  cmd = { "/home/gh-zjp-CN/tag-std/safety-tool/safety-lsp/target/debug/safety-lsp" },
  -- Environment variables passed to the LSP process on spawn
  cmd_env = { SP_DISABLE_CHECK = 1 },

  -- Filetypes to automatically attach to.
  filetypes = { "rust" },

  -- Sets the "workspace" to the directory where any of these files is found.
  -- Files that share a root directory will reuse the LSP server connection.
  -- Nested lists indicate equal priority, see |vim.lsp.Config|.
  root_markers = { { "Cargo.toml" }, ".git" },

  -- Specific settings to send to the server. The schema is server-defined.
  settings = {},
}
-- Make LSP server config into effects.
vim.lsp.enable("safety-lsp")

Dependencies

~16–22MB
~491K SLoC