Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

column_header when tilde is not preceded by space #94

Open
lervag opened this issue Jan 15, 2023 · 10 comments
Open

column_header when tilde is not preceded by space #94

lervag opened this issue Jan 15, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@lervag
Copy link

lervag commented Jan 15, 2023

The Tree-sitter version of the help filetype does not currently support the "column heading" item has a known limitation for handling the column header item. This item is documented in :help help-writing just before :help help-codeblock:

To define a column heading, use a tilde character at the end of the line.
This will highlight the column heading in a different color.  E.g.

Column heading 

(Btw.: I actually believe there may be a slight bug in the help file here, as I think the example should contain the tilde character.)

If the tilde does not have a preceding space, the current parser does not recognize it. So, the following syntax with old style syntax rules

Heading here~
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Should look something like this (depending on color scheme and so on):

image

Edit: I'm sorry, I just realized this was mentioned as a current limitation here. So, if I add a preceding space to the tilde, then it will be parsed correctly. Perhaps this issue then can remain open for handling the case without preceding space? I've reworded it to make it more clear.

@clason
Copy link
Member

clason commented Jan 15, 2023

(Btw.: I actually believe there may be a slight bug in the help file here, as I think the example should contain the tilde character.)

Vimhelp is woefully underspecified... The only full documentation is syntax/help.vim.

On the other hand, this parser is opinionated: If there are multiple valid ways, it will in general only try to support one.

In this case, it (for technical reasons) requires a space before the tilde, so the following does work:

Heading here ~
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

@lervag lervag changed the title Add support for helpHeader Add support for column_header when tilde is not preceded by space Jan 15, 2023
@clason
Copy link
Member

clason commented Jan 15, 2023

Expanding on the technical reason: As this parser does not use an external scanner, it relies on whitespace for separating tokens, so this limitation is by design.

@lervag
Copy link
Author

lervag commented Jan 15, 2023

In the README, it says:

- `column_heading` currently only recognizes tilde `~` preceded by space (i.e.
  `foo ~` not `foo~`). This covers 99% of :help files.

The "currently" seems to indicate that the limitation may be relaxed in the future. I would propose to either

  1. Address this issue and resolve the limitation, or
  2. Specify more clearly that the limitation remains (for technical reasons) and remove the "currently". This issue may then be resolved as "won't fix".

@clason
Copy link
Member

clason commented Jan 15, 2023

I can't speak for @justinmk's plans, but as far as I can tell, this is not a limitation that can be addressed without a massive redesign -- it's not just a 't' that was forgotten to be crossed...

At least from the POV of Neovim itself, the official policy in such cases is to simply change the help files to conform to the stricter spec. This is also the very first sentence of the README...

@lervag
Copy link
Author

lervag commented Jan 15, 2023

Thanks; I'll wait for @justinmk to reply. I don't mind adhering to stricter conventions, of course. But the "currently" in the README makes it sound like this is going to change in the future. If it (most likely) isn't, then it would be easier as a plugin author to adjust accordingly :)

(I probably will now, anyway, but still.)

@clason
Copy link
Member

clason commented Jan 15, 2023

One of my secret hopes is that this parser will eventually serve as an actual, complete, and unambiguous specification for the "help grammar" to make it easier to write -- and generate from other formats like docstrings or Markdown...

@justinmk
Copy link
Member

Not really interested in litigating the presence of "currently", but the readme also mentions:

The first step should always be to try to fix the input rather than insist on a grammar that handles vimdoc's endless quirks.

Anyhoo, improvements are welcome if they don't lead to insane complexity, but otherwise this is likely to remain a "known issue".

@justinmk justinmk added the bug Something isn't working label Jan 15, 2023
@justinmk justinmk changed the title Add support for column_header when tilde is not preceded by space column_header when tilde is not preceded by space Jan 15, 2023
@lervag
Copy link
Author

lervag commented Jan 15, 2023

Thanks; I'll update help files I'm responsible for accordingly.

@clason
Copy link
Member

clason commented Jan 15, 2023

One step closer to enabling tree-sitter highlighting for help files by default :)

@lervag
Copy link
Author

lervag commented Jan 15, 2023

Hehe, I actually already did. Which explains why I opened this issue in the first place; the implication being that I found the tree-sitter highlighting now solid enough to scratch the legacy version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants