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

Error squiggles don't always update when typing #2448

Closed
viridia opened this issue Aug 25, 2018 · 4 comments
Closed

Error squiggles don't always update when typing #2448

viridia opened this issue Aug 25, 2018 · 4 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@viridia
Copy link

viridia commented Aug 25, 2018

Type: LanguageService

Describe the bug

  • OS and Version: Ubuntu 18
  • VS Code Version: 1.26.1
  • C/C++ Extension Version: 0.18.1
  • Other extensions you installed (and if the issue persists after disabling them):
    -- Just the TypeScript linter, which should not be relevant.
  • A clear and concise description of what the bug is.

The red error squiggles sometimes don't update when I finish typing a line of code, leaving behind a persistent incorrect error message & squiggle even though the code is correct. I'm compiling a fairly large project with clang and the delay between typing and error validation is around 1 second. So if I type a name of a symbols that is, say, a dozen characters in 3 seconds, this means that the error check runs 3 times (I assume it is rate-limited). But it doesn't always run a final time when I stop typing.

I often find myself making a trivial change to the file (hitting spacebar + backspace) to force the error validator to run and get rid of the error squiggles.

My guess is that there's an error in the rate-limiting code, whereby if a file gets marked as "dirty" while the error validator is running gets marked as "clean" when the results come back. This is a fairly easy bug to make in a rate limiter, I've seen similar bugs many times. However, that's just a guess.

To Reproduce
Steps to reproduce the behavior:

The error happens frequently but intermittently, depending on how fast I am typing and the size of the project. There's no way to provide a small code sample that will reproduce it since it only happens on large compiles.

c_cpp_properties.json looks like this:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/build/include",
                "${workspaceFolder}/src/compiler",
                "${workspaceFolder}/src/compiler_tests",
                "/usr/include/llvm-6.0"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

User settings:

{
    "editor.rulers": [
        100
    ],
    "editor.fontFamily": "'Hack', 'monospace'",
    "editor.fontSize": 13,
    "files.trimTrailingWhitespace": true,
    "terminal.integrated.fontSize": 12,
    "window.zoomLevel": 0,
    "clang.cxxflags": [
        "-I/home/talin/Projects/tempest/build/include",
        "-I/home/talin/Projects/tempest/src/compiler",
        "-I/home/talin/Projects/tempest/src/compiler_tests",
        "-I/usr/lib/llvm-6.0/include",
        "-std=c++17",
        "-Wall",
        "-Wextra",
        "-Wno-unused-parameter",
    ]
}

Expected behavior
Error squiggles should reflect the current state of the file, not the state of previous typing.

@bobbrow
Copy link
Member

bobbrow commented Aug 27, 2018

Thank you for opening this issue. I have seen some similar strange behavior recently too and it's on my list of things to investigate. We can track that with this issue.

@arminAnderson
Copy link

arminAnderson commented Sep 1, 2018

@bobbrow I am also having an issue with the error squiggles.

I was going to open an issue but this line from the original post,

I often find myself making a trivial change to the file (hitting spacebar + backspace) to force the error validator to run and get rid of the error squiggles.

has been happening every time I change a file with my project and I'm pretty sure the same mechanisms are at play here.

For a specific example, right now I have Main.cpp and Camera.h. Inside of Camera.h, I had an inline function which was being called in Main.cpp. I deleted the function in Camera.h, but there were no errors in Main.cpp when I went back to it, even though that function no longer existed.

That change is actually being detected in some manner, because there is no information when I hover over the now missing function in Main.cpp as opposed to any other valid member from Camera.h. The only way to actually get the error message though is to alter the file (just press space and backspace) and then save like in the issue report.

These changes are detected between .h and .cpp of the same name though. I tested a non-inline version, and the cpp file recognized that the function declaration was missing without having to manually alter the file and save it like with Main.cpp, which needed the manual fix in this example as well.

Hope any of this helps.

@ricokahler
Copy link

ricokahler commented Sep 13, 2018

I have this issue as well and it's maddening at times. I only work in javascript and typescript files and my extensions are:

  • Code Spell Checker
  • DotENV
  • ESLint
  • Git Blame
  • Lisp
  • Prettier
  • Python
  • vscode-styled-components
  • WakaTime

My guess is that there's an error in the rate-limiting code, whereby if a file gets marked as "dirty" while the error validator is running gets marked as "clean" when the results come back. This is a fairly easy bug to make in a rate limiter, I've seen similar bugs many times. However, that's just a guess.

@viridia, that's my same guess. it's like they throttle instead of debounce. Also: I don't work in cpp so i don't think this is specific to cpp tools


I often find myself making a trivial change to the file (hitting spacebar + backspace) to force the error validator to run and get rid of the error squiggles.

...sigh so relatable

@sean-mcmanus sean-mcmanus modified the milestones: September 2018, On Deck Sep 21, 2018
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, October 2018 Oct 4, 2018
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Oct 4, 2018
@sean-mcmanus
Copy link
Contributor

We fixed squiggle update bugs with 0.19.1: https://github.com/Microsoft/vscode-cpptools/releases/tag/0.19.1-insiders -- so let us know if you still get squiggles not going away -- in some cases in the global scope it can take over 10 seconds to update correctly though, but they shouldn't be "permanently" incorrect, as what sometimes the case previously. On Linux, setting the C_Cpp.updateChannel to "Insiders" should enable auto-updating to the insider version.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

5 participants