Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim.lsp.util.apply_text_edits needs offset-encoding #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fnl/nvim-tree-docs/collector.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
(when (not (. entry key))
(tset entry key (new-collector)))
(-> (. entry key)
(add-fn key _match collect)))
(add-fn key _match collect_)))
(not (. entry key))
(tset entry key _match)
(and (= key :start_point) _match.node)
Expand Down
2 changes: 1 addition & 1 deletion fnl/nvim-tree-docs/internal.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
:end {:line (+ node-er 1) :character 0}}})
(vim.list_extend marks result.marks)
(set line-offset (- (+ line-offset (length result.content)) replaced-count))))
(vim.lsp.util.apply_text_edits edits bufnr)))
(vim.lsp.util.apply_text_edits edits bufnr :utf-16)))
; Uncomment to test marks
;(utils.highlight-marks marks bufnr)))

Expand Down
97 changes: 28 additions & 69 deletions lua/nvim-tree-docs/aniseed/autoload.lua
Original file line number Diff line number Diff line change
@@ -1,78 +1,37 @@
local _2afile_2a = "fnl/aniseed/autoload.fnl"
local _0_
local _2amodule_name_2a = "nvim-tree-docs.aniseed.autoload"
local _2amodule_2a
do
package.loaded[_2amodule_name_2a] = {}
_2amodule_2a = package.loaded[_2amodule_name_2a]
end
local _2amodule_locals_2a
do
local name_0_ = "nvim-tree-docs.aniseed.autoload"
local module_0_
do
local x_0_ = package.loaded[name_0_]
if ("table" == type(x_0_)) then
module_0_ = x_0_
_2amodule_2a["aniseed/locals"] = {}
_2amodule_locals_2a = (_2amodule_2a)["aniseed/locals"]
end
local function autoload(name)
local res = {["aniseed/autoload-enabled?"] = true, ["aniseed/autoload-module"] = false}
local function ensure()
if res["aniseed/autoload-module"] then
return res["aniseed/autoload-module"]
else
module_0_ = {}
local m = require(name)
do end (res)["aniseed/autoload-module"] = m
return m
end
end
module_0_["aniseed/module"] = name_0_
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
do end (package.loaded)[name_0_] = module_0_
_0_ = module_0_
end
local autoload
local function _1_(...)
return (require("nvim-tree-docs.aniseed.autoload")).autoload(...)
end
autoload = _1_
local function _2_(...)
local ok_3f_0_, val_0_ = nil, nil
local function _2_()
return {}
local function _2_(t, ...)
return ensure()(...)
end
ok_3f_0_, val_0_ = pcall(_2_)
if ok_3f_0_ then
_0_["aniseed/local-fns"] = {}
return val_0_
else
return print(val_0_)
local function _3_(t, k)
return ensure()[k]
end
end
local _local_0_ = _2_(...)
local _2amodule_2a = _0_
local _2amodule_name_2a = "nvim-tree-docs.aniseed.autoload"
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
local autoload0
do
local v_0_
do
local v_0_0
local function autoload1(name)
local res = {["aniseed/autoload-enabled?"] = true, ["aniseed/autoload-module"] = false}
local function ensure()
if res["aniseed/autoload-module"] then
return res["aniseed/autoload-module"]
else
local m = require(name)
do end (res)["aniseed/autoload-module"] = m
return m
end
end
local function _3_(t, ...)
return ensure()(...)
end
local function _4_(t, k)
return ensure()[k]
end
local function _5_(t, k, v)
ensure()[k] = v
return nil
end
return setmetatable(res, {__call = _3_, __index = _4_, __newindex = _5_})
end
v_0_0 = autoload1
_0_["autoload"] = v_0_0
v_0_ = v_0_0
local function _4_(t, k, v)
ensure()[k] = v
return nil
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["autoload"] = v_0_
autoload0 = v_0_
return setmetatable(res, {__call = _2_, __index = _3_, __newindex = _4_})
end
return nil
_2amodule_2a["autoload"] = autoload
return _2amodule_2a
197 changes: 67 additions & 130 deletions lua/nvim-tree-docs/aniseed/compile.lua
Original file line number Diff line number Diff line change
@@ -1,146 +1,83 @@
local _2afile_2a = "fnl/aniseed/compile.fnl"
local _0_
local _2amodule_name_2a = "nvim-tree-docs.aniseed.compile"
local _2amodule_2a
do
package.loaded[_2amodule_name_2a] = {}
_2amodule_2a = package.loaded[_2amodule_name_2a]
end
local _2amodule_locals_2a
do
local name_0_ = "nvim-tree-docs.aniseed.compile"
local module_0_
_2amodule_2a["aniseed/locals"] = {}
_2amodule_locals_2a = (_2amodule_2a)["aniseed/locals"]
end
local autoload = (require("nvim-tree-docs.aniseed.autoload")).autoload
local a, fennel, fs, nvim = autoload("nvim-tree-docs.aniseed.core"), autoload("nvim-tree-docs.aniseed.fennel"), autoload("nvim-tree-docs.aniseed.fs"), autoload("nvim-tree-docs.aniseed.nvim")
do end (_2amodule_locals_2a)["a"] = a
_2amodule_locals_2a["fennel"] = fennel
_2amodule_locals_2a["fs"] = fs
_2amodule_locals_2a["nvim"] = nvim
local function wrap_macros(code, opts)
local macros_module = "nvim-tree-docs.aniseed.macros"
local filename
do
local x_0_ = package.loaded[name_0_]
if ("table" == type(x_0_)) then
module_0_ = x_0_
local _1_ = a.get(opts, "filename")
if (nil ~= _1_) then
filename = string.gsub(_1_, (nvim.fn.getcwd() .. fs["path-sep"]), "")
else
module_0_ = {}
filename = _1_
end
end
module_0_["aniseed/module"] = name_0_
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
do end (package.loaded)[name_0_] = module_0_
_0_ = module_0_
end
local autoload
local function _1_(...)
return (require("nvim-tree-docs.aniseed.autoload")).autoload(...)
end
autoload = _1_
local function _2_(...)
local ok_3f_0_, val_0_ = nil, nil
local function _2_()
return {autoload("nvim-tree-docs.aniseed.core"), autoload("nvim-tree-docs.aniseed.fennel"), autoload("nvim-tree-docs.aniseed.fs"), autoload("nvim-tree-docs.aniseed.nvim")}
end
ok_3f_0_, val_0_ = pcall(_2_)
if ok_3f_0_ then
_0_["aniseed/local-fns"] = {autoload = {a = "nvim-tree-docs.aniseed.core", fennel = "nvim-tree-docs.aniseed.fennel", fs = "nvim-tree-docs.aniseed.fs", nvim = "nvim-tree-docs.aniseed.nvim"}}
return val_0_
else
return print(val_0_)
end
end
local _local_0_ = _2_(...)
local a = _local_0_[1]
local fennel = _local_0_[2]
local fs = _local_0_[3]
local nvim = _local_0_[4]
local _2amodule_2a = _0_
local _2amodule_name_2a = "nvim-tree-docs.aniseed.compile"
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
local macros_prefix
do
local v_0_
do
local v_0_0
local function macros_prefix0(code, opts)
local macros_module = "nvim-tree-docs.aniseed.macros"
local filename
do
local _3_ = a.get(opts, "filename")
if _3_ then
filename = string.gsub(_3_, (nvim.fn.getcwd() .. fs["path-sep"]), "")
else
filename = _3_
end
end
local _4_
if filename then
_4_ = ("\"" .. string.gsub(filename, "\\", "\\\\") .. "\"")
else
_4_ = "nil"
end
return ("(local *file* " .. _4_ .. ")" .. "(require-macros \"" .. macros_module .. "\")\n" .. code)
local function _3_()
if filename then
return ("\"" .. string.gsub(filename, "\\", "\\\\") .. "\"")
else
return "nil"
end
v_0_0 = macros_prefix0
_0_["macros-prefix"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["macros-prefix"] = v_0_
macros_prefix = v_0_
return ("(local *file* " .. _3_() .. ")" .. "(require-macros \"" .. macros_module .. "\")\n" .. "(wrap-module-body " .. (code or "") .. ")")
end
local str
do
local v_0_
do
local v_0_0
local function str0(code, opts)
local fnl = fennel.impl()
local function _3_()
return fnl.compileString(macros_prefix(code, opts), a.merge({allowedGlobals = false}, opts))
end
return xpcall(_3_, fnl.traceback)
end
v_0_0 = str0
_0_["str"] = v_0_0
v_0_ = v_0_0
_2amodule_2a["wrap-macros"] = wrap_macros
local marker_prefix = "ANISEED_"
_2amodule_2a["marker-prefix"] = marker_prefix
local delete_marker = (marker_prefix .. "DELETE_ME")
do end (_2amodule_2a)["delete-marker"] = delete_marker
local delete_marker_pat = ("\n[^\n]-\"" .. delete_marker .. "\".-")
do end (_2amodule_locals_2a)["delete-marker-pat"] = delete_marker_pat
local function str(code, opts)
ANISEED_STATIC_MODULES = (true == a.get(opts, "static?"))
local fnl = fennel.impl()
local function _4_()
return string.gsub(string.gsub(fnl.compileString(wrap_macros(code, opts), a["merge!"]({compilerEnv = _G, allowedGlobals = false}, opts)), (delete_marker_pat .. "\n"), "\n"), (delete_marker_pat .. "$"), "")
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["str"] = v_0_
str = v_0_
return xpcall(_4_, fnl.traceback)
end
local file
do
local v_0_
do
local v_0_0
local function file0(src, dest)
local code = a.slurp(src)
local _3_, _4_ = str(code, {filename = src})
if ((_3_ == false) and (nil ~= _4_)) then
local err = _4_
return nvim.err_writeln(err)
elseif ((_3_ == true) and (nil ~= _4_)) then
local result = _4_
fs.mkdirp(fs.basename(dest))
return a.spit(dest, result)
end
end
v_0_0 = file0
_0_["file"] = v_0_0
v_0_ = v_0_0
_2amodule_2a["str"] = str
local function file(src, dest, opts)
local code = a.slurp(src)
local _5_, _6_ = str(code, a["merge!"]({filename = src, ["static?"] = true}, opts))
if ((_5_ == false) and (nil ~= _6_)) then
local err = _6_
return nvim.err_writeln(err)
elseif ((_5_ == true) and (nil ~= _6_)) then
local result = _6_
fs.mkdirp(fs.basename(dest))
return a.spit(dest, result)
else
return nil
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["file"] = v_0_
file = v_0_
end
local glob
do
local v_0_
do
local v_0_0
local function glob0(src_expr, src_dir, dest_dir)
for _, path in ipairs(fs.relglob(src_dir, src_expr)) do
if fs["macro-file-path?"](path) then
a.spit((dest_dir .. path), a.slurp((src_dir .. path)))
else
file((src_dir .. path), string.gsub((dest_dir .. path), ".fnl$", ".lua"))
end
end
return nil
_2amodule_2a["file"] = file
local function glob(src_expr, src_dir, dest_dir, opts)
for _, path in ipairs(fs.relglob(src_dir, src_expr)) do
if fs["macro-file-path?"](path) then
local dest = (dest_dir .. path)
fs.mkdirp(fs.basename(dest))
a.spit(dest, a.slurp((src_dir .. path)))
else
file((src_dir .. path), string.gsub((dest_dir .. path), ".fnl$", ".lua"), opts)
end
v_0_0 = glob0
_0_["glob"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["glob"] = v_0_
glob = v_0_
return nil
end
return nil
_2amodule_2a["glob"] = glob
return _2amodule_2a
Loading