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

Annoying error message: ValueError: File is less than 5 lines long; not compiling. #1364

Closed
strrchr opened this issue Feb 7, 2015 · 11 comments

Comments

@strrchr
Copy link

strrchr commented Feb 7, 2015

Annoying error message: ValueError: File is less than 5 lines long; not compiling.
In YouCompleteMe\third_party\ycmd\ycmd\completers\cpp\clang_completer.py
I found: MIN_LINES_IN_FILE_TO_PARSE = 5
Why not change it to zero?

@vheon
Copy link
Contributor

vheon commented Feb 7, 2015

Can you find a C/C++ source code with less than 5 lines worth compiling for completion? Plus ss much as it could be annoying you get that only on new files and not for that long since I presume you're going to write something in that file.

Why not change it to zero?

Why take an empty file, and ask the compiler: "Can you compile this file and give me the available completion at row 0, col 0?"

@Valloric
Copy link
Member

Valloric commented Feb 7, 2015

@strrchr The reason for the restriction is that there were problems with libclang and compiling files with no lines of code in it. This error prevents more confusing errors coming from the compiler.

@Valloric Valloric closed this as completed Feb 7, 2015
@strrchr
Copy link
Author

strrchr commented Feb 10, 2015

The raised ValueError interrupts me when I switch buffers.
I just want YouCompleteMe keep silent when I switch buffers.
How to make it silent?

@Eddy0402
Copy link

I think you can try to change line 259 of clang_completer.py
from raise ValueError( FILE_TOO_SHORT_MESSAGE ) to return
as a workaround solution

@Alaya-in-Matrix
Copy link

I think at least it shoud be a warning instead of error.
it is OK that YCM won't compile files less than five lines,
but it is not necessary to let users know that.

@oblitum
Copy link
Contributor

oblitum commented Apr 6, 2015

I think at least it shoud be a warning instead of error.
it is OK that YCM won't compile files less than five lines,
but it is not necessary to let users know that.

+1

@oblitum
Copy link
Contributor

oblitum commented Apr 13, 2015

The part I dislike about this is when creating an empty file with :e foo.cpp for example. This message adds one or two clicks for one to be able to start editing the new file.

@Valloric
Copy link
Member

I think at least it shoud be a warning instead of error.
it is OK that YCM won't compile files less than five lines,
but it is not necessary to let users know that.

We used to not inform the users that completion doesn't work when fewer than 5 lines are in the file, and then we had a HUGE number of users complaining that YCM doesn't work for them because they'd install it and try it out on a file with fewer than 5 lines in it.

@oblitum
Copy link
Contributor

oblitum commented Apr 15, 2015

I think at least it shoud be a warning instead of error.
it is OK that YCM won't compile files less than five lines,
but it is not necessary to let users know that.

We used to not inform the users that completion doesn't work when fewer than 5 lines are in the file, and then we had a HUGE number of users complaining that YCM doesn't work for them because they'd install it and try it out on a file with fewer than 5 lines in it.

It seems a pattern that such messages can mostly increase over time. Hence it's worth analyzing to put such pattern behind a gate, an option for the ones already experienced with the plugin. This is the most fair behavior I think.

@dmari
Copy link

dmari commented Apr 15, 2015

The message is quite annoying, so +1 for option for disabling this behaviour

@Eddy0402
Copy link

I think you can provide a option to disable this warning, and prompt how to use the option in the warning message.

@ycm-core ycm-core locked and limited conversation to collaborators Apr 16, 2015
homu added a commit that referenced this issue Jun 22, 2015
Redraw the screen before displaying a message

There has been several complaints about the message "ValueError: File is less than 5 lines long; not compiling". See issues #814, #1364, #1544. In fact, I believe the issue is not the message itself but the infamous "Press ENTER or type command to continue" prompt when editing a new C-family file.

For example, if I create the file `foo.c`, Vim will display the line `"foo.c" [New file]` and then YouCompleteMe will display `ValueError: File is less than 5 lines long; not compiling`. Since there are now two lines, the hit-enter message is prompted. By redrawing the screen just before displaying the message from YouCompleteMe, only one line appears and we avoid this behavior.

Tested on Linux and Windows.

CLA signed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants