import { CXCodeCompleteResults } from "https://deno.land/x/libclang@1.0.0-beta.8/mod.ts";
Contains the results of code-completion.
This data structure contains the results of code completion, as produced by CXTranslationUnit.codeCompleteAt().
Constructors
Properties
The list of possible code-completions.
Methods
Free this set of code-completion results.
Calling any methods on the CXCodeCompleteResults after disposing will result in undefined behaviour. It is not strictly necessary to call this method, the memory will be released as part of JavaScript garbage collection.
Returns the cursor kind for the container for this code completion context. The container is only guaranteed to be set for contexts where a container exists (i.e. member accesses or Objective-C message sends); if there is not a container, this function will return CXCursorKind.CXCursor_InvalidCode.
Returns the USR (Unified Symbol Resolution) for the container for this code completion context. If there is no container for the current context, this function will return the empty string.
Retrieve a diagnostic associated with this code completion.
Fix-its that must be applied before inserting the text for the corresponding completion.
By default, CXTranslationUnit#codeCompleteAt() only returns completions with empty fix-its. Extra completions with non-empty fix-its should be explicitly requested by setting CXCodeComplete_Flags.CXCodeComplete_IncludeCompletionsWithFixIts.
For the clients to be able to compute position of the cursor after applying fix-its, the following conditions are guaranteed to hold for replacement_range of the stored fix-its:
- Ranges in the fix-its are guaranteed to never contain the completion point (or identifier under completion point, if any) inside them, except at the start or at the end of the range.
- If a fix-it range starts or ends with completion point (or starts or ends after the identifier under completion point), it will contain at least one character. It allows to unambiguously recompute completion point after applying the fix-it.
The intuition is that provided fix-its change code around the identifier we complete, but are not allowed to touch the identifier itself or the completion point. One example of completions with corrections are the ones replacing '.' with '->' and vice versa:
Example:
std::unique_ptr<std::vector<int>> vec_ptr;
In 'vec_ptr.^', one of the completions is 'push_back', it requires
replacing '.' with '->'.
In 'vec_ptr->^', one of the completions is 'release', it requires
replacing '->' with '.'.
Determine the number of diagnostics produced prior to the location where code completion was performed.
Retrieve the number of fix-its for the given completion index.
Calling this makes sense only if CXCodeComplete_Flags.CXCodeComplete_IncludeCompletionsWithFixIts option was set.
Returns the currently-entered selector for an Objective-C message
send, formatted like "initWithFoo:bar:"
. Only guaranteed to return a
non-empty string for CXCompletionContext.CXCompletionContext_ObjCInstanceMessage and
CXCompletionContext.CXCompletionContext_ObjCClassMessage.
Sort the code-completion results in case-insensitive alphabetical order. This recreates the results array.