Skip to content

Commit

Permalink
Version 1.3.1
Browse files Browse the repository at this point in the history
* Un-indent context in documentation window
  • Loading branch information
lukas-reineke committed Nov 26, 2021
1 parent 4c54023 commit 68475bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion doc/cmp-rg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


Author: Lukas Reineke <lukas.reineke@protonmail.com>
Version: 1.3.0
Version: 1.3.1

==============================================================================
CONTENTS *cmp-rg*
Expand Down Expand Up @@ -105,6 +105,9 @@ debug *cmp-rg-debug*
==============================================================================
3. CHANGELOG *cmp-rg-changelog*

1.3.1
* Un-indent context in documentation window

1.3.0
* Add context documentation window
* Add |cmp-rg-context_before|
Expand Down
16 changes: 14 additions & 2 deletions lua/cmp-rg/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,22 @@ source.complete = function(self, request, callback)
local documentation = result.data.lines.text:gsub("\n", "")
table.insert(context, documentation)
if documentation_to_add > 0 then
table.insert(items[#items].documentation, documentation)
local d = items[#items].documentation
table.insert(d, documentation)
documentation_to_add = documentation_to_add - 1

if documentation_to_add == 0 then
table.insert(items[#items].documentation, "```")
local min_indent = 1e309
for i = 4, #d, 1 do
if d[i] ~= "" then
local _, indent = string.find(d[i], "^%s+")
min_indent = math.min(min_indent, indent or 0)
end
end
for i = 4, #d, 1 do
d[i] = d[i]:sub(min_indent)
end
table.insert(d, "```")
end
end
elseif result.type == "match" then
Expand Down

0 comments on commit 68475bb

Please sign in to comment.