# LSP for Hydra config files
## Installation
1. Using pypi: `pip install hydra-lsp`
2. Using poetry: `poetry install`
## How to use
To try it out, use the following code snippet in neovim.
Note: If you are VS Code user - check out the [extension](https://github.com/retsediv/hydra-lsp-vscode).
```lua
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
local on_attach = function(client, bufnr)
local nmap = function(keys, func, desc)
desc = "LSP: " .. desc
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc, noremap = true })
end
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
end
if not configs.hydralsp then
configs.hydralsp = {
default_config = {
cmd = { "hydra-lsp" },
root_dir = lspconfig.util.root_pattern(".git"),
filetypes = { "yaml" },
},
}
end
lspconfig.hydralsp.setup({
on_attach = lsp.on_attach,
})
```
Note: make sure to install hydra-lsp so that nvim can find an executable (`poetry install`)
Raw data
{
"_id": null,
"home_page": "https://github.com/Retsediv/hydra-lsp",
"name": "hydra-lsp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "ls,language-server,yaml,hydra",
"author": "Andrii Zhuravchak",
"author_email": "retsediv1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b0/af/4b88bbe11d14c6c06a4603945638ccca68291ad57207b6e14da3a067470f/hydra_lsp-0.1.3.tar.gz",
"platform": null,
"description": "# LSP for Hydra config files\n\n## Installation\n\n1. Using pypi: `pip install hydra-lsp`\n\n2. Using poetry: `poetry install`\n\n## How to use\n\nTo try it out, use the following code snippet in neovim.\n\nNote: If you are VS Code user - check out the [extension](https://github.com/retsediv/hydra-lsp-vscode).\n\n```lua\n\nlocal lspconfig = require(\"lspconfig\")\nlocal configs = require(\"lspconfig.configs\")\n\nlocal on_attach = function(client, bufnr)\n local nmap = function(keys, func, desc)\n desc = \"LSP: \" .. desc\n vim.keymap.set(\"n\", keys, func, { buffer = bufnr, desc = desc, noremap = true })\n end\n\n nmap(\"gd\", vim.lsp.buf.definition, \"[G]oto [D]efinition\")\n nmap(\"gD\", vim.lsp.buf.declaration, \"[G]oto [D]eclaration\")\n nmap(\"gr\", require(\"telescope.builtin\").lsp_references, \"[G]oto [R]eferences\")\n nmap(\"gI\", vim.lsp.buf.implementation, \"[G]oto [I]mplementation\")\n nmap(\"K\", vim.lsp.buf.hover, \"Hover Documentation\")\n nmap(\"<C-k>\", vim.lsp.buf.signature_help, \"Signature Documentation\")\n\n nmap(\"<leader>rn\", vim.lsp.buf.rename, \"[R]e[n]ame\")\n nmap(\"<leader>ca\", vim.lsp.buf.code_action, \"[C]ode [A]ction\")\nend\n\nif not configs.hydralsp then\n configs.hydralsp = {\n default_config = {\n cmd = { \"hydra-lsp\" },\n root_dir = lspconfig.util.root_pattern(\".git\"),\n filetypes = { \"yaml\" },\n },\n }\nend\n\nlspconfig.hydralsp.setup({\n on_attach = lsp.on_attach,\n})\n\n```\n\nNote: make sure to install hydra-lsp so that nvim can find an executable (`poetry install`)\n",
"bugtrack_url": null,
"license": "",
"summary": "Language server for Hydra YAML config files",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/Retsediv/hydra-lsp"
},
"split_keywords": [
"ls",
"language-server",
"yaml",
"hydra"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "643d568277f6264668f552a0ec16639f54bb02325e1a6d6f01e2c5aa82ee5536",
"md5": "3e326cf3a2a94fcc0caae105f080eb8e",
"sha256": "4e212170606c99c07df876b03fb875f2be35bd6b8d0cb60277ece5212228e723"
},
"downloads": -1,
"filename": "hydra_lsp-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3e326cf3a2a94fcc0caae105f080eb8e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 11403,
"upload_time": "2023-11-20T17:52:27",
"upload_time_iso_8601": "2023-11-20T17:52:27.414451Z",
"url": "https://files.pythonhosted.org/packages/64/3d/568277f6264668f552a0ec16639f54bb02325e1a6d6f01e2c5aa82ee5536/hydra_lsp-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b0af4b88bbe11d14c6c06a4603945638ccca68291ad57207b6e14da3a067470f",
"md5": "315a31bc17b08ae758c8164b816f5785",
"sha256": "5ad3b2d636cb25c1e63289814d5c707b287a5229155f59bad2b953065314b440"
},
"downloads": -1,
"filename": "hydra_lsp-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "315a31bc17b08ae758c8164b816f5785",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 9229,
"upload_time": "2023-11-20T17:52:29",
"upload_time_iso_8601": "2023-11-20T17:52:29.246020Z",
"url": "https://files.pythonhosted.org/packages/b0/af/4b88bbe11d14c6c06a4603945638ccca68291ad57207b6e14da3a067470f/hydra_lsp-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-20 17:52:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Retsediv",
"github_project": "hydra-lsp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hydra-lsp"
}