Skip to content

Commit

Permalink
feat(lang): add python & dap support
Browse files Browse the repository at this point in the history
  • Loading branch information
vdbe committed Jul 26, 2024
1 parent 38cce71 commit d40b32f
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/tired/plugins/dap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
{ import = "lazyvim.plugins.extras.dap.core" },
}
1 change: 1 addition & 0 deletions lua/tired/plugins/languages/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ return {
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.rust" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.lang.python" },

{ import = "tired.plugins.languages.bash" },
{ import = "tired.plugins.languages.lua" },
Expand Down
1 change: 1 addition & 0 deletions lua/tired/plugins/mason.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ return {
vim.g.is_nix and {
{ "williamboman/mason.nvim", enabled = false },
{ "williamboman/mason-lspconfig.nvim", enabled = false },
{ "jay-babu/mason-nvim-dap.nvim", enabled = false },
} or {},
}
13 changes: 13 additions & 0 deletions nix/pkgs/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ let
statix
];

python = [
pyright
ruff
];

rust = [
rust-analyzer

Expand Down Expand Up @@ -114,13 +119,21 @@ let
nvim-snippets
friendly-snippets

nvim-dap
nvim-dap-ui
nvim-dap-virtual-text
nvim-nio

nvim-dap-python

nvim-lspconfig

nvim-treesitter
nvim-treesitter-textobjects
ts-comments-nvim
nvim-ts-autotag
schemastore-nvim
venv-selector-nvim

gitsigns-nvim
todo-comments-nvim
Expand Down
8 changes: 8 additions & 0 deletions nix/pkgs/tree-sitter-grammars/sourcesOverrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ _: _: super: {
generate = true;
};

tree-sitter-markdown = super.tree-sitter-markdown // {
location = "tree-sitter-markdown";
};

tree-sitter-markdown-inline = super.tree-sitter-markdown // {
location = "tree-sitter-markdown";
};

tree-sitter-typescript = super.tree-sitter-typescript // {
location = "typescript";
};
Expand Down
6 changes: 6 additions & 0 deletions nix/pkgs/vimPlugins/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ self: super: {
}
);

lazyvim = super.lazyvim.overrideAttrs (
_: previousAttrs: {
patches = previousAttrs.patches or [ ] ++ [ ./patches/lazyvim/nvim-dap-python.patch ];
}
);

none-ls-nvim = super.none-ls-nvim.overrideAttrs { dependencies = with self; [ plenary-nvim ]; };

