This commit removed the ability to receive symbols from all attached
clients in the current buffer. Everything works as before when only one
client is attached to a buffer.
This also fixes outline LSP finding clients on nvim-0.7
- Typo in checking for buflisted.
- As it turns out bufhidden isn't boolean, so let's not even consider it
for now. Doing this still allows buffers like LspInfo to be ignored,
it seems. In the future we will have configurable ignored buffers.
Thanks to @Djedouas for bringing it up.
It makes sense to store the provider each sidebar is using with own
self.provider fields, no way that did not occur to me before this.
The old `_G._outline_current_provider` ironically, can now be replaced
by `require('outline').current.provider`.
Primarily:
- Utils
- Sidebar (removed the need of writer.lua)
- Resolve keymaps shortcut in config eraly
- Put highlight functions into highlight.lua
- Put functions that do stuff on outline window into view.lua
Was passing self fields a lot, decided to just do all that in Sidebar
in the first place.
Also resolved guides.enabled=false early to setting markers to ' '.
Everything should work the same.
Currently the implementation is very limited.
Ref: #24
- Outline must be open and have been loaded for it to work (requires
lazy loading or headless loading of Sidebar)
- Empty string returned if cursor is not in any symbol ('closest' symbol
not yet supported)
- Line column not used
- Returning concatenated symbol names rather than a list of tables with
node info (requires a refactor of outline.SymbolNode type)
- Subject to config.symbols.filter and folds (requires finding hover
list somewhere outside of writer.make_outline)
Somehow marksman also does this?
As for treesitter (norg) it may be because treesitter includes the
newline and the next line indent until the next heading, so the line of
the next heading is included in the range of the previous heading. We
manually -1 on the range end line to fix it.
Closes#37
Almost completely refactored the UI parts outline.nvim to use a Sidebar
object that implements an outline window. In init.lua, we can then store
a table of the outline for each tabpage ID.
When tabs are closed the outline is closed and sidebar reset
responsibly.
This simplifies `init.lua` quite a lot, making it the highest level
control center for the outline elements.
All lua APIs and commands should work as before.
Closes#35
Previously the treesitter javascript parser would treat `<></>`
specially and emit a `jsx_fragment`. We were checking for this type here
(from symbols-outline.nvim), though we did not include `jsx_fragment` in
the parse_ts function to even look for it.
jsx_fragment was recently removed from treesitter parser to reduce
complexity, so we will treat all jsx_element's without a `name` field in
`jsx_opening_element` as the shorthand fragment.
Using "Fragment" as the name in this case makes it look exactly the same
as if the user used `<Fragment></Fragment>` instead.
The check for `jsx_fragment` is still kept in case an older version of
the parser is still used, it can probably be removed next year.
Ref:
- tree-sitter/tree-sitter-javascript#227
- Closes#3
- Ref: simrat39/symbols-outline.nvim#190
Norg contains indents and different types of verbatim tags, I was rather
lazy to read the spec properly and parse norg using regex line-by-line
like markdown, so used treesitter instead. The only requirement is the
`norg` parser for treesitter to be installed. Tested on nvim 0.7.2.
This should lead the way for supporting vimdoc files in a similar
manner.
Documentation for how external providers could look like as of now has
been added.
In the future we could let the provider determine what to do for each
keymap, such as `goto_location` and `toggle_preview`. This would allow
the zk extension[1] to work properly without having to override existing
functions (bad practice).
[1]: https://github.com/mickael-menu/zk-nvim/discussions/134