diff options
author | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-25 09:52:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 09:52:22 -0400 |
commit | 43202964f39eed4e28fd8ad6ad0ec79a1868c33f (patch) | |
tree | da9abce08cca5b7502f0a5a6320eba52ee42b8e8 /runtime/lua/vim/lsp/log.lua | |
parent | 8a333afec53a48c90de7b0bde30f9db2d02d1898 (diff) | |
parent | 9d9edebceb73657899256430ed3e2f49c92898a8 (diff) | |
download | rneovim-43202964f39eed4e28fd8ad6ad0ec79a1868c33f.tar.gz rneovim-43202964f39eed4e28fd8ad6ad0ec79a1868c33f.tar.bz2 rneovim-43202964f39eed4e28fd8ad6ad0ec79a1868c33f.zip |
Merge pull request #12708 from runiq/lsp-doc
Add docs for some methods in vim.lsp
Diffstat (limited to 'runtime/lua/vim/lsp/log.lua')
-rw-r--r-- | runtime/lua/vim/lsp/log.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua index 696ce43a59..587a65cd96 100644 --- a/runtime/lua/vim/lsp/log.lua +++ b/runtime/lua/vim/lsp/log.lua @@ -2,6 +2,9 @@ local log = {} +-- FIXME: DOC +-- Should be exposed in the vim docs. +-- -- Log level dictionary with reverse lookup as well. -- -- Can be used to lookup the number from the name or the name from the number. @@ -21,12 +24,14 @@ local log_date_format = "%FT%H:%M:%S%z" do local path_sep = vim.loop.os_uname().sysname == "Windows" and "\\" or "/" + --@private local function path_join(...) return table.concat(vim.tbl_flatten{...}, path_sep) end local logfilename = path_join(vim.fn.stdpath('data'), 'lsp.log') - --- Return the log filename. + --- Returns the log filename. + --@returns (string) log filename function log.get_filename() return logfilename end @@ -36,6 +41,9 @@ do for level, levelnr in pairs(log.levels) do -- Also export the log level on the root object. log[level] = levelnr + -- FIXME: DOC + -- Should be exposed in the vim docs. + -- -- Set the lowercase name as the main use function. -- If called without arguments, it will check whether the log level is -- greater than or equal to this one. When called with arguments, it will @@ -74,6 +82,8 @@ end -- interfere with iterating the levels vim.tbl_add_reverse_lookup(log.levels) +--- Sets the current log level. +--@param level (string or number) One of `vim.lsp.log.levels` function log.set_level(level) if type(level) == 'string' then current_log_level = assert(log.levels[level:upper()], string.format("Invalid log level: %q", level)) @@ -84,8 +94,9 @@ function log.set_level(level) end end --- Return whether the level is sufficient for logging. --- @param level number log level +--- Checks whether the level is sufficient for logging. +--@param level number log level +--@returns (bool) true if would log, false if not function log.should_log(level) return level >= current_log_level end |