summaryrefslogtreecommitdiff
path: root/ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-06-19 18:34:13 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-06-19 18:34:13 +0900
commit307fceea38b7352a79b0bdb87025a34b76973867 (patch)
tree382eb3e6a11973bc2c6ba33eee14d43ec2a9566b /ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua
parentb66f68b8c014a3041c936ee9de1b57db5bcb50fb (diff)
updates
Diffstat (limited to 'ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua')
-rw-r--r--ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua103
1 files changed, 0 insertions, 103 deletions
diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua
deleted file mode 100644
index 85da742..0000000
--- a/ar/.config/TheSiahxyz/lua/thesiahxyz/snippets/neetcode1.lua
+++ /dev/null
@@ -1,103 +0,0 @@
-local ls = require("luasnip")
-local s = ls.snippet
-local i = ls.insert_node
-local fmt = require("luasnip.extras.fmt").fmt
-local rep = require("luasnip.extras").rep
-local f = ls.function_node -- Import function_node for dynamic content
-
--- Function to get the filename without the path
-local function get_filename()
- local filepath = vim.api.nvim_buf_get_name(0)
- local filename = vim.fn.fnamemodify(filepath, ":t:r") -- Get filename without path and extension
- return filename:gsub("_", " ") -- Replace underscores with spaces
-end
-
-local neetcode_snippet = s(
- "neetcode",
- fmt(
- [[
-"""
-Question
-
-{1}
-"""
-
-
-from typing import Dict
-
-class Solution:
- """
- A class to solve {file_name} from {2}
- """
- def {3}(self, {4}) -> {5}:
- """
- {file_name} from the input {parameters_type} using a {func_name} approach.
-
- Args:
- {parameters_type}: {6}
-
- Returns:
- {return_type}: {7}
- """
- return {8}
-
- def print(self, examples: Dict[str, {parameters_type}]) -> None:
- for name, example in examples.items():
- result = self.{3}(example)
- print(f"{{name}}: {{result}}")
-
- def main(self):
- cases = {{
- "case1" : {9},
- "case2" : {10},
- "case3" : {11},
- }}
-
- self.print(cases)
-
-
-solution = Solution()
-solution.main()
-
-"""
-Solution
-
-url: {12}
-video: {13}
-
-1. {func_name}
-time: {14}
-space: {15}
-code:
-```python
-{16}
-```
-"""
-]],
- {
- i(1, '"Describe the question here"'),
- file_name = f(get_filename), -- Insert the filename dynamicall
- i(2, '"Describe the class here"'),
- i(3, '"Function name"'), -- Primary insert node for method name
- func_name = rep(3), -- Repeat the method name
- i(4, '"parameters"'),
- parameters_type = rep(4),
- i(5, '"return_type"'),
- return_type = rep(5),
- i(6, '"parameters_desc"'),
- i(7, '"return_type_desc"'),
- i(8, '"return"'),
- i(9, '"case1"'),
- i(10, '"case2"'),
- i(11, '"case3"'),
- i(12, '"url"'),
- i(13, '"video"'),
- i(14, '"time_complexity"'),
- i(15, '"space_complexity"'),
- i(16, '"code"'),
- }
- )
-)
-
--- Add the snippets for multiple filetypes
-ls.add_snippets("python", { neetcode_snippet })