forked from qt-creator/qt-creator
AI Assistant: Check for selection before request for suggestions
Change-Id: I12207d9a9fcfea0b868c5d1c2fe5e2f7c6578f37 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -189,6 +189,17 @@ local function sendRequest(request)
|
||||
end
|
||||
|
||||
local function requestSuggestions()
|
||||
local main_cursor = TextEditor.currentEditor():cursor():mainCursor()
|
||||
if main_cursor == nil then
|
||||
print("No cursor found")
|
||||
return
|
||||
end
|
||||
|
||||
if(main_cursor:hasSelection()) then
|
||||
print("Ignoring requestSuggestions() due to cursor selection")
|
||||
return
|
||||
end
|
||||
|
||||
local request_msg = buildRequest()
|
||||
if(request_msg == nil) then
|
||||
print("requestSuggestions() failed to build request message")
|
||||
|
Reference in New Issue
Block a user