Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh7th committed Sep 21, 2021
1 parent 6bcc2b9 commit 91ee62b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 14 deletions.
4 changes: 3 additions & 1 deletion lua/cmp/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ core.new = function()
self.sources_by_name = {}
self.context = context.new()
self.view = view.new()
self.view.event:on('keymap', function(...) self:on_keymap(...) end)
self.view.event:on('keymap', function(...)
self:on_keymap(...)
end)
return self
end

Expand Down
1 change: 0 additions & 1 deletion lua/cmp/utils/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ event.emit = function(self, name, ...)
end

return event

5 changes: 2 additions & 3 deletions lua/cmp/utils/window.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local cache = require "cmp.utils.cache"
local cache = require('cmp.utils.cache')

---@class cmp.WindowStyle
---@field public relative string
Expand Down Expand Up @@ -226,7 +226,7 @@ window.get_content_height = function(self)
'get_content_height',
self.style.width,
self.buf,
vim.api.nvim_buf_get_changedtick(self.buf)
vim.api.nvim_buf_get_changedtick(self.buf),
}, function()
local height = 0
for _, text in ipairs(vim.api.nvim_buf_get_lines(self.buf, 0, -1, false)) do
Expand All @@ -237,4 +237,3 @@ window.get_content_height = function(self)
end

return window

5 changes: 3 additions & 2 deletions lua/cmp/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ view.new = function()
self.ghost_text_view = ghost_text_view.new()
self.event = event.new()

self.items_view.event:on('change', function() self:on_item_change() end)
self.items_view.event:on('change', function()
self:on_item_change()
end)

return self
end
Expand Down Expand Up @@ -130,4 +132,3 @@ view.on_item_change = function(self)
end

return view

1 change: 0 additions & 1 deletion lua/cmp/view/docs_view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,3 @@ docs_view.visible = function(self)
end

return docs_view

11 changes: 5 additions & 6 deletions lua/cmp/view/items_view.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local event = require('cmp.utils.event')
local window = require "cmp.utils.window"
local window = require('cmp.utils.window')

---@class cmp.ItemsView
---@field public items_win cmp.Window
Expand Down Expand Up @@ -50,7 +50,7 @@ items_view.new = function()
})
end
end
end
end,
})

return self
Expand All @@ -63,9 +63,9 @@ items_view.open = function(self, offset, entries)

if #entries > 0 then
local dedup = {}
local abbrs = { hl_group = 'Comment', width = 0, texts = {} }
local kinds = { hl_group = 'Special', width = 0, texts = {} }
local menus = { hl_group = 'NonText', width = 0, texts = {} }
local abbrs = { hl_group = 'CmpAbbr', width = 0, texts = {} }
local kinds = { hl_group = 'CmpKind', width = 0, texts = {} }
local menus = { hl_group = 'CmpMenu', width = 0, texts = {} }
for _, e in ipairs(entries) do
local i = #self.entries + 1
local item = e:get_vim_item(offset)
Expand Down Expand Up @@ -208,4 +208,3 @@ items_view.insert = function(self, word)
end

return items_view

13 changes: 13 additions & 0 deletions plugin/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ misc.set(_G, { 'cmp', 'plugin', 'colorscheme' }, function()
guibg = 'NONE',
ctermbg = 'NONE',
})

highlight.inherit('CmpAbbr', 'Comment', {
guibg = 'NONE',
ctermbg = 'NONE',
})
highlight.inherit('CmpKind', 'Special', {
guibg = 'NONE',
ctermbg = 'NONE',
})
highlight.inherit('CmpMenu', 'Comment', {
guibg = 'NONE',
ctermbg = 'NONE',
})
end)
_G.cmp.plugin.colorscheme()

Expand Down

0 comments on commit 91ee62b

Please sign in to comment.