forked from qt-creator/qt-creator
LUA: Add CyclicSuggestion to TextEdditor bindings
Change-Id: I984f886123470f2f63accb39c697f61890cbab98 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -451,6 +451,25 @@ void setupTextEditorModule()
|
|||||||
return TextEditor::BaseTextEditor::currentTextEditor();
|
return TextEditor::BaseTextEditor::currentTextEditor();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
result["currentSuggestion"] = []() -> CyclicSuggestion * {
|
||||||
|
const auto textEditor = TextEditor::BaseTextEditor::currentTextEditor();
|
||||||
|
if (!textEditor)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto *widget = textEditor->editorWidget();
|
||||||
|
if (!widget)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto res = dynamic_cast<CyclicSuggestion *>(widget->currentSuggestion());
|
||||||
|
if (!res)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
result.new_usertype<CyclicSuggestion>(
|
||||||
|
"CyclicSuggestion", sol::no_constructor, "isLocked", &CyclicSuggestion::isLocked);
|
||||||
|
|
||||||
result.new_usertype<MultiTextCursor>(
|
result.new_usertype<MultiTextCursor>(
|
||||||
"MultiTextCursor",
|
"MultiTextCursor",
|
||||||
sol::no_constructor,
|
sol::no_constructor,
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ local Suggestion = {}
|
|||||||
---@return Suggestion suggestion The created suggestion.
|
---@return Suggestion suggestion The created suggestion.
|
||||||
function Suggestion:create(startLine, startCharacter, endLine, endCharacter, text) end
|
function Suggestion:create(startLine, startCharacter, endLine, endCharacter, text) end
|
||||||
|
|
||||||
|
---@class CyclicSuggestion
|
||||||
|
local CyclicSuggestion = {}
|
||||||
|
|
||||||
|
---@return boolean True if the suggestion is locked, false otherwise.
|
||||||
|
---Suggestion is locked when the user selects it and already started aplying it partially.
|
||||||
|
function CyclicSuggestion:isLocked() end
|
||||||
|
|
||||||
---@class TextDocument
|
---@class TextDocument
|
||||||
local TextDocument = {}
|
local TextDocument = {}
|
||||||
|
|
||||||
@@ -59,4 +66,7 @@ function TextEditor:cursor() end
|
|||||||
---@return TextEditor|nil editor The currently active editor or nil if there is none.
|
---@return TextEditor|nil editor The currently active editor or nil if there is none.
|
||||||
function textEditor.currentEditor() end
|
function textEditor.currentEditor() end
|
||||||
|
|
||||||
|
---@return CyclicSuggestion|nil The current suggestion if available. Otherwise nil.
|
||||||
|
function textEditor.currentSuggestion() end
|
||||||
|
|
||||||
return textEditor
|
return textEditor
|
||||||
|
|||||||
Reference in New Issue
Block a user