IdeCodeIndexer: Builder SDK Reference

## IdeCodeIndexer IdeCodeIndexer — Interface for background indexing source code |

## Functions

void | ide_code_indexer_index_file_async ()
IdeCodeIndexEntries * | ide_code_indexer_index_file_finish ()
void | ide_code_indexer_generate_key_async ()
gchar * | ide_code_indexer_generate_key_finish ()

## Types and Values

#define | IDE_TYPE_CODE_INDEXER
struct | IdeCodeIndexerInterface
| IdeCodeIndexer

## Object Hierarchy

        GInterface
        ╰── IdeCodeIndexer

## Prerequisites

IdeCodeIndexer requires IdeObject.

## Description

The IdeCodeIndexer interface is used to index source code in the project. Plugins that want to provide global search features for source code should implement this interface and specify which languages they support in their .plugin definition, using "X-Code-Indexer-Languages". For example. to index Python source code, you might use:

X-Code-Indexer-Languages=python,python3

## Functions

### ide_code_indexer_index_file_async ()

    void
    ide_code_indexer_index_file_async (IdeCodeIndexer *self,
                                       GFile *file,
                                       const gchar * const *build_flags,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

This function will take index source file and create an array of symbols in `file` . `callback` is called upon completion and must call `ide_code_indexer_index_file_finish()` to complete the operation.

#### Parameters

self | An IdeCodeIndexer instance. |
file | Source file to index. |
build_flags | array of build flags to parse `file` . | [nullable][array zero-terminated=1]
cancellable | a GCancellable. | [nullable]
callback | a GAsyncReadyCallback |
user_data | closure data for `callback` |

Since: 3.28

### ide_code_indexer_index_file_finish ()

    IdeCodeIndexEntries *
    ide_code_indexer_index_file_finish (IdeCodeIndexer *self,
                                        GAsyncResult *result,
                                        GError **error);

Completes an asynchronous request to `ide_code_indexer_index_file_async()`.

#### Parameters

self | a IdeCodeIndexer |
result | a GAsyncResult provided to callback |
error | a location for a GError, or `NULL` |

#### Returns

an IdeCodeIndexEntries if successful; otherwise `NULL` and `error` is set.

[transfer full]

Since: 3.28

### ide_code_indexer_generate_key_async ()

    void
    ide_code_indexer_generate_key_async (IdeCodeIndexer *self,
                                         IdeSourceLocation *location,
                                         const gchar * const *build_flags,
                                         GCancellable *cancellable,
                                         GAsyncReadyCallback callback,
                                         gpointer user_data);

This function will get key of reference located at IdeSoureLocation.

In 3.30 this function gained the `build_flags` parameter.

#### Parameters

self | An IdeCodeIndexer instance. |
location | Source location of refernece. | [not nullable]
build_flags | array of build flags to parse `file` . | [nullable][array zero-terminated=1]
cancellable | a GCancellable. | [nullable]
callback | A callback to execute upon indexing. |
user_data | User data to pass to `callback` . |

Since: 3.26

### ide_code_indexer_generate_key_finish ()

    gchar *
    ide_code_indexer_generate_key_finish (IdeCodeIndexer *self,
                                          GAsyncResult *result,
                                          GError **error);

Returns key for declaration of reference at a location.

#### Parameters

self | an IdeCodeIndexer |
result | a GAsyncResult |
error | a location for a GError, or `NULL` |

#### Returns

(transfer full) : A string which contains key.

Since: 3.26

## Types and Values

### IDE_TYPE_CODE_INDEXER

    #define IDE_TYPE_CODE_INDEXER (ide_code_indexer_get_type())

### struct IdeCodeIndexerInterface

    struct IdeCodeIndexerInterface {
      GTypeInterface         parent_iface;

      void                 (*generate_key_async)     (IdeCodeIndexer       *self,
                                                      IdeSourceLocation    *location,
                                                      const gchar * const  *build_flags,
                                                      GCancellable         *cancellable,
                                                      GAsyncReadyCallback   callback,
                                                      gpointer              user_data);
      gchar               *(*generate_key_finish)    (IdeCodeIndexer       *self,
                                                      GAsyncResult         *result,
                                                      GError              **error);
      void                 (*index_file_async)       (IdeCodeIndexer       *self,
                                                      GFile                *file,
                                                      const gchar * const  *build_flags,
                                                      GCancellable         *cancellable,
                                                      GAsyncReadyCallback   callback,
                                                      gpointer              user_data);
      IdeCodeIndexEntries *(*index_file_finish)      (IdeCodeIndexer       *self,
                                                      GAsyncResult         *result,
                                                      GError              **error);
    };

### IdeCodeIndexer

    typedef struct _IdeCodeIndexer IdeCodeIndexer;