-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55b0028
commit 5a4ac98
Showing
9 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- Credit https://github.com/glepnir/template.nvim/blob/main/lua/telescope/_extensions/find_template.lua | ||
local telescope = require("telescope") | ||
local finders = require("telescope.finders") | ||
local pickers = require("telescope.pickers") | ||
local make_entry = require("telescope.make_entry") | ||
local conf = require("telescope.config").values | ||
|
||
local temp_list = function() | ||
return require("utils.templates").get_all_templates() | ||
end | ||
|
||
local find_template = function(opts) | ||
opts = opts or {} | ||
local results = temp_list() | ||
|
||
pickers.new(opts, { | ||
prompt_title = "templates", | ||
results_title = "templates", | ||
finder = finders.new_table({ | ||
results = results, | ||
entry_maker = make_entry.gen_from_file(opts), | ||
}), | ||
previewer = conf.file_previewer(opts), | ||
sorter = conf.file_sorter(opts), | ||
}):find() | ||
end | ||
|
||
return telescope.register_extension({ exports = { find_template = find_template } }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
local M = {} | ||
|
||
M.template = [[ | ||
package {{_java_package_name_}}; | ||
public class {{_java_name}} { | ||
{{_cursor_}} | ||
}]] | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
local M = {} | ||
|
||
M.template = [[ | ||
package {{_java_package_name_}}; | ||
public enum {{_java_name}} { | ||
{{_cursor_}} | ||
}]] | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
local M = {} | ||
|
||
M.template = [[ | ||
package {{_java_package_name_}}; | ||
public interface {{_java_name}} { | ||
{{_cursor_}} | ||
}]] | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
local M = {} | ||
|
||
M.template = [[ | ||
package {{_java_package_name_}}; | ||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
import org.springframework.data.mongodb.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
public interface {{_java_name}} extends MongoRepository<{{_cursor_}}, String> { | ||
}]] | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters