Skip to content

Only warn of parsers needed by the current filetype#589

Merged
PMassicotte merged 3 commits into
mainfrom
ft_parsers
Jun 6, 2026
Merged

Only warn of parsers needed by the current filetype#589
PMassicotte merged 3 commits into
mainfrom
ft_parsers

Conversation

@jalvesaq
Copy link
Copy Markdown
Member

@jalvesaq jalvesaq commented Jun 5, 2026

No description provided.

@jalvesaq
Copy link
Copy Markdown
Member Author

jalvesaq commented Jun 5, 2026

The documentation and :checkhealth r only require the r parser, but we check for most parsers on startup. With this pull request, we only check for the parsers required by the current file type.

@jalvesaq
Copy link
Copy Markdown
Member Author

jalvesaq commented Jun 5, 2026

:RDebugInfo was failing to correctly detect the language in the YAML header of a Quarto document as yaml and normal text as markdown_inline. I deleted these two checks.

Comment thread lua/r/config.lua Outdated
if not has_parser(v, parsers) then
swarn(
string.format(
'R.nvim requires the following tree-sitter parsers: "%s". Please, install them.',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small thing

When v is the missing parser, table.concat(needed, ...) still concatenates the entire needed list, not just the missing one. ie. all parser in the table will be printed. I think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, the needed is only {"r"}. The other parsers are inserted into the table according to the current value of filetype. So, they are all needed for the specific file being edited.

Copy link
Copy Markdown
Collaborator

@PMassicotte PMassicotte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Just this message, I think it will print all the needed parsers, not just the missing one.

@jalvesaq
Copy link
Copy Markdown
Member Author

jalvesaq commented Jun 6, 2026

All good! Just this message, I think it will print all the needed parsers, not just the missing one.

I see your point now. It might be better to be specific and warn about the missing one that triggered the warning.

@PMassicotte
Copy link
Copy Markdown
Collaborator

All good with me, maybe ok also to print all. I do not have preference in fact. Lets merge it?

@PMassicotte PMassicotte merged commit 569d566 into main Jun 6, 2026
13 checks passed
@PMassicotte PMassicotte deleted the ft_parsers branch June 6, 2026 13:56
@PMassicotte
Copy link
Copy Markdown
Collaborator

Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants