Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

feat(builtins): add textidote #1509

Closed
wants to merge 2 commits into from
Closed

feat(builtins): add textidote #1509

wants to merge 2 commits into from

Conversation

igorlfs
Copy link
Contributor

@igorlfs igorlfs commented Apr 11, 2023

Hello there,

I'm trying to close #1312, but I'm having some issues.

First things first: let's define a sample file to understand textidote's output:

\documentclass{article}

\begin{document}

This documnet contians erors.

\end{document}

If I run textidote --quiet --no-color --check en --output singleline sample.tex, this gets printed to stdout:

sample.tex(L5C6-L5C14): Possible spelling mistake found.. Suggestions: [document] (6) "This documne
t contians erors."
sample.tex(L5C15-L5C23): Possible spelling mistake found.. Suggestions: [contains] (15) "This docum
net contians erors."
sample.tex(L5C24-L5C29): Possible spelling mistake found.. Suggestions: [errors, Eros, errs] (24) "
This documnet contians erors."

I then defined the following pattern: [[(.*)(L(%d+)C(%d+)-L(%d+)C(%d+)): (.*)]]. However, I'm getting the following warning:

failed to run generator: null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:219: error in generator output: 
/path/to/sample.tex(L5C6-L5C14): Possible spelling mistake found.. Suggestions: [document] (6) "This documnet contians erors."
/path/to/sample.tex(L5C15-L5C23): Possible spelling mistake found.. Suggestions: [contains] (15) "This documnet contians erors."
/path/to/sample.tex(L5C24-L5C29): Possible spelling mistake found.. Suggestions: [errors, Eros, errs] (24) "This documnet contians erors."

I tried enabling debug mode (here's the log), which suggests the output is going to stderr instead:

[TRACE Tue 11 Apr 2023 11:15:43 AM -03] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:204: **error output**: /path/to/sample.tex(L5C6-L5C14): Possible spelling mistake found.. Suggestions: [document] (6) "This documnet contians erors."

However, if I try to enable from_stderr (currently not pushed), while I don't get any warnings, I don't get any diagnostics either. Here's a log with from_stderr enabled. What's going on? Do I just have a faulty pattern, or am I missing something else?

Besides that, I have another remark: currently, I'm hard-coding the language to check as English, which is not ideal, users might want to use another language (myself included). What would be the best approach to allow users to change it dynamically?

@jose-elias-alvarez
Copy link
Owner

When from_stderr is enabled, the log will still show the output as error output (arguably misleading, but the goal is to clarify which stdio channel it came from). I think there's an issue with your pattern.

As for the language issue: you can either override the default arguments and include an example in the documentation or use a dedicated config option.

@tiagovla
Copy link
Contributor

tiagovla commented Jul 4, 2023

@igorlfs are you still working on this? (.*)%(L(%d+)C(%d+)-L(%d+)C(%d+)%): (.*) should fix it.

@igorlfs
Copy link
Contributor Author

igorlfs commented Jul 4, 2023

Hey @tiagovla, I just tried using your pattern without success :(

It seems like the underlying issue isn't the pattern, I might have messed the output handling (I don't really know null-ls's inner workings). If you really wanna see this merged, I'd recommend opening your own PR using this one as inspiration, but taking a deeper dive into null-ls.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add textidote builtin
3 participants