docs: update icon_fetcher usage and example
This commit is contained in:
18
README.md
18
README.md
@@ -918,6 +918,24 @@ symbols = {
|
|||||||
-- ...
|
-- ...
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `icon_fetcher` function may also accept a third parameter, the symbol
|
||||||
|
which type is outline.Symbol. Provider can add extra info to symbol.
|
||||||
|
For example, access specifier information can be added at the icon location.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
symbols = {
|
||||||
|
icon_fetcher = function(kind, bufnr, symbol)
|
||||||
|
local access_icons = { public = '○', protected = '◉', private = '●' }
|
||||||
|
local icon = require('outline.config').o.symbols.icons[kind].icon
|
||||||
|
-- ctags provider add `access` key
|
||||||
|
if symbol and symbol.access then
|
||||||
|
return icon .. ' ' .. access_icons[symbol.access]
|
||||||
|
end
|
||||||
|
return icon
|
||||||
|
end,
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See [this section](#custom-icons) for other examples of this function.
|
See [this section](#custom-icons) for other examples of this function.
|
||||||
|
|||||||
Reference in New Issue
Block a user