Skip to content

Commit

Permalink
refactor: remove nvim-treesitter dependency (#298)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires NeoVim >= v0.9.0

* refactor!: remove nvim-treesitter dependency

* ci: fix tests

---------

Co-authored-by: Rónán Carrigan <[email protected]>
  • Loading branch information
amaanq and Rónán Carrigan authored Oct 20, 2023
1 parent e8ed1ac commit b04332c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@ jobs:

tests:
name: tests
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz
- os: ubuntu-22.04
rev: nightly/nvim-linux64.tar.gz
- os: ubuntu-22.04
rev: v0.9.1/nvim-linux64.tar.gz
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: date +%F > todays-date
- name: Restore cache for today's nightly.
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _neovim
key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }}
key: ${{ runner.os }}-${{ matrix.rev }}-${{ hashFiles('todays-date') }}

- name: Prepare dependencies
run: |
test -d _neovim || {
mkdir -p _neovim
curl -sL ${{ matrix.url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}" | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
}
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Install with your favourite package manager alongside nvim-dap

```vim
call dein#add("nvim-lua/plenary.nvim")
call dein#add("nvim-treesitter/nvim-treesitter")
call dein#add("antoinemadec/FixCursorHold.nvim")
call dein#add("nvim-neotest/neotest")
```
Expand All @@ -54,7 +53,6 @@ call dein#add("nvim-neotest/neotest")

```vim
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'antoinemadec/FixCursorHold.nvim'
Plug 'nvim-neotest/neotest'
```
Expand All @@ -66,7 +64,6 @@ use {
"nvim-neotest/neotest",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim"
}
}
Expand All @@ -79,7 +76,6 @@ use {
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim"
}
}
Expand Down
1 change: 0 additions & 1 deletion lua/neotest/lib/subprocess.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function neotest.lib.subprocess.init()
{ parent_address }
)
-- Load dependencies
nio.fn.rpcrequest(child_chan, "nvim_exec_lua", "require('nvim-treesitter')", {})
nio.fn.rpcrequest(child_chan, "nvim_exec_lua", "require('plenary')", {})
enabled = true
nio.api.nvim_create_autocmd("VimLeavePre", { callback = cleanup })
Expand Down
2 changes: 1 addition & 1 deletion lua/neotest/lib/treesitter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ end
function neotest.lib.treesitter.get_parse_root(file_path, content, opts)
local fast = opts.fast ~= false
local ft = lib.files.detect_filetype(file_path)
local lang = require("nvim-treesitter.parsers").ft_to_lang(ft)
local lang = vim.treesitter.language.get_lang(ft) or ft
nio.scheduler()
local lang_tree = vim.treesitter.get_string_parser(
content,
Expand Down

0 comments on commit b04332c

Please sign in to comment.