88 Commits (master)

Author SHA1 Message Date
blob42 7efc6653ec fix for nvim 0.9+ 9 months ago
Stephan Seitz 2b81a018a4 fix: only have one source of `get_node_text` (nvim-treesitter.compat)
PR #120 used nvim-treesitter.compat in some occasions but not all:
https://github.com/nvim-treesitter/playground/pull/120/files

This made nvim-treesitter-playground incompatible with older
Neovim versions https://github.com/nvim-treesitter/playground/pull/120#issuecomment-1509140602

Although, we generally only support latest Neovim stable this is a
unnecessary inconsistency in the code base. Also when, ts_compat should
be removed in future it should there will be only one source of
`get_node_text` that can then be swapped consistently around the whole
code base. nvim-treesitter-playground is especially useful for older
Neovim versions that don't have the built-in playground yet.
1 year ago
monaqa 934cb4c4ad
fix: pcall vim.treesitter.language.inspect (#121) 1 year ago
Tom van Dijk db54848c7d
fix: update deprecated `vim.treesitter` calls (#120)
ref: neovim/neovim@cbbf8bd
1 year ago
Stephan Seitz 4044b53c4d
Merge pull request #115 from yutkat/master
fix: rename ts_utils.is_in_node_range -> vim.treesitter.is_in_node_range
1 year ago
Yuta Katayama f626642261
fix: rename ts_utils.is_in_node_range -> vim.treesitter.is_in_node_range 1 year ago
Otto Modinos f2ae937170 fix: stylua 1 year ago
Otto Modinos a3757e6210 feat(query_linter)!: remove use_virtual_text
I believe `use_diagnostics` is superior in every way
1 year ago
Otto Modinos d1fb4bf0fd refactor(query_linter): do all the decorations in one place
This also replaces the apparently deprecated `nvim_buf_set_virtual_text`
with `nvim_buf_set_extmark`
1 year ago
Otto Modinos 1445e0c01e feat(query_linter): add new option use_diagnostics
Adds a new option (enabled by default) for the query_linter that uses
the builtin `vim.diagnostic` "framework" to display any errors found.

Disable `use_virtual_text` by default.
1 year ago
ObserverOfTime dcfd1f9974
fix: highlight groups are off by one 1 year ago
figsoda 01c27f37a1 fix: peacefully ignore query files without a valid language 1 year ago
kraem 1d392660f3 fix: use current buf for get_node_text in on_query_cursor_move 1 year ago
Stephan Seitz 632b649a37 chore: replace deprecated ts_utils.get_node_text
Fixes #101
1 year ago
Christian Clason e6a0bfaf9b fixup: lint 2 years ago
Christian Clason e98525259c fixup: include @ in capture name 2 years ago
Christian Clason 546d2df7c1 fix: show captures == hlgroups in playground 2 years ago
Stephan Seitz bcfab84f98
fix: handle errors in query editor (#93)
Fixes #86
2 years ago
Stephan Seitz 49e5dd2b6c
fix: update tree-sitter mappings (#92) 2 years ago
Stephan Seitz 90d2b3e172
Merge pull request #87 from aarondiel/highlight-fallback
fix(fallback for show_hl_captures)
2 years ago
Christian Clason a0aeb6af82
fix: adapt to breaking change on master (#90)
This is a stop-gap fix to avoid errors on latest master after neovim/neovim#19931

This at least gives useful information (the capture name, albeit without leading @), but a full rewrite is needed once nvim-treesitter decides on how to handle the upstream changes to highlight group names.
2 years ago
aarondiel e03ba6cb60 fix(fallback for show_hl_captures) 2 years ago
mohsen ce7e4b7575
fix: check for nil last line (#83)
prevent error when focusing playground after closing buffer
2 years ago
Christian Clason 71b00a3c66
fixup: use new api for keymap (#78) 2 years ago
Christian Clason dd250b05d4
feat!: update to Neovim 0.7 APIs (#75) 2 years ago
Pedro Castro 13e2d2d63c
feat: add TSNodeUnderCursor (#74)
add `hl-info.show_ts_node({opts})` to show tree-sitter node under cursor, exposed via `:TSNodeUnderCursor`
2 years ago
Christian Clason 7dbcd4d647
fix(playground): show highlight groups (#71) 2 years ago
Santos Gallegos 0198ef4a0c
Pass the query_bufnr explicitly to get_node_text (#73)
Fixes https://github.com/nvim-treesitter/playground/issues/53
2 years ago
Santos Gallegos 9df82a27a4
Fix local hl on `:TSHighlightCapturesUnderCursor` (#61)
This code depended on an internal cache that stored the names,
but it was changed to store the id 2460f0a702.

There is `nvim_get_hl_by_id`, but that doesn't return the name (just the
final values of the colors). So, I'm just duplicating this part 6a92a53c02/runtime/lua/vim/treesitter/highlighter.lua (L81-L93)

Fixes https://github.com/nvim-treesitter/playground/issues/60
2 years ago
dskleingeld 1eca93284f
playground keybindings no longer recursive, fixes #52 3 years ago
Stephan Seitz cc663ee53b Improvements for TSHighlightCapturesUnderCursor
- show priority
- show both syntax and tree-sitter if both are enabled
3 years ago
Santos Gallegos d9a9b44e6d Playground: check for nodes out of range (EOF)
The playground will try to set the cursor
to an invalid position (nvim_win_set_cursor) if the node starts at the EOF mark.

```ruby
def run
  a = <<~EOF
end
```
3 years ago
Stephan Seitz 1dcdf85258
Merge pull request #44 from stsewd/hint-how-to-use
Hint how to use the query editor
3 years ago
Santos Gallegos d208b7999b
Avoid crash: check if the buffer is loaded before calling win_findbuf
Closes https://github.com/nvim-treesitter/playground/issues/33

We should report this to neovim as well
3 years ago
Santos Gallegos dcbbacf638
Hint how to use the query editor
Ref https://github.com/nvim-treesitter/playground/issues/23
3 years ago
Stephan Seitz 520337f02d
Merge pull request #42 from nvim-treesitter/add-ci
Add CI checks
3 years ago
Santos Gallegos b1478ed0db
Use ft_to_lang in guess_query_lang
This together with https://github.com/nvim-treesitter/nvim-treesitter/pull/1495
will the playground work with ecma and html tags
3 years ago
Santos Gallegos efaec4d6d7
Fix linter 3 years ago
Santos Gallegos 13d597ca10
Autoformat 3 years ago
Stephan Seitz 79f71e2bd7 feat: add omnifunc for query filetype 3 years ago
Folke Lemaitre 0756ea839c fix: dont show general hl if it's the same as the lang specific hl 3 years ago
Folke Lemaitre 9658434355 fix: loop over iterator in for loop instead of while true 3 years ago
Folke Lemaitre 4cf329e6d3 feat: improved TSHighlightCapturesUnderCursor 3 years ago
Stephan Seitz a141bf5c97 Make clear that upper-case captures map directly to vim hl-groups
Ref: https://nvim-treesitter.zulipchat.com/#narrow/stream/252274-plugin.2Fnvim-treesitter/topic/gdscript.20bugs/near/235024462
3 years ago
Stephan Seitz 946ebc734a fix: unescape anonymous nodes with escape sequences
This will enable the linter to recognize LaTeX commands like
`\usepackage` though it will appear as `"\\usepackage"` in the
query files.
3 years ago
Stephan Seitz b6e79b53dc fix: formatting 3 years ago
Steven Sojka e377ff111e Merge pull request #28 from theHamsta/configure-keybinding
feat: make keybindings configurable and show help on "?"
3 years ago
Stephan Seitz 1775334cfa feat: make keybindings configurable and show help on "?" 3 years ago
Stephan Seitz 444eab728e
Merge pull request #25 from steelsojka/bugfix/named-highlights
fix(query): get named nodes when not displaying anonymous nodes
3 years ago
Steven Sojka c0c0e124a8 fix(buf): toggle buf window from tree window 3 years ago