Open k-ode opened 9 years ago
I've noticed that too. I don't know what causes that, but it's a problem on the server side.
I remember doing some hack on the server side to just ignore that error but unfortunately I don't think it's released. @nosami any idea? Have you had this happen?
Could you point me in the direction to where you applied that hack? I could problaby figure something out if I just knew where to look.
The way I did it was on the server side. I looked at the endpoint for codecheck
, and before returning any value from the server to omnisharp-emacs, I would do a filter to drop out the invalid value.
It's pretty ugly as an idea, but extremely practical :)
Great, thanks! In case anyone else is wondering, I simply filtered the semantic errors in CodeCheckHandler.cs like this:
Hehe, nice! :D
@nosami do you think this could BE a useful hack to have on the server side BT default? At least until omnisharp-roslyn is released, if you can call it a release. 9.6.2015 11.48 ap. "Kim Grönqvist" notifications@github.com kirjoitti:
Great, thanks! In case anyone else is wondering, I simply filtered the semantic errors in CodeCheckHandler.cs like this:
[image: image] https://cloud.githubusercontent.com/assets/3421067/8053902/f44b2b1a-0e94-11e5-8138-6e2681f18d36.png
— Reply to this email directly or view it on GitHub https://github.com/OmniSharp/omnisharp-emacs/issues/174#issuecomment-110279832 .
It would be nice to have a setting to ignore code issues messages. Also they should problaby be shown as warnings, not errors. I made a quick fix for that here:
(defun omnisharp--flycheck-error-parser-raw-json
(output checker buffer &optional error-level)
"Takes either a QuickFixResponse or a SyntaxErrorsResponse as a
json string. Returns flycheck errors created based on the locations in
the json."
(let* ((json-result
(omnisharp--json-read-from-string output))
(errors (omnisharp--vector-to-list
;; Support both a SyntaxErrorsResponse and a
;; QuickFixResponse. they are essentially the same,
;; but have the quickfixes (buffer locations) under
;; different property names.
(cdr (or (assoc 'QuickFixes json-result)
(assoc 'Errors json-result))))))
(when (not (equal (length errors) 0))
(mapcar (lambda (it)
(flycheck-error-new
:buffer buffer
:checker checker
:filename (cdr (assoc 'FileName it))
:line (cdr (assoc 'Line it))
:column (cdr (assoc 'Column it))
;; A CodeIssues response has Text instead of Message
:message (cdr (or (assoc 'Message it)
(assoc 'Text it)))
:level (if (equal (cdr (assoc 'LogLevel it)) "Warning")
'warning
'error)))
errors))))
Edit: Too many errors reported was a bug on my end.
Sorry for not replying to this sooner. You can configure the issues/errors that come back here https://github.com/OmniSharp/omnisharp-server/blob/master/OmniSharp/config.json#L28-L31
Thanks! Should I close this and create a new issue in omnisharp-server?
@kimgronqvist No. Well, you could, but it won't get fixed - omnisharp-server is a dead project and is being replaced with omnisharp-roslyn. I don't have time to work on both.
edit: PRs will still be accepted though :)
In most cases, Flycheck works great for catching errors. I do get some weird errors in a file that is otherwise error free though.
Method calls within a file report "Invocation error: AmbigousMatch".
You can reproduce this by running Flycheck on Program.cs in the omnisharp-server project.