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

Using function prototypes auto-completion has strange behavior #126

Open
braoult opened this issue Jun 13, 2024 · 0 comments
Open

Using function prototypes auto-completion has strange behavior #126

braoult opened this issue Jun 13, 2024 · 0 comments

Comments

@braoult
Copy link

braoult commented Jun 13, 2024

Note: I use lsp-mode, ccls and flycheck.

Let say I have somewhere a C function int my_func(char *str, int num).

If I want to use it, I will start to type its name, let's say my_f, and I will be proposed the auto-complete choices:

my_func
my_func  (char *str, int num)

There is an issue if I select my_func (char *str, int num) ; The text is inserted in my buffer, then, after I replace the parameters with my own ones, ccls will always give errors on the line, which are very difficult to get rid of:
Even If I delete function name/parameters on the line, and re-type everything completely (function and parameters), the error will not disappear. It looks like ccls keeps some wrong status.
The only solution is to save then revert buffer, so that ccls "forgets" something about the inserted function declaration.
Killing the line (C-a C-k) works also.

It will be clearer with an example :

  1. Initial situation. I start to type a function name line 153, some choices are proposed.
    step 1
  2. I select the prototype.
    step 2
  3. After doing it, the text is inserted, with parameters highlighted.
    step 3
  4. I type the letter "i", the highlighted text is replaced with "i". Note that ccls looks unhappy with "i".
    step 4
  5. I complete the func call with a semicolon
    step 5
  6. After moving the cursor we can see there are likely 2 errors
    step 6
  7. Showing Flycheck all errors line 153, :
    step 7
  8. After deleting the function call (using "DEL" from EOL to first char function), an error remain on line.
    step 8
  9. Remaining Flycheck error on "empty" line
    step 9
  10. After "C-x C-s" and "M-x revert-buffer", the error is gone
    step 10

Feel free to ask if you need more information/testing.

@braoult braoult changed the title Using prototypes auto-completion has strange behavior Using function prototypes auto-completion has strange behavior Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant