-
Notifications
You must be signed in to change notification settings - Fork 15
144 lines (131 loc) · 5.37 KB
/
test.yml
File metadata and controls
144 lines (131 loc) · 5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Tests
on:
push:
branches: [ "*" ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Neovim
run: sudo snap install nvim --classic
- name: Install Plenary
run: |
mkdir -p $HOME/.local/share/nvim/lazy/
git clone https://github.com/nvim-lua/plenary.nvim.git
mv plenary.nvim $HOME/.local/share/nvim/lazy/
- name: Install nvim-treesitter
run: |
mkdir -p $HOME/.local/share/nvim/lazy/
# TODO specifying 0.10.0 is a workaround - something later than it is
# breaking ts/java comment nodes
git clone --depth 1 --branch v0.10.0 https://github.com/nvim-treesitter/nvim-treesitter.git
mv nvim-treesitter $HOME/.local/share/nvim/lazy/
# Ensure clean parser directory for consistent builds
rm -rf $HOME/.local/share/nvim/lazy/nvim-treesitter/parser
- name: Run luacheck type check / linter
run: |
sudo apt-get install lua-check -y --no-install-recommends
make check
- name: Check for errant util calls
run: make no-utils
- name: Inspect Parser Environment (Pre-Test)
run: |
echo "=== Neovim Version ==="
nvim --version | head -3
echo ""
echo "=== System Info ==="
uname -a
gcc --version | head -1
echo ""
echo "=== nvim-treesitter Git Info ==="
cd $HOME/.local/share/nvim/lazy/nvim-treesitter
git log --oneline -1
git describe --tags --always
echo ""
echo "=== Parser Directory State (Before Tests) ==="
ls -lah $HOME/.local/share/nvim/lazy/nvim-treesitter/parser/ 2>&1 || echo "Parser directory does not exist yet"
- name: Run Tests
run: make test
- name: Inspect Parser Binaries (Post-Test)
if: always()
run: |
echo "=== Parser Directory State (After Tests) ==="
ls -lah $HOME/.local/share/nvim/lazy/nvim-treesitter/parser/
echo ""
echo "=== Parser Binary Checksums ==="
cd $HOME/.local/share/nvim/lazy/nvim-treesitter/parser/
for parser in *.so; do
echo "File: $parser"
ls -lh "$parser"
md5sum "$parser"
file "$parser"
echo ""
done
echo ""
echo "=== TypeScript Algorithm Trace ==="
cd $GITHUB_WORKSPACE
cat > /tmp/trace_ts.lua << 'EOFTRACE'
vim.fn.cursor(121, 3)
local nodes = require("treewalker.nodes")
local strategies = require("treewalker.strategies")
local node = nodes.get_at_row(121)
print("=== Complete algorithm trace ===")
print("1. Input node from get_at_row(121):")
print(" Type:", node:type())
print(" Scol:", nodes.get_scol(node))
print("")
local highest = nodes.get_highest_row_coincident(node)
print("2. After get_highest_row_coincident:")
print(" Type:", highest:type())
print(" Scol:", nodes.get_scol(highest))
print("")
print("3. Tracing get_first_ancestor_with_diff_scol:")
local original_scol = nodes.get_scol(highest)
print(" original_scol =", original_scol)
local starting = highest
print(" Escape augment targets:")
while starting and nodes.is_augment_target(starting) do
print(" -", starting:type(), "is augment, escaping to parent")
starting = starting:parent()
end
print(" starting_node =", starting and starting:type() or "NIL")
print("")
if starting then
print(" Walking ancestors:")
local iter = starting:parent()
while iter do
print(" -", iter:type(), "scol=" .. nodes.get_scol(iter), "is_jump_target=" .. tostring(nodes.is_jump_target(iter)))
if nodes.is_jump_target(iter) and nodes.get_scol(iter) ~= original_scol then
print(" >> FOUND! Returning", iter:type())
break
end
iter = iter:parent()
end
end
print("")
print("4. Final result:")
local result = strategies.get_first_ancestor_with_diff_scol(highest)
if result then
print(" Type:", result:type())
print(" Scol:", nodes.get_scol(result))
else
print(" NIL")
end
EOFTRACE
nvim --headless -u tests/minimal_init.lua \
-c "edit tests/fixtures/typescript.ts" \
-c "lua vim.treesitter.get_parser():parse()" \
-c "luafile /tmp/trace_ts.lua" \
-c "quitall" 2>&1 || echo "TypeScript trace failed"
echo ""
echo "=== Dump Java Test Tree Structure ==="
nvim --headless -u tests/minimal_init.lua \
-c "edit tests/fixtures/java.java" \
-c "lua vim.treesitter.get_parser():parse()" \
-c "lua vim.fn.cursor(31, 1)" \
-c "lua local nodes = require('treewalker.nodes'); local node = nodes.get_highest_node_at_current_row(); print('Node at 31,1 (using get_highest_node_at_current_row):'); print(' Type:', node:type()); print(' Is comment?', nodes.is_comment_node(node)); print(' Is augment target?', nodes.is_augment_target(node)); print(' Srow:', nodes.get_srow(node)); local p = node:parent(); if p then print(' Parent:', p:type()) end" \
-c "quitall" 2>&1 || echo "Tree dump failed"