-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Flycheck doesn't recognize localized error messages from html-tidy #1376
Comments
Looks like a translation issue to me. Do you know if there's a way to make your version of html-tidy print "Warning" instead of "Avertissement"? |
I couldn't set 'language: en' in a config file to modify tidy's output, that option wasn't recognized (despite the man page saying it should be, it just triggered an error). I therefore manage to recompile tidy with localization support disabled. Now it works properly with flycheck. It is indeed a translation issue. |
Great, thanks for testing |
Maybe there's an environment variable we could set to force English? |
But that will give untranslated messages, which is unfortunate. The best would be for tidy to give us structured output, like JSON or XML. |
Agreed. If users want to see error messages in their own language, they should be able to do so. |
@MaxLanar , how motivated do you feel about this? :) Would you like to investigate? |
I'm willing to help but I'm not sure I'm skilled enough for this... I'm not a (professional) dev at all (I sometimes play with html/css/bash, that's all). I'm not even sure I understand what need to be investigated. Can you be more specific ? |
Yes, of course :) And thanks! What would be great is to check whether we can make do with what html-tidy currently produces, or whether we'll have to ask them for a patch. To determine this, it'd be ideal to check the following:
If the answer is no to both of these, the natural next step is to open a feature request with the html-tidy devs, requesting a JSON or XML output option, that we could use in Flycheck :) Thanks! |
I see, it's no big deal then ! I'll do it, no problem. :) |
Great, thanks a lot! Keep us posted :) We'd love Flycheck to work better in localized environments. |
Okay, here is the results of my investigation :
I'll drop a mail to the public mailing list, then, (if I got no answers,) open a feature request on their github (referencing our issue). Sounds good to you ? As a workaround, waiting for a change from tidy, maybe flycheck could be made to add '-lang en' (that option doesn't work in a config file but do work as a parameter) to tidy's call ? That way non-english users could use flycheck without having to recompile tidy with localization disabled (and for example still have the benefit of being able to use tidy in their terminal and get output in their own language). |
Sounds perfect. Great work! |
Gents, I'm here as a result of a message posted to the html-tidy dev list last night. I'm one of the Tidy developers (mostly in "offline" mode right now), but we're happy to entertain feature requests. Our roadmap is largely request driven, and so far, no one's made a request for JSON, etc. A couple of things to understand, though, is that Tidy is two things: it's a C library that offers Tidy's services, but it's also a command line client that uses the library in interactive shells. Granted, over the years a lot of folks have adapted the command line client in a lot of ways that weren't really intended, given the C library and the ability of pretty much any language to work with C libraries. When it comes to JSON, I'm probably the dev that would support it, and it wouldn't be horribly difficult to implement as a command line client option (not a configuration option), but I can't help but ask if the better solution wouldn't be for you to connect to the library directly? The library now offers an awesome callback-based API for collecting all of its output messages, and is designed to be language agnostic (i.e., the default English strings and localized strings are exposed). In any case, feel free to open a feature request. |
@balthisar Thanks for chiming in. I think calling the C library directly is unfortunately not an option for us. The only way to call the library, as far as I can tell, would be to write a dynamic module for Emacs that would call into the Tidy library. Emacs dynamic modules are a compile-time opt-in, so it would not work for most of our users who install Emacs via binary packages that do not include this option. Good to hear you are open to requests then ;) |
Localized error messages also localize the diagnostic type (e.g. "Warning" becomes "Avertissement" in French), which make them unparseable by Flycheck. Forcing English messages makes Flycheck parse the diagnostic correctly, at the cost of losing the localization. This is a partial fix for GH-1376.
@balthisar Thanks for joining the discussion. We'd love to get JSON output. |
Giving you JSON would actually be a bit easier than giving an option to only translate some of the strings. The string lookup service is kind of an all or nothing thing. I suppose we fake another language, e.g., French, but leave only the desired strings untranslated. This would be a horrible maintenance nightmare for us, though. Would one of you mind filing a feature request over at our issues tracker? I can't promise high priority, but if it gets support, it can happen eventually, and if I get some time away from the newborn, I might actually be able to get it out fairly quickly. |
I'll do it tonight ! |
Will this be fixed? |
@paxperscientiam From the linked issue, it doesn't look like tidy has gotten JSON output support yet. If you want this fixed, I suggest helping out with that on tidy's side. |
Your Flycheck setup from
M-x flycheck-verify-setup
Syntax checkers for buffer index.html in html-mode:
html-tidy
Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled
checkers.
Flycheck version: 32snapshot (package: 20171214.1215)
Emacs version: 24.5.1
System: x86_64-pc-linux-gnu
Window system: x
Your operating system
debian stretch
Your Emacs version from
M-x emacs-version
24.5.1 by debian
Hello,
I've installed tidy from the debian repo, then with the last binary (5.4.0) provided by http://binaries.html-tidy.org/ then I compiled the 5.7.0 from source. Anyway, I always got those kind of errors:
And then sadly the checking do not work. (but for example it works OK with bash code with shellcheck)
I think I've done everything right, so I'm reporting the issue.
Let me know if I can do/check anything more.
The text was updated successfully, but these errors were encountered: