Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Code completion using LSP and clangd

<< < (77/92) > >>

christo:
Thanks Pecan.

I face another issue now - regarding errors with fixes in different line, like errors due to missing includes,  fix is not applied. It shows "No available fixes found" on applying. In Parser::OnRequestCodeActionApply() , there is a check if the fix is in same line that of the line causing the error. This might be causing the issue.

Pecan:

--- Quote from: christo on March 24, 2024, 11:58:39 am ---Thanks Pecan.

I face another issue now - regarding errors with fixes in different line, like errors due to missing includes,  fix is not applied. It shows "No available fixes found" on applying. In Parser::OnRequestCodeActionApply() , there is a check if the fix is in same line that of the line causing the error. This might be causing the issue.

--- End quote ---

Can you give me a 1,2,3 list of a way to re-create the situation?

christo:

--- Quote from: Pecan on March 24, 2024, 05:57:53 pm ---
--- Quote from: christo on March 24, 2024, 11:58:39 am ---Thanks Pecan.

I face another issue now - regarding errors with fixes in different line, like errors due to missing includes,  fix is not applied. It shows "No available fixes found" on applying. In Parser::OnRequestCodeActionApply() , there is a check if the fix is in same line that of the line causing the error. This might be causing the issue.

--- End quote ---

Can you give me a 1,2,3 list of a way to re-create the situation?

--- End quote ---

Hi Pecan,

1. Create a new console application project
2. replace code in main.cpp with below code

--- Code: ---int main()
{
    std::cout << "Hello";
    return 0;
}

--- End code ---

3. Clangd (I'm using v18) gives below diagnostic

--- Quote ---/home/christo/projects/Test/test2/main.cpp|3|error:Use of undeclared identifier 'std' (fix available) Include <iostream> for symbol std::cout|

--- End quote ---
4. Right click and select "Apply fix if available"
5. Error pop-up is shown instead of applying the fix  "No available fixes found"

Grit Clef:
Yes, I use Clangd 18 and got the same problem, too.

Pecan:

--- Quote from: Grit Clef on March 25, 2024, 11:56:01 am ---Yes, I use Clangd 18 and got the same problem, too.

--- End quote ---

Yep, my assumption error. The error is from line 2 but the fix is to line 0, and my code is looking for a fix to line 2.
Wups

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version