Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:02:45+00:00 2026-06-15T19:02:45+00:00

Given a C# compiler message like this, when warnings-as-errors is turned on: File.cs(3,1415): error

  • 0

Given a C# compiler message like this, when warnings-as-errors is turned on:

File.cs(3,1415): error CS1572: Warning as Error: XML comment on 'FooLibrary.Foo.Foo()' has a param tag for 'foo', but there is no parameter by that name

I would like to have my errorformat marking it as type warning rather than type error.

I already have such values in my errorformat as:

%f(%l\\,%c):\ %trror\ %m^M
%f(%l\\,%c):\ %trror\ %m

(Whenever you see ^M, know that it is the actual control code in my file, but it doesn’t transmit well to the web. Suffice it to indicate that the C# compiler outputs \r\n rather than just \n, and this is a Mild Nuisance.)

Here is what I first tried:

%f(%l\\,%c):\ error\ %m: %tarning\ as\ Error:\ %m^M
%f(%l\\,%c):\ error\ %m: %tarning\ as\ Error:\ %m

Vim bemoaned the fact that it couldn’t deal with multiple occurrences of %m in the one string.

So then I started getting fancy with unusual regular expressions incorporating assertions. Here is what I tried:

%f(%l\\,%c):\ error\ %\\(%[A-Z0-9]%#:\ %tarning\ as\ Error:\ %[%^^M]%#%\\)%\\@=%m^M
%f(%l\\,%c):\ error\ %\\(%[A-Z0-9]%#:\ %tarning\ as\ Error:\ %[%^^M]%#%\\)%\\@=%m

This didn’t work; it gets type “C” (presumably from “CS1572”) and message “W” (the value which %t should be consuming). (In some other experimentation, omitting the %t, it proved necessary to consume the rest of the string inside the assertion, or else it stopped its match of %m at that point. Very strange.)

Perceiving that it was not treating them as regular expression groups, as they might be, but rather in a peculiar linear manner, I then tried reversing the assertions and wound up with this:

%f(%l\\,%c):\ error\ %\\(%m^M%\\)%\\@=%[A-Z0-9]%#:\ %tarning\ as\ Error:\ %.%#^M
%f(%l\\,%c):\ error\ %\\(%m^M%\\)%\\@=%[A-Z0-9]%#:\ %tarning\ as\ Error:\ %.%#

Unfortunately, these also fail, getting type “C” rather than “warning” and (though getting the message intact, at last) leaving the ^M on the end of the string.

I’ve exhausted the possibilities that I can think of inside the errorformat command; is there aught else which might resolve this matter, or would I need to resort to running another script to wrap it which would turn the format into something that Vim could cope with?

(All that for getting the word “warning” rather than “error” in the quickfix list. Sad, isn’t it?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:02:47+00:00Added an answer on June 15, 2026 at 7:02 pm

    If you are not fine with

    set efm=%f(%l\\,%c):\ error\ %[A-Z0-9]%#:\ %tarning\ as\ Error:\ %m
    

    which will drop error number then I can suggest you using

    set efm=%f(%l\\,%c):\ %m
    

    and post-processing the list with

    function QFPostProc(location)
        let qflist=[]
        for entry in (a:location?getloclist(0):getqflist())
            " Using the fact that “%tarning” can match only warnings 
            " thus unconditionally setting type to 'W'
    
            " Replace 'W' with something like
            "     matchstr(entry.text, '\u\ze\a\+ as Error')
            " if this is not true.
            call add(qflist, extend(entry, {'type': 'W'}))
        endfor
        if a:location
            call setloclist(0, qflist, 'r')
        else
            call setqflist(qflist, 'r')
        endif
    endfunction
    

    . This should be called like

    :make | call QFPostProc(0)
    

    or

    :lmake | call QFPostProc(1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm curious to know why the C# compiler only gives me an error message
g++ compiler gives this error: expected `;' before 'it' template <typename T> class myList
I get the warning controlling expression is constant on assert statement like this: assert(...
Given a declaration like this: class A { public: void Foo() const; }; What
I'm aware of this question which mentions Boost's STATIC WARNING, but I'd like to
Is there a standard/common way to give compiler-style error messages that point to a
The compiler, given the following code, tells me Use of unassigned local variable 'x'.
I have been given some matlab code compiled using the .net compiler. I can
I want the Java compiler to give me the highest level of warnings possible.
The compiler doesn't give me any error and the code runs. Just curious how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.