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

Flycheck reporting strange errors #174

Open
k-ode opened this issue May 29, 2015 · 9 comments
Open

Flycheck reporting strange errors #174

k-ode opened this issue May 29, 2015 · 9 comments

Comments

@k-ode
Copy link
Contributor

k-ode commented May 29, 2015

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.

image

@mikavilpas
Copy link
Contributor

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?

@k-ode
Copy link
Contributor Author

k-ode commented Jun 8, 2015

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.

@mikavilpas
Copy link
Contributor

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 :)

@k-ode
Copy link
Contributor Author

k-ode commented Jun 9, 2015

Great, thanks! In case anyone else is wondering, I simply filtered the semantic errors in CodeCheckHandler.cs like this:

image

@mikavilpas
Copy link
Contributor

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
#174 (comment)
.

@k-ode
Copy link
Contributor Author

k-ode commented Jun 9, 2015

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.

@nosami
Copy link
Contributor

nosami commented Jun 9, 2015

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

@k-ode
Copy link
Contributor Author

k-ode commented Jun 12, 2015

Thanks! Should I close this and create a new issue in omnisharp-server?

@nosami
Copy link
Contributor

nosami commented Jul 20, 2015

@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 :)

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

No branches or pull requests

4 participants