|
|
@@ -43,7 +43,7 @@ M.create_cspell_json = function(params)
|
|
|
|
|
|
local cspell_json_str = encode_json(cspell_json)
|
|
|
-- local cspell_json_file_path = require("null-ls.utils").path.join(params.cwd, config_file_preferred_name)
|
|
|
-local cspell_json_file_path = '~/.config/cspell/cspell.json'
|
|
|
+ local cspell_json_file_path = "~/.config/cspell/cspell.json"
|
|
|
|
|
|
Path:new(cspell_json_file_path):write(cspell_json_str, "w")
|
|
|
vim.notify("Created a new cspell.json file at " .. cspell_json_file_path, vim.log.levels.INFO)
|
|
|
@@ -77,7 +77,7 @@ local function find_file(filename, cwd)
|
|
|
-- until current_dir == root_dir
|
|
|
--
|
|
|
-- return nil
|
|
|
- return 'cspell.json'
|
|
|
+ return "cspell.json"
|
|
|
end
|
|
|
|
|
|
--- Find the first cspell.json file in the directory tree
|
|
|
@@ -91,7 +91,6 @@ local find_cspell_config_path = function(cwd)
|
|
|
-- end
|
|
|
-- end
|
|
|
-- return nil
|
|
|
-
|
|
|
end
|
|
|
|
|
|
---@class GeneratorParams
|
|
|
@@ -111,13 +110,17 @@ M.get_cspell_config = function(params)
|
|
|
local decode_json = code_action_config.decode_json or vim.json.decode
|
|
|
|
|
|
-- local cspell_json_path = M.get_config_path(params)
|
|
|
-local cspell_json_path = "~/.config/cspell/cspell.json"
|
|
|
+ local cspell_json_path = "~/.config/cspell/cspell.json"
|
|
|
|
|
|
-- if cspell_json_path == nil or cspell_json_path == "" then
|
|
|
-- return
|
|
|
-- end
|
|
|
--
|
|
|
- local content = Path:new(cspell_json_path):read()
|
|
|
+ -- local content = Path:new(cspell_json_path):read()
|
|
|
+
|
|
|
+ local content = with(open(cspell_json_path), function(reader)
|
|
|
+ return reader:read()
|
|
|
+ end)
|
|
|
local ok, cspell_config = pcall(decode_json, content)
|
|
|
|
|
|
if not ok then
|
|
|
@@ -127,7 +130,7 @@ local cspell_json_path = "~/.config/cspell/cspell.json"
|
|
|
|
|
|
return {
|
|
|
config = cspell_config,
|
|
|
- path = '~/.config/cspell/cspell.json',
|
|
|
+ path = "~/.config/cspell/cspell.json",
|
|
|
}
|
|
|
end
|
|
|
|
|
|
@@ -159,7 +162,7 @@ M.get_config_path = function(params)
|
|
|
PATH_BY_CWD[params.cwd] = cspell_json_path
|
|
|
end
|
|
|
-- return PATH_BY_CWD[params.cwd]
|
|
|
- return '~/.config/cspell/cspell.json'
|
|
|
+ return "~/.config/cspell/cspell.json"
|
|
|
end
|
|
|
|
|
|
--- Checks that both sources use the same config
|