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
Option to auto unfold when there is only N root nodes in outline.
Defaults to 1, meaning if there is only one 'root' parent, it should
always be unfolded.
This is useful if the entire file is a single function or a single
'return'.
The old auto_unfold_hover option **still works as expected**.
No more obnoxious '}' on the cmdline when pressing `?`!
scope:
- More type hints
- Added class Float for creating floating windows with size that fit the
content and position centered on the screen
- show_help action for outline window (key `?`) now uses a floating
window
- :OutlineStatus now provides better information, and shows content in a
floating window.
future:
- Floating window option configuration
- preview window can adapt based on position of outline window, and not
based on config value of `position` left/right
- it can also properly vertically center-align, even when there are
horizontal splits below the outline
- fixed a few bugs associated with previous rewrite commits in init.lua
config:
- Added min_height for preview window