mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
feat: add support for org files
This commit is contained in:
parent
27071368e7
commit
1e698f36fa
6 changed files with 82 additions and 0 deletions
|
@ -130,6 +130,7 @@ automatically fetch symbols from treesitter.
|
|||
- julia
|
||||
- lua
|
||||
- markdown
|
||||
- org
|
||||
- php
|
||||
- python
|
||||
- rst
|
||||
|
|
|
@ -64,6 +64,9 @@ return {
|
|||
markdown = {
|
||||
atx_heading = "Interface",
|
||||
},
|
||||
org = {
|
||||
section = "Interface",
|
||||
},
|
||||
php = {
|
||||
anonymous_function_creation_expression = "Function",
|
||||
class_declaration = "Class",
|
||||
|
|
3
queries/org/aerial.scm
Normal file
3
queries/org/aerial.scm
Normal file
|
@ -0,0 +1,3 @@
|
|||
(section
|
||||
(headline
|
||||
item: (item) @name)) @type
|
|
@ -6,6 +6,8 @@ vim.o.swapfile = false
|
|||
vim.bo.swapfile = false
|
||||
-- Neovim 0.5 doesn't have julia filetype detection
|
||||
vim.cmd([[autocmd BufRead,BufNewFile *.jl setfiletype julia]])
|
||||
-- Neovim below 0.7 doesn't have org filetype detection
|
||||
vim.cmd([[autocmd BufRead,BufNewFile *.org setfiletype org]])
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = "all",
|
||||
|
|
60
tests/treesitter/org_spec.lua
Normal file
60
tests/treesitter/org_spec.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
local util = require("tests.test_util")
|
||||
|
||||
describe("org", function()
|
||||
local symbols = {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level1",
|
||||
level = 0,
|
||||
lnum = 1,
|
||||
col = 0,
|
||||
end_lnum = 7,
|
||||
end_col = 0,
|
||||
children = {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level2",
|
||||
level = 1,
|
||||
lnum = 3,
|
||||
col = 0,
|
||||
end_lnum = 7,
|
||||
end_col = 0,
|
||||
children = {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level3",
|
||||
level = 2,
|
||||
lnum = 5,
|
||||
col = 0,
|
||||
end_lnum = 7,
|
||||
end_col = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level1_2",
|
||||
level = 0,
|
||||
lnum = 7,
|
||||
col = 0,
|
||||
end_lnum = 14,
|
||||
end_col = 0,
|
||||
children = {
|
||||
{
|
||||
kind = "Interface",
|
||||
name = "Level2_2",
|
||||
level = 1,
|
||||
lnum = 11,
|
||||
col = 0,
|
||||
end_lnum = 14,
|
||||
end_col = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
it("treesitter parses all symbols correctly", function()
|
||||
util.test_file_symbols("treesitter", "./tests/treesitter/org_test.org", symbols)
|
||||
end)
|
||||
end)
|
13
tests/treesitter/org_test.org
Normal file
13
tests/treesitter/org_test.org
Normal file
|
@ -0,0 +1,13 @@
|
|||
* Level1
|
||||
|
||||
** Level2
|
||||
|
||||
*** Level3
|
||||
|
||||
* Level1_2
|
||||
|
||||
paragraph
|
||||
|
||||
** Level2_2
|
||||
|
||||
paragraph2
|
Loading…
Reference in a new issue