Comments (18)
@justinmk For #trim!
to address this, would it need to not just trim empty lines, but also whitespace from the beginning & end of (all lines in the) region?
from tree-sitter-vimdoc.
No thanks, I have a PR otw
from tree-sitter-vimdoc.
hopefully will be addressed when #trim!
is upstreamed. offset!
also is worth noting.
nvim-treesitter/nvim-treesitter#2850
from tree-sitter-vimdoc.
As is, #trim!
would not help here as you noticed. We'd need a new variant that works horizontally (only), or add a keyword that controls the mode.
from tree-sitter-vimdoc.
proposed workaround: #28
from tree-sitter-vimdoc.
metadata[capture_id].range
isn't working like I'd expect on v0.8.0, at least given the #offset!
examples I've seen. Here's some debug output from nvim-treesitter-playground using this in highlights.scm
(all other (#set! conceal "")
directives commented out):
(tag
text: (_) @label)
(tag
"*" @conceal (#set! conceal "")
(#match? @conceal "^\\*$")
text: (_))
(tag
"*" @conceal.left (#set! conceal "")
(#offset! @conceal.left 0 0 0 -2)
(#match? @conceal.left "^\\s+\\*$")
text: (_))
You can see that the modified range for the "*"
anonymous node should cause all but *
(column range 49–51) to be concealed, but the whole node range is still concealed.
I attempted to do this without match, but there seems to be some interesting behavior with sibling ordering & anonymous nodes:
(tag
text: (_) @label)
(tag
text: (_)
"*" @conceal.right (#set! conceal "")
) ; @mytest
; (tag
; "*" @conceal (#set! conceal "")
; (#match? @conceal "^\\*$")
; text: (_)
; )
(tag
"*" @conceal.left (#set! conceal "")
; (#offset! @conceal.left 0 0 0 -2)
; (#match? @conceal.left "^\\s+\\*$")
text: (_)
)
@conceal.right
is properly applied only after a sibling text: (_)
, but @conceal.left
applies to both.
Also, for some bonus fun, if I uncomment that ; @mytest
capture on the pattern containing @conceal.right
:
@mytest
is now a capture that has metadata.conceal
set! This feels pretty wrong and I'm worried it's a tree-sitter problem.
from tree-sitter-vimdoc.
from tree-sitter-vimdoc.
Also have this bug.
from tree-sitter-vimdoc.
Some cases are still not fixed. For example, Whitespace is still getting trimmed when you only have tags on a line like
*:setl* *:setlocal*
Becomes
:setl :setlocal
from tree-sitter-vimdoc.
Yes, seems like whitespace is included in the first node of a line. Not sure why.
from tree-sitter-vimdoc.
Also happens with links; see, e.g., api.txt
, line 1547f (and many other places).
from tree-sitter-vimdoc.
Links that are the first node in the line..?
from tree-sitter-vimdoc.
Yes.
from tree-sitter-vimdoc.
This actually happens for all nodes as far as I can see: check line 22 of api.txt
with hi link @text.uri Underlined
-- the underline extends to the beginning of the line.
from tree-sitter-vimdoc.
Even with current HEAD? Is the issue fixed with 31fcaca ?
from tree-sitter-vimdoc.
Is that in core?
from tree-sitter-vimdoc.
not yet
from tree-sitter-vimdoc.
Ah, OK. Want me to bump the parser and queries, or is there something you'd like to hold out for?
from tree-sitter-vimdoc.
Related Issues (20)
- Missing newline in pattern docs HOT 1
- h3 uppercase_name does not recognize "A AA" as a headline
- Vimdoc parser breaks down around LOCAL ADDITIONS in the help section HOT 8
- Any example of "vimdoc's endless quirks" ? HOT 3
- Argument in some functions is not recognized if not preceded by whitespace
- `'*'` gets parsed as `tag` HOT 2
- Wrong detection of autocmd paragraph HOT 2
- improve URL parsing HOT 1
- pseudo-heading (right-aligned tag) HOT 4
- Keycode at beginning of a line is not recognized
- License inconsistency between crate and LICENSE file HOT 9
- unclosed backtick space starts a codespan HOT 1
- Weird highlights due to children of (code) node HOT 5
- 4f8ba9e causes error in checkhealth HOT 2
- Whitespace handling for table line items HOT 2
- codeblock adjacent to list item is not recognized HOT 5
- `:help` docs look broken HOT 16
- support tables HOT 8
- More structured headings
- `~` is not concealed when the line is below `============` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tree-sitter-vimdoc.