undoStudio
The IDE of the undoRT ecosystem
Loading...
Searching...
No Matches
undoAppSTSnippet.hpp File Reference

Statement skeletons offered by the editor's suggestion list. More...

#include <string>
#include <vector>
Include dependency graph for undoAppSTSnippet.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  undoApp::ST::StatementSnippet
 One statement skeleton the suggestion list can write out. More...
 

Namespaces

namespace  undoApp
 
namespace  undoApp::ST
 

Enumerations

enum class  undoApp::ST::SnippetPane { undoApp::ST::Variables , undoApp::ST::Body }
 The pane a snippet is written into. More...
 

Functions

const std::vector< StatementSnippet > & undoApp::ST::allStatementSnippets ()
 The statements on offer.
 
std::vector< StatementSnippet > undoApp::ST::snippetsForPane (SnippetPane pane)
 The snippets belonging to one pane.
 
bool undoApp::ST::hasStatementPrefix (const std::string &prefix)
 Whether the list is worth opening for what has been typed.
 
std::string undoApp::ST::statementPrefixAt (const std::string &line, int column, int &startCol)
 The word being typed at the caret.
 
void undoApp::ST::rankSnippets (std::vector< StatementSnippet > &snippets, const std::string &prefix)
 Keep the snippets matching a prefix, best match first.
 
std::string undoApp::ST::leadingWhitespace (const std::string &line)
 Indentation of a line, spaces and tabs alike.
 
void undoApp::ST::expandSnippet (const StatementSnippet &snippet, const std::string &base, const std::string &tab, std::string &text, int &caretLine, int &caretCol)
 Write a snippet out at a line, in the indentation already in force there.
 

Detailed Description

Statement skeletons offered by the editor's suggestion list.

Author
Salvatore Bamundo
Date
July 2026 SPDX-License-Identifier: GPL-3.0-or-later SPDX-FileCopyrightText: Copyright (c) 2026 undoRT

A snippet is the text the editor writes out when a suggestion is accepted: typing IF and accepting it leaves the THEN, the body and the END_IF in place, with the caret on the condition, instead of leaving three keywords to type.

Skeletons are offered per pane. The Variables pane holds the VAR sections and the Body pane holds the cyclic code, so a FOR loop is not offered among the declarations and a VAR_INPUT is not offered in the middle of a loop.

The mapping from a typed word to a skeleton, and the writing of a skeleton at a line, are kept free of any UI dependency so they can be exercised without a graphics context.