[!WARNING] THIS SOFTWARE IS IN ALPHA STATE EXPECT BUGS, BREAKING CHANGES, CRASHES, EXPLOSIONS AND EVERYTHING IN BETWEEN!
An experimental language server for the Python programming language.
LSP methods implemented so far
You can install SithLSP from the main branch with
$ cargo install --git https://github.com/LaBatata101/sith-language-server
To install a specific release use --tag
$ cargo install --git https://github.com/LaBatata101/sith-language-server --tag v0.2.3-alpha
You can also download the latest version of SithLSP from the releases or
build it manually following the steps below. The VSCode extension can also be downloaded from the releases page, it's the .vsix file.
Download the repository with
$ git clone https://github.com/LaBatata101/sith-language-server
now build the SithLSP binary (you'll need the latest version of the Rust compiler).
$ cd sith-language-server
$ cargo build --release
The binary will be located in the target/release folder. You should place the binary in $PATH or,
if you're using VSCode, you can use the sith.executable setting option.
It's probably better to disable the Python or Pylance extensions, from Microsoft, to avoid any conflicts when
using this extension.
You can build the VSCode extension manually with
# First we need to build the extension package
$ npm install -g @vscode/vsce
$ cd sith-language-server/editors/vscode
# Install dependencies
$ npm install
# Build the extension package
$ npm run compile
$ vsce package
# Now manually install the extension
$ code --install-extension sith-language-server-*.vsix
If you're using nvim-lspconfig add this to your config
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
if not configs.sith_lsp then
local root_files = {
"pyproject.toml",
"requirements.txt",
"Pipfile",
"pyrightconfig.json",
".git",
}
configs.sith_lsp = {
default_config = {
cmd = { "/path/to/sith-lsp" },
root_dir = function(fname)
return lspconfig.util.root_pattern(unpack(root_files))(fname)
end,
single_file_support = true,
filetypes = { "python" },
settings = {
-- Settings for the server goes here.
-- Config example
ruff = {
lint = {
enable = true
}
}
},
},
}
end
Otherwise, add this to your init.lua config file.
local pwd = vim.loop.cwd()
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
callback = function()
vim.lsp.start({
name = "SithLSP",
filetypes = { "python" },
root_dir = pwd,
cmd = { "/path/to/sith-lsp" },
init_options = {
settings = {
-- Settings for the server goes here.
-- Config example
ruff = {
lint = {
enable = true
}
}
},
},
})
end,
})
Add this to your languages.toml config file.
[language-server.sith-lsp]
command = "/path/to/sith-lsp"
# Config example
[language-server.sith-lsp.config.settings.ruff.lint]
enable = true
[[language]]
name = "python"
language-servers = [
"sith-lsp",
]
You can ommit the sith prefix from the settings if you are not on VSCode.
NOTE: This setting is only valid in the VSCode extension.
Path to the language server executable.
stringsith-lspNOTE: This setting is only valid in the VSCode extension.
Traces the communication between VS Code and the language server.
stringoffoff, messages, verboseControls the log level of the language server.
stringnullerror, warning, info, debug, tracePath to the log file for the language server.
stringnullPath to a Python interpreter to use to run the LSP server.
If this setting is set sith won't search automatically for a Python interpreter.
stringnullWhether to enable Ruff.
booleantrue if sith.ruff.path is set, false otherwise.Path to the ruff executable, e.g., [\"/path/to/ruff\"].
stringnullWhether to enable Ruff formatting.
booleantrue if sith.ruff.path is set, false otherwise.Additional command-line arguments to pass to ruff format, e.g., \"args\": [\"--config=/path/to/pyproject.toml\"]. Supports a subset of Ruff's command-line arguments, ignoring those that are required to operate the LSP, like --force-exclude and --verbose.
string[][]Whether to enable Ruff linting.
booleantrue if sith.ruff.path is set, false otherwise.Additional command-line arguments to pass to ruff check, e.g., \"args\": [\"--config=/path/to/pyproject.toml\"]. Supports a subset of Ruff's command-line arguments, ignoring those that are required to operate the LSP, like --force-exclude and --verbose.
string[][]Set rule codes to enable. Use ALL to enable all rules. See the documentation for more details.
string[]nullEnable additional rule codes on top of existing configuration, instead of overriding it. Use ALL to enable all rules.
string[]nullSet rule codes to disable. See the documentation for more details.
string[]null$ claude mcp add sith-language-server \
-- python -m otcore.mcp_server <graph>