class Clangc::CompletionString

brief A semantic string that describes a code-completion result.

A semantic string that describes the formatting of a code-completion result as a single “template” of text that should be inserted into the source buffer when a particular code-completion result is selected. Each semantic string is made up of some number of “chunks”, each of which contains some text along with a description of what that text means, e.g., the name of the entity being referenced, whether the text chunk is part of the template, or whether it is a “placeholder” that the user should replace with actual code,of a specific kind. See c CXCompletionChunkKind for a description of the different kinds of chunks.

Public Instance Methods

Clangc::CompletionString#annotation(Number) → String click to toggle source

Retrieve the annotation associated with the given completion string.

annotation_number the 0-based index of the annotation of the completion string.

Returns annotation string associated with the completion at index annotation_number, or a NULL string if that annotation is not available.

VALUE
c_CompletionString_get_annotation(VALUE self, VALUE index)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CXSTR_2_RVAL(
        clang_getCompletionAnnotation(c->data, NUM2UINT(index)));
}
Clangc::CompletionString#num_annotations → Array click to toggle source

Return an array that contains all the annotations for a completion string.

# File lib/clangc.rb, line 283
def annotations
  num = num_annotations
  return [] if num == -1

  annotations = []
  for i in 0..(num - 1) do
    annotations << annotation(i)
  end
  annotations
end
availability() click to toggle source

#availability => Clangc::AvailabilityKind

Determine the availability of the entity that this code-completion string refers to.

The availability of the completion string which is one of the Clangc::AvailabilityKind constants.

VALUE
c_CompletionString_get_availability(VALUE self)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CUINT_2_NUM(clang_getCompletionAvailability(c->data));
}
brief_comment() click to toggle source

Call-seq:

Clangc::CompletionString#brief_comment => String

Retrieve the brief documentation comment attached to the declaration that corresponds to the given completion string.

VALUE
c_CompletionString_get_brief_comment(VALUE self)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CXSTR_2_RVAL(clang_getCompletionBriefComment(c->data));
}
Clangc::CompletionString#chunk_completion_string(index) → click to toggle source
Clangc::CompletionString

Retrieve the completion string associated with a particular chunk within a completion string.

0-based index of the chunk in the completion string.

Returns the completion string associated with the chunk at index c chunk_number.

VALUE
c_CompletionString_get_chunk_completion_string(VALUE self, VALUE index)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    VALUE completion_string;
    CompletionString_t *cs;
    R_GET_CLASS_DATA("Clangc", CompletionString, completion_string, cs);
    cs->data =
        clang_getCompletionChunkCompletionString(c->data, NUM2UINT(index));
    cs->parent = c->parent;

    return completion_string;
}
Clangc::CompletionString#chunk_text_completion_strings → Array click to toggle source

Return an array that contains all the completion strings for a completion string.

# File lib/clangc.rb, line 300
def chunk_completion_strings
  num = num_chunks
  return [] if num == -1

  completion_strings = []
  for i in 0..(num - 1) do
    completion_strings << chunk_completion_string(i)
  end
  completion_strings
end
Clangc::CompletionString#chunk_kind(Number) → Clangc::CompletionChunkKind click to toggle source

Determine the kind of a particular chunk within a completion string.

chunk_number the 0-based index of the chunk in the completion string.

It returns the kind of the chunk at the index chunk_number (a Clangc::CompletionChunkKind constant).

VALUE
c_CompletionString_get_chunk_kind(VALUE self, VALUE index)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CUINT_2_NUM(clang_getCompletionChunkKind(c->data, NUM2UINT(index)));
}
Clangc::CompletionString#chunk_kinds → Array click to toggle source

Return an array that contains all the kinds of the chunk completions for a completion string.

# File lib/clangc.rb, line 250
def chunk_kinds
  num = num_chunks
  return [] if num == -1

  kinds = []
  for i in 0..(num - 1) do
    kinds << chunk_kind(i)
  end
  kinds
end
chunk_text(p1) click to toggle source

call-seq

Clangc::CompletionString#chunk_text(Number) => String

Retrieve the text associated with a particular chunk within a completion string.

chunk_number the 0-based index of the chunk in the completion string.

Returns the text associated with the chunk at index chunk_number.

VALUE
c_CompletionString_get_chunk_text(VALUE self, VALUE index)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CXSTR_2_RVAL(clang_getCompletionChunkText(c->data, NUM2UINT(index)));
}
Clangc::CompletionString#chunk_texts → Array click to toggle source

Return an array that contains all the texts of the chunk completions for a completion string.

# File lib/clangc.rb, line 267
def chunk_texts
  num = num_chunks
  return [] if num == -1

  texts = []
  for i in 0..(num - 1) do
    texts << chunk_text(i)
  end
  texts
end
Clangc::CompletionString#num_annotations → Number click to toggle source

Retrieve the number of annotations associated with the given completion string.

Returns the number of annotations associated with the given completion string.

VALUE
c_CompletionString_get_num_annotations(VALUE self)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CUINT_2_NUM(clang_getCompletionNumAnnotations(c->data));
}
Clangc::CompletionString#num_chunks → Number click to toggle source

Retrieve the number of chunks in the given code-completion string.

VALUE
c_CompletionString_get_num_chunks(VALUE self)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CUINT_2_NUM(clang_getNumCompletionChunks(c->data));
}
Clangc::CompletionString#priority → Number click to toggle source

Determine the priority of this code completion.

The priority of a code completion indicates how likely it is that this particular completion is the completion that the user will select. The priority is selected by various internal heuristics.

Rreturns The priority of this completion string. Smaller values indicate higher-priority (more likely) completions.

VALUE
c_CompletionString_get_priority(VALUE self)
{
    CompletionString_t *c;
    Data_Get_Struct(self, CompletionString_t, c);

    return CUINT_2_NUM(clang_getCompletionPriority(c->data));
}