syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.7k stars 4.9k forks source link

Maximum number of diagnostics exceeded. #10943

Closed jvillasante closed 6 years ago

jvillasante commented 6 years ago

Description :octocat:

Using ycm I get 'Maximum number of diagnostics exceeded' on a file that otherwise compiles without warnings or errors.

Here's my ycmd debug info:

Ycmd debug information for buffer main.cpp in c++-mode:

((python
  (executable . "/usr/local/opt/python@2/bin/python2.7")
  (version . "2.7.15"))
 (completer
  (items
   ((value . "None")
    (key . "compilation database path"))
   ((value . "[u'-std=c++17', u'-x', u'c++', u'-stdlib=libc++', u'-Wall', u'-Wextra', u'-Werror', u'-pedantic', u'-DDEBUG', u'-Wno-gnu-case-range', u'-isystem', u'/usr/local/opt/llvm/include', u'-isystem', u'/usr/local/opt/llvm/include/c++/v1', u'-I', u'.', u'-resource-dir=/Users/jvillasante/Hacking/software/ycmd/ycmd/../clang_includes', u'-isystem', u'/Library/Developer/CommandLineTools/usr/include/c++/v1', u'-isystem', u'/usr/local/include', u'-isystem', u'/Library/Developer/CommandLineTools/usr/include', u'-isystem', u'/usr/include', u'-isystem', u'/System/Library/Frameworks', u'-isystem', u'/Library/Frameworks', u'-isystem', u'/Library/Developer/CommandLineTools/usr/lib/clang/9.1.0/include', u'-isystem', u'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include', u'-fspell-checking']")
    (key . "flags"))
   ((value . "/Users/jvillasante/Downloads/test_cpp/src/main.cpp")
    (key . "translation unit")))
  (name . "C-family")
  (servers))
 (extra_conf
  (path . "/Users/jvillasante/Downloads/test_cpp/.ycm_extra_conf.py")
  (is_loaded . t))
 (clang
  (has_support . t)
  (version . "clang version 6.0.0 (tags/RELEASE_600/final)")))

Server is running at: 127.0.0.1:50486

Ycmd Mode is enabled

--------------------

Ycmd version:   1.3snapshot (package: 20180520.353)
Emacs version:  26.1
System:         x86_64-apple-darwin17.6.0
Window system:  mac

Here's my ycm_extra_conf.py

flags = [
  '-std=c++17',
  '-x', 'c++',
  '-stdlib=libc++',
  '-Wall',
  '-Wextra',
  '-Werror',
  '-pedantic',
  '-DDEBUG',
  '-Wno-gnu-case-range',
  '-isystem', '/usr/local/opt/llvm/include',
  '-isystem', '/usr/local/opt/llvm/include/c++/v1',
  '-I', '.',
]

def FlagsForFile( filename ):
  return {
    'flags': flags,
    'do_cache': True
  }

Also, on ycm debug info it can be seen that somehow I get more flags than the ones I defined on my extra config file. Is there a way to solve this?

System Info :computer:

jvillasante commented 6 years ago

It seems that ycmd is trying to parse system files as can be seen in this extract of the ycmd logs

(((kind . "ERROR")
  (text . "use of undeclared identifier 'wcschr'")
  (ranges)
  (location
   (filepath . "/usr/local/opt/llvm/include/c++/v1/wchar.h")
   (column_num . 77)
   (line_num . 137))
  (location_extent
   (start
    (filepath . "/usr/local/opt/llvm/include/c++/v1/wchar.h")
    (column_num . 77)
    (line_num . 137))
   (end
    (filepath . "/usr/local/opt/llvm/include/c++/v1/wchar.h")
    (column_num . 83)
    (line_num . 137)))
  (fixit_available . :json-false))

Is there a way to overcome this?

jvillasante commented 6 years ago

Changing .ycm_extra_config.py to this .ycm_extra_config file solves the issue. This one can be closed.

Compro-Prasad commented 6 years ago

@jvillasante Is this something that can be solved on spacemacs level? If not then this sure can be closed.

jvillasante commented 6 years ago

No, there's nothing that can be done on spacemacs level. I'm closing this.

zhaozheng09 commented 5 years ago

Changing .ycm_extra_config.py to this .ycm_extra_config file solves the issue. This one can be closed.

Changing .ycm_extra_config.py to this .ycm_extra_config file solves the issue. This one can be closed.

if you use python 3 , please replace ur to r, and add decode() to output.

bondhugula commented 4 years ago

Changing .ycm_extra_config.py to this .ycm_extra_config file solves the issue. This one can be closed.

With the current ycm version, this new config file yields the parse error below. Looks like something has to be changed with the line:

regex = re.compile(ur'(?:\#include \<...\> search starts here\:)(?P<list>.*?)(?:End of search list)', re.DOTALL);
ycmd.responses.ServerError: SyntaxError: invalid syntax (.ycm_extra_conf.py, line 7)
2020-05-15 21:09:56,621 - ERROR - Error while handling server response
Traceback (most recent call last):
  File "/net/uday-dev/srv/nfs/uday-data/ws/YouCompleteMe/python/ycm/client/base_request.py", line 73, in HandleFuture
    return _JsonFromFuture( future )
  File "/net/uday-dev/srv/nfs/uday-data/ws/YouCompleteMe/python/ycm/client/base_request.py", line 256, in _JsonFromFuture
    raise MakeServerException( response.json() )
ycmd.responses.ServerError: SyntaxError: invalid syntax (.ycm_extra_conf.py, line 7)

EDIT: I notice the amend needed for Python 3. Could I know what it means to add decode() to output? Thanks.

bondhugula commented 4 years ago

Changing .ycm_extra_config.py to this .ycm_extra_config file solves the issue. This one can be closed.

With the current ycm version, this new config file yields the parse error below. Looks like something has to be changed with the line:

regex = re.compile(ur'(?:\#include \<...\> search starts here\:)(?P<list>.*?)(?:End of search list)', re.DOTALL);
ycmd.responses.ServerError: SyntaxError: invalid syntax (.ycm_extra_conf.py, line 7)
2020-05-15 21:09:56,621 - ERROR - Error while handling server response
Traceback (most recent call last):
  File "/net/uday-dev/srv/nfs/uday-data/ws/YouCompleteMe/python/ycm/client/base_request.py", line 73, in HandleFuture
    return _JsonFromFuture( future )
  File "/net/uday-dev/srv/nfs/uday-data/ws/YouCompleteMe/python/ycm/client/base_request.py", line 256, in _JsonFromFuture
    raise MakeServerException( response.json() )
ycmd.responses.ServerError: SyntaxError: invalid syntax (.ycm_extra_conf.py, line 7)

EDIT: I notice the amend needed for Python 3. Could I know what it means to add decode() to output? Thanks.

Resolved. output -> output.decode() in the for p ... line. Thanks.