wxMaxima
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Member Functions
AutoComplete Class Reference
Inheritance diagram for AutoComplete:
[legend]
Collaboration diagram for AutoComplete:
[legend]

Public Types

enum  autoCompletionType {
  command = 0 , tmplte , loadfile , demofile ,
  generalfile , esccommand , unit , numberOfTypes
}
 All types of things we can autocomplete. More...
 
using WordList = std::vector< wxString >
 

Public Member Functions

 AutoComplete (Configuration *configuration)
 
 ~AutoComplete () override
 The destructor of AutoComplete.
 
void LoadSymbols ()
 Load all autocomplete symbols wxMaxima knows about by itself.
 
void LoadBuiltinSymbols ()
 Makes wxMaxima know all its builtin symbols.
 
void AddSymbol (wxString fun, autoCompletionType type=command)
 Manually add an autocompletable symbol to our symbols lists.
 
void AddSymbols (wxString xml)
 Interprets the XML autocompletable symbol list maxima can send us.
 
void AddSymbols (const wxXmlDocument &xml)
 Interprets the XML autocompletable symbol list maxima can send us.
 
void AddSymbols_Backgroundtask_string (const stop_token &stopToken, const wxString &xml)
 The real work of AddSymbols is made here and in the background.
 
void AddSymbols_Backgroundtask (const stop_token &stopToken, const wxXmlDocument &xmldoc)
 The real work of AddSymbols is made here and in the background.
 
void UpdateDemoFiles (wxString partial, const wxString &maximaDir)
 Replace the list of files in the directory the worksheet file is in to the demo files list.
 
void UpdateLoadFiles (wxString partial, const wxString &maximaDir)
 Replace the list of files in the directory the worksheet file is in to the load files list.
 
void UpdateGeneralFiles (wxString partial, const wxString &maximaDir)
 Assemble a list of files.
 
void UpdateFiles (autoCompletionType type, const wxString &partial, const wxString &maximaDir)
 Re-scan the directory a file-name completion currently points into.
 
void AddWorksheetWords (const WordList &words)
 Add words to the list of words that appear in the workSheet's code cells.
 
void AddWorksheetWords (WordList::const_iterator begin, WordList::const_iterator end)
 
void ClearWorksheetWords ()
 Clear the list of words that appear in the workSheet's code cells.
 
void ClearDemofileList ()
 Clear the list of files demo() can be applied on.
 
std::vector< wxString > CompleteSymbol (wxString partial, autoCompletionType type=command)
 Returns a list of possible autocompletions for the string "partial".
 
std::vector< wxString > GetDemoFilesList ()
 Returns a list of demo files we know of.
 
std::vector< wxString > GetSymbolList ()
 Returns a list of Symbols we know.
 
bool HasDemofile (const wxString &commandname)
 Does a demo file for this command exist?
 

Static Public Member Functions

static bool CompletesFiles (autoCompletionType type)
 Is this completion type one that completes file names?
 
static bool IsEscHexCompletion (const wxString &completion)
 Is this ESC completion a code point typed as a hex number, not a name?
 
static wxString EscCompletionLabel (const wxString &completion)
 What the ESC popup shows for a completion: the symbol next to its name.
 
static wxString FixTemplate (wxString templ)
 Basically runs a regex over templates.
 

Member Enumeration Documentation

◆ autoCompletionType

All types of things we can autocomplete.

Enumerator
tmplte 

Command names.

Attention
Must be the first entry in this enum
loadfile 

Function templates.

demofile 

loadable files

generalfile 

loadable files

esccommand 

general files

unit 

Esc commands describing symbols.

numberOfTypes 

Unit names.

Attention
Must be the last entry in this enum Not a completion type, but the marker for how many types there are

Member Function Documentation

◆ AddSymbol()

void AutoComplete::AddSymbol ( wxString  fun,
autoCompletionType  type = command 
)

Manually add an autocompletable symbol to our symbols lists.

Check for function of template

Escape letters that need escaping in maxima

Add symbols

Add templates - for given function and given argument count we only add one template. We count the arguments by counting '<'

◆ CompleteSymbol()

std::vector< wxString > AutoComplete::CompleteSymbol ( wxString  partial,
autoCompletionType  type = command 
)

Returns a list of possible autocompletions for the string "partial".

Returns a string array with functions which start with partial.

◆ EscCompletionLabel()

wxString AutoComplete::EscCompletionLabel ( const wxString &  completion)
static

What the ESC popup shows for a completion: the symbol next to its name.

"alpha α" for a name; for a code point, the glyph, "U+...", and the name Unicode gives it: "61 a U+0061 LATIN SMALL LETTER A".

◆ FixTemplate()

wxString AutoComplete::FixTemplate ( wxString  templ)
static

Basically runs a regex over templates.

This will change optional arguments

◆ IsEscHexCompletion()

bool AutoComplete::IsEscHexCompletion ( const wxString &  completion)
static

Is this ESC completion a code point typed as a hex number, not a name?

CompleteSymbol() offers what has been typed after ESC as a code point whenever it is one (see wxm::HexCodePoint()), or a bare "u+" that the digits are still to follow; a name, even one made of hex digits only ("ee"), is a name.

◆ LoadBuiltinSymbols()

void AutoComplete::LoadBuiltinSymbols ( )

Makes wxMaxima know all its builtin symbols.

This function might cause a compiler warning because it is suspiciously long. For the same reason it has been split into a separate file.

◆ UpdateFiles()

void AutoComplete::UpdateFiles ( autoCompletionType  type,
const wxString &  partial,
const wxString &  maximaDir 
)

Re-scan the directory a file-name completion currently points into.

Dispatches to UpdateDemoFiles()/UpdateLoadFiles()/UpdateGeneralFiles() depending on type. Called while a file-name completion is in progress whenever the partial gains or loses a directory component (the user typed a "/", descended into a subdirectory or deleted back across a "/"), so the popup can offer that directory's contents bash-style.


The documentation for this class was generated from the following files: