symbols-outline.nvim icon indicating copy to clipboard operation
symbols-outline.nvim copied to clipboard

Use vim.lsp.protocol.CompletionItemKind

Open gegoune opened this issue 4 years ago • 6 comments

Users can override their icons for completion popup menu with vim.lsp.protocol.CompletionItemKind. It would be nice if symbols-outline could use them as well so icons are the same. What do you think? Is it feasible?

gegoune avatar May 21 '21 07:05 gegoune

It is feasible, but I am not sure if there are defaults already set, if there arent then it might take some work but ill implement it as an option

simrat39 avatar May 23 '21 03:05 simrat39

It would be great to be able to get defaults table. As far I can see, it is set here, thus one can get it with require('symbols-outline.config').options.symbols, but it seems it's not available at init time, because setup() is not called yet.

For instance, I already have defined my own symbols table

local symbols = {
  Boolean = "⊨",
  Class = '∴',
...

and I would like to construct new symbols table like that:

local default_outline_symbols = require('symbols-outline.config').options.symbols
local outline_symbols = {}
for type, definition in pairs(default_outline_symbols) do
  local my_definition = { hl = definition.hl, icon = symbols[type] or definition.icon }
  outline_symbols[type] =  my_definition
end
vim.g.symbols_outline = {
    symbols = outline_symbols
}

This way I wouldn't have to copy names of keys and highlight groups.

fenuks avatar Sep 06 '21 13:09 fenuks

It would be great to be able to get defaults table. As far I can see, it is set here, thus one can get it with require('symbols-outline.config').options.symbols, but it seems it's not available at init time, because setup() is not called yet.

For instance, I already have defined my own symbols table

local symbols = {
  Boolean = "⊨",
  Class = '∴',
...

and I would like to construct new symbols table like that:

local default_outline_symbols = require('symbols-outline.config').options.symbols
local outline_symbols = {}
for type, definition in pairs(default_outline_symbols) do
  local my_definition = { hl = definition.hl, icon = symbols[type] or definition.icon }
  outline_symbols[type] =  my_definition
end
vim.g.symbols_outline = {
    symbols = outline_symbols
}

This way I wouldn't have to copy names of keys and highlight groups.

I will export the default options in the config module then

simrat39 avatar Sep 07 '21 00:09 simrat39

Thank you.

fenuks avatar Sep 07 '21 08:09 fenuks

Just a small related issue, I'm attempting to configure this as per https://github.com/simrat39/symbols-outline.nvim/issues/19#issuecomment-913660023, but require("symbols-outline.config").options.symbols is coming out as nil

Once nvim is up, if I call :lua print(require("symbols-outline.config").options.symbols), I can see the table exists, but if I attempt to do it in my own config, the import works fine, but the table is nil.

Am I missing something?

Using packer to install the plugin, if it helps.

SurrealTiggi avatar Jan 01 '22 15:01 SurrealTiggi

Just a small related issue, I'm attempting to configure this as per #19 (comment), but require("symbols-outline.config").options.symbols is coming out as nil

Once nvim is up, if I call :lua print(require("symbols-outline.config").options.symbols), I can see the table exists, but if I attempt to do it in my own config, the import works fine, but the table is nil.

Am I missing something?

Using packer to install the plugin, if it helps.

@SurrealTiggi the config.options table would not be initialized before the setup function is called. If you want to use the symbols before setup you can use the config.defaults table. Otherwise move the code to some place that can be called after the setup call.

hedyhli avatar Nov 08 '23 09:11 hedyhli