nvim-treesitter = super.nvim-treesitter.overrideAttrs (
Expand Down
17 changes: 17 additions & 0 deletions nix/pkgs/vimPlugins/patches/lazyvim/nvim-dap-python.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua
index f85b23b..aa94b7e 100644
--- a/lua/lazyvim/plugins/extras/lang/python.lua
+++ b/lua/lazyvim/plugins/extras/lang/python.lua
@@ -103,11 +103,7 @@ return {
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
},
config = function()
- if vim.fn.has("win32") == 1 then
- require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/Scripts/pythonw.exe"))
- else
- require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python"))
- end
+ require("dap-python").setup("python")
end,
},
},
57 changes: 57 additions & 0 deletions nix/sources/grammars/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,33 @@
"url": "https://api.github.com/repos/tree-sitter-grammars/tree-sitter-luap/tarball/v1.0.1",
"hash": "1wfsfh44jn7m9kx0lfsbrf0hqavad142wl2pffab3mvpmrnawva9"
},
"tree-sitter-markdown": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "tree-sitter-grammars",
"repo": "tree-sitter-markdown"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v0.2.3",
"revision": "62516e8c78380e3b51d5b55727995d2c511436d8",
"url": "https://api.github.com/repos/tree-sitter-grammars/tree-sitter-markdown/tarball/v0.2.3",
"hash": "08wl8y8xgrr10m1p6xpmv0jbmnif30wgd2q5m28ghh1v37q2ixfp"
},
"tree-sitter-ninja": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "alemuller",
"repo": "tree-sitter-ninja"
},
"branch": "main",
"revision": "0a95cfdc0745b6ae82f60d3a339b37f19b7b9267",
"url": "https://github.com/alemuller/tree-sitter-ninja/archive/0a95cfdc0745b6ae82f60d3a339b37f19b7b9267.tar.gz",
"hash": "1vmfx2k6bxfwcz319vskjhyszc6hz3j32bw4lgj72l7p890ykwkv"
},
"tree-sitter-nix": {
"type": "Git",
"repository": {
Expand All @@ -129,6 +156,21 @@
"url": "https://github.com/nix-community/tree-sitter-nix/archive/0fdada10f1f845ca9116e279ad8f5d0ca93e9949.tar.gz",
"hash": "1vnf28sgzck9i020is5m5ff95b6sxp2kams21nwrajvq66a38xl6"
},
"tree-sitter-python": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "tree-sitter",
"repo": "tree-sitter-python"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v0.21.0",
"revision": "0f9047c857ed0990931b1f899c7d3bf403703147",
"url": "https://api.github.com/repos/tree-sitter/tree-sitter-python/tarball/v0.21.0",
"hash": "0wv59wfbxqp8b64fy36vd5n3ifs15zlzkjdfxgb9zkg0cvs7h3v5"
},
"tree-sitter-query": {
"type": "GitRelease",
"repository": {
Expand All @@ -144,6 +186,21 @@
"url": "https://api.github.com/repos/tree-sitter-grammars/tree-sitter-query/tarball/v0.4.0",
"hash": "0wi01kmvb5axavfm6jp3rd6dd9pnq551w9lgwcgs02amxp6z8ymj"
},
"tree-sitter-rst": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "stsewd",
"repo": "tree-sitter-rst"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v0.1.0",
"revision": "25e6328872ac3a764ba8b926aea12719741103f1",
"url": "https://api.github.com/repos/stsewd/tree-sitter-rst/tarball/v0.1.0",
"hash": "0f53jmpjh2kcl9srwwwb7a5k24729ig96m87qjj99myqfnzahw43"
},
"tree-sitter-rust": {
"type": "GitRelease",
"repository": {
Expand Down
51 changes: 51 additions & 0 deletions nix/sources/plugins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,21 @@
"url": "https://api.github.com/repos/folke/neodev.nvim/tarball/v3.0.0",
"hash": "1lfj7ww8fplmj0xmm2qa4f8ifqapvmdra9s8gwz770b7dyraj615"
},
"neotest": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "nvim-neotest",
"repo": "neotest"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v5.4.0",
"revision": "32ff2ac21135a372a42b38ae131e531e64833bd3",
"url": "https://api.github.com/repos/nvim-neotest/neotest/tarball/v5.4.0",
"hash": "144wzzadhrg48fkihffk6jf9c0ij8dg9gng6mcxq5z8mdcvz0124"
},
"none-ls.nvim": {
"type": "Git",
"repository": {
Expand Down Expand Up @@ -540,6 +555,18 @@
"url": "https://api.github.com/repos/mfussenegger/nvim-dap/tarball/0.8.0",
"hash": "08w3s0imqlraksz1h13789a36xw2f6bnq84rnb268wyfcc1nmlwd"
},
"nvim-dap-python": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "mfussenegger",
"repo": "nvim-dap-python"
},
"branch": "master",
"revision": "d777c2b32ed39f61209c09bede28d7491621a631",
"url": "https://github.com/mfussenegger/nvim-dap-python/archive/d777c2b32ed39f61209c09bede28d7491621a631.tar.gz",
"hash": "1fsfnir1af847hmxgc6ca3hxqpnik9dv1s7ag28kzmvy0wj8clav"
},
"nvim-dap-ui": {
"type": "GitRelease",
"repository": {
Expand All @@ -555,6 +582,18 @@
"url": "https://api.github.com/repos/rcarriga/nvim-dap-ui/tarball/v4.0.0",
"hash": "1b6836m18rl7mw0zc5jm258cmj0c68hxbw1jd82j1bp9d4klkjkh"
},
"nvim-dap-virtual-text": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "theHamsta",
"repo": "nvim-dap-virtual-text"
},
"branch": "master",
"revision": "484995d573c0f0563f6a66ebdd6c67b649489615",
"url": "https://github.com/theHamsta/nvim-dap-virtual-text/archive/484995d573c0f0563f6a66ebdd6c67b649489615.tar.gz",
"hash": "0p889jkyia04l4nhndmg4yl88mc10hf0fzgyyqj08ybzws5z9zgr"
},
"nvim-lint": {
"type": "Git",
"repository": {
Expand Down Expand Up @@ -765,6 +804,18 @@
"url": "https://api.github.com/repos/folke/ts-comments.nvim/tarball/v1.4.0",
"hash": "0vbahzl27d39r8bijsg5d17hnsfm19mz71w7s2ydyfah0mpgj48j"
},
"venv-selector.nvim": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "linux-cultist",
"repo": "venv-selector.nvim"
},
"branch": "regexp",
"revision": "47159757b334343fe60f16d52478f827ccefa09d",
"url": "https://github.com/linux-cultist/venv-selector.nvim/archive/47159757b334343fe60f16d52478f827ccefa09d.tar.gz",
"hash": "1qsplf1zns9981ybdl62z5w7wg5ddhc0sp9w5zaiqrbcji7gfmxx"
},
"vimtex": {
"type": "GitRelease",
"repository": {
Expand Down

0 comments on commit d40b32f

Please sign in to comment.