-
Notifications
You must be signed in to change notification settings - Fork 1
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
2692957
commit 510976f
Showing
35 changed files
with
3,477 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,6 @@ luac.out | |
|
||
# macOS | ||
.DS_Store | ||
|
||
# tags | ||
tags |
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 |
---|---|---|
|
@@ -4,5 +4,5 @@ modules = { | |
} | ||
|
||
exclude = { | ||
"lua/actboy168_json.lua", | ||
"lua/gentags/commons/*.lua", | ||
} |
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 @@ | ||
lua/gentags/commons/*.lua |
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 |
---|---|---|
|
@@ -7,4 +7,4 @@ coverage: | |
default: | ||
threshold: 90% | ||
ignore: | ||
- "lua/actboy168_json.lua" | ||
- "lua/gentags/commons/*.lua" |
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 |
---|---|---|
@@ -1,5 +1,67 @@ | ||
local logging = require("gentags.commons.logging") | ||
local LogLevels = require("gentags.commons.logging").LogLevels | ||
local configs = require("gentags.configs") | ||
|
||
local M = {} | ||
|
||
M.setup = function() end | ||
--- @param opts gentags.Options? | ||
M.setup = function(opts) | ||
local cfg = configs.setup(opts) | ||
-- print(vim.inspect(cfg)) | ||
|
||
logging.setup({ | ||
name = "gentags", | ||
level = cfg.debug.enable and LogLevels.DEBUG or LogLevels.INFO, | ||
console_log = cfg.debug.console_log, | ||
file_log = cfg.debug.file_log, | ||
file_log_name = "gentags.log", | ||
}) | ||
local logger = logging.get("gentags") --[[@as commons.logging.Logger]] | ||
|
||
-- cache dir | ||
logger:ensure( | ||
vim.fn.filereadable(cfg.cache_dir) <= 0, | ||
"%s (cache_dir) already exist but not a directory!", | ||
vim.inspect(cfg.cache_dir) | ||
) | ||
vim.fn.mkdir(cfg.cache_dir, "p") | ||
|
||
-- init tags (first generate) when open/create file | ||
vim.api.nvim_create_autocmd({ | ||
"BufReadPre", | ||
"BufNewFile", | ||
"FileReadPre", | ||
}, { | ||
callback = function(event) | ||
logging | ||
.get("gentags") | ||
:debug("|setup| enter buffer:%s", vim.inspect(event)) | ||
require("gentags.dispatcher").load() | ||
require("gentags.dispatcher").init() | ||
end, | ||
}) | ||
|
||
-- update tags when write/modify file | ||
vim.api.nvim_create_autocmd({ | ||
"BufWritePost", | ||
"FileWritePost", | ||
"FileAppendPost", | ||
}, { | ||
callback = function(event) | ||
logging | ||
.get("gentags") | ||
:debug("|setup| write buffer:%s", vim.inspect(event)) | ||
require("gentags.dispatcher").update() | ||
end, | ||
}) | ||
|
||
-- terminate before leaving vim | ||
vim.api.nvim_create_autocmd({ "VimLeavePre" }, { | ||
callback = function(event) | ||
logging.get("gentags"):debug("|setup| leave vim:%s", vim.inspect(event)) | ||
require("gentags.dispatcher").terminate() | ||
end, | ||
}) | ||
end | ||
|
||
return M |
Empty file.
File renamed without changes.
Oops, something went wrong.