Skip to content

Does not show variables in completion but functions in C file #181

@Schievel1

Description

@Schievel1

Describe the bug

When in a C file I get completion candidates for functions just fine, but I don't get suggestion for variables.

Here is a small test example. I use the global backend and the mytext variable is not suggested from corfu:
grafik
on the other hand it completes the function myInBufferFunction:
grafik
(don't mind the header file, I was just testing around if it has something to do with whether the function is defined in-buffer or in another file - it does not)

Heres my config regarding citre:

(use-package! citre
  :demand t
  :init
  (require 'citre-config) ;; needed for lazy load
  :config
  (setq
   citre-peek-auto-restore-after-jump nil
   citre-global-completion-case-sensitive nil
   citre-project-root-function #'projectile-project-root
   citre-default-create-tags-file-location 'global-cache
   citre-use-project-root-when-creating-tags t)
  (evil-define-key 'normal citre-peek-keymap
    (kbd "]t") #'citre-peek-next-definition
    (kbd "[t") #'citre-peek-prev-definition
    (kbd "]p") #'citre-peek-through
    (kbd "[p") #'citre-peek-through-references
    (kbd "[j") #'citre-peek-jump
    (kbd "ESC") #'citre-peek-abort
    )
  (evil-make-overriding-map citre-peek-keymap 'motion)
  (evil-make-overriding-map citre-peek-keymap 'normal))

To Reproduce

If you are pretty sure about the cause, or you are pretty sure it's a easy fix, or you are pretty sure it can be easily reproduced by developers, you can delete this section. Otherwise, write steps to reproduce, and it should start by $ emacs -Q.

Steps to reproduce:

  1. $ emacs -Q
  2. I can not really reproduce this with emacs -Q. I need to load corfu and compat and citre and whatnot and it does not show me completions at all.

System information

  • OS: Gentoo Linux in WSL2
  • Emacs version: 29.4
  • Are you using the latest version of Citre on master branch: I am using the latest from melpa but I also tried with the latest commit from this github repo.

Additional context

I tried with ggtags-mode and it is showing the variables, so it must be a setting or something in citre.

fwiw I seems like the variable tag isn't in the tag file at all:

pascal on Gentoo-WSL ~/.cache/gtags/home/pascal/dev/test
✗ global -c my
myInBufferFunction
myOtherFileFunction

after creating the GTAGS etc. files with ggtags-mode I get:

pascal on Gentoo-WSL ~/.cache/gtags/home/pascal/dev/test
➜ global -c my
myInBufferFunction
myOtherFileFunction
mytext

This is because ggtags can tell global to use ctags as a backend for creating tag files. If I don't do that, is creates a GTAGS file with the same issue. However, creating a tags database with citre or ggtags (without ctags backend) results in

pascal on Gentoo-WSL ~/.cache/gtags/home/pascal/dev/test
➜ global -c my
myInBufferFunction
myOtherFileFunction

pascal on Gentoo-WSL ~/.cache/gtags/home/pascal/dev/test
➜ global -sx mytext
Warning: source file './test.c' is not available.
mytext              3 test.c

So it finds them with -s, which is

       Print other symbol tags.
       Other symbol means the reference to a symbol which has no definition.

Whyever global thinks mytext has no definiton, is citre using the wrong arguments for global?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions