-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add autocompletion to code editor #1666
Conversation
Add a few hard-coded function entries for testing. Adds autocompleter from edbee. Updates edbee to point to my fork of edbee, which I'll try and PR after I've got it fully fleshed out.
…on names from a file, and adds reserved lua words to the provider.
Moved change list to summary of PR |
I have tries to compile it locally but when I do a Ah, ha, the wanted commit is two commits later on from the published head of the master branch but it is not visible when running |
I took the liberty to update the |
Hrm. I thought that I had managed to get the file pointing to my fork(and updated to the most recent commit, since as I understand it the file points to a specific commit), but I guess not. Hrm... |
It would be simpler if upstream adopts your changes - is there any sign that they might do that? |
At some point, yeah. Based on the response time of upstream's dev, it'll take quite a while. The feature will almost certainly be release-ready before the PR on Edbee gets to the point where it's acceptable and merged. |
…sely to langserv protocol updates edbee-lib referenced
… below: Updates the key handler to allow enter/return/tab to go to editor as usual if the currentWord exactly matches the selected item on the list(which it always will immediately after typing an exact match, based on the way the list gets updated as you type). The menu also now hides if there is only one match in the list, and it's an exactly match of the currentWord.
Updates mudlet class to use internal resource.
src/luaFunctionList.json
Outdated
@@ -0,0 +1 @@ | |||
{"createBuffer":"createBuffer(name)","getFont":"getFont(name)","setLabelReleaseCallback":"setLabelReleaseCallback(labelName, luaFunctionName, optional any amount of arguments)","openWebPage":"openWebPage(URL)","tempBeginOfLineTrigger":"tempBeginOfLineTrigger(part of line, code to do)","killTrigger":"killTrigger(id)","setAreaUserData":"setAreaUserData(areaID, key (as a string), value (as a string))","handleWindowResizeEvent":"handleWindowResizeEvent()","replaceAll":"replaceAll( what, with )","sendAll":"sendAll(list of things to send, [echo back or not])","searchAreaUserData":"searchRoom (room name / room number)","setRoomChar":"setRoomChar(roomID, character)","saveWindowLayout":"saveWindowLayout","getTimestamp":"getTimestamp( optional console_name, lineNumber )","insertPopup":"insertPopup([windowName], text, {commands}, {hints}, [current or default format])","setBold":"setBold(windowName, boolean)","tempTimer":"tempTimer(time, code to do)","getRoomChar":"getRoomChar(roomID)","setBorderTop":"setBorderTop(size)","tempPromptTrigger":"tempLineTrigger(code to do)","getMapLabel":"labelinfo = getMapLabels(areaID, labelID)","clearSpecialExits":"clearSpecialExits(roomID)","removeMapEvent":"removeMapEvent (event name)","resizeWindow":"resizeWindow(name,width,height)","connectToServer":"connectToServer(host, port, <i>save</i>)","permBeginOfLineStringTrigger":"permBeginOfLineStringTrigger(name, parent, pattern table, lua code)","permAlias":"permAlias(name, parent, regex, lua code)","setLabelStyleSheet":"setLabelStyleSheet(label, markup)","killAlias":"killAlias(name)","clearWindow":"clearWindow(window_name)","print":"print(text, some more text, ...)","getFgColor":"getFgColor(windowName)","getMudletVersion":"getMudletVersion(style)","tempTrigger":"tempTrigger(substring, code to do)","getRoomAreaName":"getRoomAreaName(areaID or areaName)","hideToolBar":"hideToolBar(name)","isActive":"isActive(name, type)","permRegexTrigger":"permRegexTrigger(name, parent, pattern table, lua code)","appendBuffer":"appendBuffer(name)","setConsoleBufferSize":"setConsoleBufferSize( consoleName, linesLimit, sizeOfBatchDeletion )","killKey":"killKey(name)","showToolBar":"showToolBar(name)","getAreaUserData":"getAreaUserData(areaID, key)","downloadFile":"downloadFile(saveto, url)","suffix":"suffix(text)","searchRoomUserData":"searchRoomUserData(key, value)","addMapMenu":"addMapMenu(uniquename, parent, display name)","raiseWindow":"raiseWindow([labelName])","isAnsiFgColor":"isAnsiFgColor(ansiFgColorCode)","createGauge":"createGauge(name, width, height, Xpos, Ypos, gaugeText, r, g, b, orientation)","setFont":"setFont(name, font)","setCustomEnvColor":"setCustomEnvColor(environmentID, r,g,b,a)","getRoomExits":"getRoomExits (roomID)","selectCurrentLine":"selectCurrentLine([windowName])","sendTelnetChannel102":"sendTelnetChannel102(msg)","setFgColor":"setFgColor([windowName],r, g, b)","setRoomUserData":"setRoomUserData(roomID, key (as a string), value (as a string))","getMudletHomeDir":"getMudletHomeDir()","setHexBgColor":"setHexFgColor([windowName], hexColorString)","debugc":"debugc( content )","updateMap":"updateMap()","lockExit":"lockExit(roomID, direction, lock = true/false)","createMiniConsole":"createMiniConsole(name, x, y, width, height)","enableTimer":"enableTimer(name)","deleteRoom":"deleteRoom(roomID)","tempComplexRegexTrigger":"tempComplexRegexTrigger('name', regex, code to do, multiline, foreground color, bg color, filter, match all, highlight foreground color, highlight background color, play sound file, fire length, line delta)","getServerEncodingsList":"getServerEncodingsList()","getIrcConnectedHost":"getIrcConnectedHost()","echoLink":"echoLink([windowName], text, command, hint, [bool use_current_format or defaultLinkFormat])","getMapEvents":"mapevents = getMapEvents()","getAreaTableSwap":"getAreaTableSwap()","getServerEncoding":"getServerEncoding()","insertLink":"insertLink([windowName], text, command, hint, [useDefaultLinkFormat])","getPath":"getPath(roomID from, roomID to)","lockSpecialExit":"lockSpecialExit (from roomID, to roomID, special exit command, lock = true/false)","startStopWatch":"startStopWatch( watchID )","openUserWindow":"openUserWindow(name, <i>restoreLayout</i>)","getSpecialExitsSwap":"exits = getSpecialExitsSwap(roomID)","getLines":"getLines(from_line_number, to_line_number)","saveProfile":"saveProfile()","getRooms":"rooms = getRooms()","setExitWeight":"setExitWeight(roomID, exitCommand, weight)","createMapLabel":"labelID = createMapLabel(areaID, text, posx, posy, posz, fgRed, fgGreen, fgBlue, bgRed, bgGreen, bgBlue, zoom, fontSize, showOnTop, noScaling)","getAllRoomUserData":"getAllRoomUserData(roomID)","getStopWatchTime":"getStopWatchTime(watchID)","setHexFgColor":"setHexFgColor([windowName], hexColorString)","permGroup":"permGroup(name, itemtype, <i>parent</i>)","clearMapUserData":"clearMapUserData()","getIrcServer":"getIrcServer()","playSoundFile":"playSoundFile(fileName, volume)","getFontSize":"getFontSize(name)","clearMapUserDataItem":"clearUserDataItem(mapID,key)","replaceWildcard":"replaceWildcard(which, replacement)","setFontSize":"setFontSize(name, size)","getAllRoomEntrances":"getAllRoomEntrances(roomID)","addAreaName":"areaID = addAreaName(areaName)","setBackgroundImage":"setBackgroundImage(labelName, imageLocation)","setGridMode":"setGridMode(areaID, true/false)","getBgColor":"getBgColor(windowName)","creplaceLine":"creplaceLine (text)","permTimer":"permTimer(name, parent, seconds, lua code)","loadMap":"boolean = loadMap(file location)","isAnsiBgColor":"isAnsiBgColor(ansiBgColorCode)","resetFormat":"resetFormat()","deleteLine":"deleteLine([optional windowName])","selectSection":"selectSection(from, how long)","getNetworkLatency":"getNetworkLatency()","loadWindowLayout":"loadWindowLayout","removeSpecialExit":"removeSpecialExit(roomID, command)","closeMudlet":"closeMudlet()","clearAreaUserData":"clearAreaUserData(areaID)","disconnect":"disconnect()","setItalics":"setItalics(windowName, bool)","exportAreaImage":"exportAreaImage(areaID)","getAllMapUserData":"getAllMapUserData()","unHighlightRoom":"unHighlightRoom(roomID)","ansi2decho":"ansi2decho(text, default_colour)","disableTimer":"disableTimer(name)","copy":"copy([windowName])","resetProfile":"resetProfile()","roomLocked":"locked = roomLocked(roomID)","clearUserWindow":"clearUserWindow(name)","addRoom":"addRoom(roomID)","setMapUserData":"setMapUserData(key (as a string), value (as a string))","setExitStub":"setExitStub(roomID, direction, set/unset)","getRoomsByPosition":"getRoomsByPosition(areaID, x,y,z)","exists":"exists(name, type)","getAreaTable":"getAreaTable()","setMiniConsoleFontSize":"setTextFormat(windowName, r1, g1, b1, r2, g2, b2, bold, underline, italics[, strikeout])","invokeFileDialog":"invokeFileDialog(fileOrFolder, dialogTitle)","getMapUserData":"getMapUserData( key )","tempLineTrigger":"tempLineTrigger(from, howMany, code to do)","resetStopWatch":"resetStopWatch(watchID)","echo":"echo([miniconsole or label], text)","raiseEvent":"raiseEvent(event_name, arg-1, … arg-n)","prefix":"prefix(text)","replace":"replace([windowName,] with[, keepcolor])","createButton":"createConsole(consoleName, fontSize, charsPerLine, numberOfLines, Xpos, Ypos)","createRoomID":"usableId = createRoomID([minimumStartingRoomId])","centerview":"centerview (roomID)","getRowCount":"getRowCount([window])","getIrcChannels":"getIrcChannels()","showCaptureGroups":"showCaptureGroups()","addSpecialExit":"addSpecialExit(roomIDFrom, roomIDTo, command)","clearRoomUserDataItem":"clearRoomUserDataItem(roomID,key)","paste":"paste(windowName)","clearRoomUserData":"clearRoomUserData(roomID)","disableAlias":"disableAlias(name)","getModulePath":"path = getModulePath(module name)","clearCmdLine":"clearCmdLine()","setRoomEnv":"setRoomEnv(roomID, newEnvID)","cechoLink":"cechoLink([windowName], text, command, hint, true)","dechoLink":"dechoLink([windowName], text, command, hint, true)","getDoors":"doors = getDoors(roomID)","setMapZoom":"setMapZoom(zoom)","hechoLink":"hechoLink([windowName], text, command, hint, true)","sendIrc":"sendIrc(target, message)","permSubstringTrigger":"permSubstringTrigger( name, parent, pattern table, lua code )","getCustomLines":"getCustomLines(roomID)","startLogging":"startLogging(state)","getRoomEnv":"envID = getRoomEnv(roomID)","getSpecialExits":"exits = getSpecialExits(roomID)","getColumnNumber":"getColumnNumber([window])","getMainWindowSize":"getMainWindowSize()","registerAnonymousEventHandler":"id = registerAnonymousEventHandler(event name, function[, one shot])","disableTrigger":"disableTrigger(name)","setMainWindowSize":"setMainWindowSize(mainWidth, mainHeight)","setExit":"setExit(from roomID, to roomID, direction)","enableAlias":"enableAlias(name)","gotoRoom":"gotoRoom (roomID)","ioprint":"ioprint(text, some more text, ...)","uninstallPackage":"uninstallPackage(name)","uninstallModule":"uninstallModule(name)","timeframe":"timeframe(vname, true_time, nil_time, ...)","setRoomIDbyHash":"setRoomIDbyHash(roomID, hash)","tempRegexTrigger":"tempRegexTrigger(regex, code to do)","tempKey":"tempKey(<i>modifier</i>, key code, lua code)","getTime":"getTime(returntype, format)","tempExactMatchTrigger":"tempExactMatchTrigger(exact line, code to do)","tempColorTrigger":"tempColorTrigger(foregroundColor, backgroundColor, code to do)","tempButtonToolbar":"tempButtonToolbar(name, location, orientation)","denyCurrentSend":"denyCurrentSend()","tempButton":"tempButton(toolbar name, button text, orientation)","mudletOlderThan":"mudletOlderThan(major, <i>minor</i>, <i>patch</i>)","reconnect":"reconnect()","tempAlias":"aliasID = tempAlias(regex, code to do)","getExitWeights":"weights = getExitWeights(roomid)","setIrcNick":"setIrcNick( nickname )","printCmdLine":"printCmdLine(text)","cecho":"cecho(window, text)","decho":"decho ([name of console,] text)","stopStopWatch":"stopStopWatch( watchID )","getMousePosition":"getMousePosition()","speedwalk":"speedwalk(dirString, backwards, delay)","moveCursor":"moveCursor([optional windowName], x, y)","spawn":"spawn(read function, process to spawn[, ...arguments])","calcFontSize":"calcFontSize(fontSize)","showWindow":"showWindow(name)","showMultimatches":"showMultimatches()","raiseGlobalEvent":"raiseGlobalEvent(event_name, arg-1, … arg-n)","createMapper":"createMapper(x, y, width, height)","addSupportedTelnetOption":"addSupportedTelnetOption(option)","showColors":"showColors(columns, filterColor)","shms":"shms( seconds, bool )","setWindowWrap":"setWindowWrap(windowName, wrapAt)","fg":"fg([window, ]colorName)","reloadModule":"reloadModule(module name)","connectExitStub":"connectExitStub(fromID, direction or toID[, optional direction])","killTimer":"killTimer(id)","bg":"bg([window, ]colorName)","setTriggerStayOpen":"setTriggerStayOpen(name, number)","setStrikeOut":"setStrikeOut(windowName, boolean)","setServerEncoding":"setServerEncoding(encoding)","installModule":"installModule(location)","cinsertText":"cinsertText(window, text)","getCmdLine":"getCmdLine()","getRoomCoordinates":"x,y,z = getRoomCoordinates(room ID)","setRoomName":"setRoomName(roomID, newName)","setRoomCoordinates":"setRoomCoordinates(roomID, x, y, z)","deleteMapLabel":"deleteMapLabel(areaID, labelID)","setPopup":"setPopup(name, {lua code}, {hints})","setModulePriority":"setModulePriority(module name, priority #)","setRoomWeight":"setRoomWeight(roomID, weight)","setLink":"setLink([window, ]command, tooltip)","setLabelWheelCallback":"setLabelWheelCallback(labelName, luaFunctionName, optional any amount of arguments)","setAppStyleSheet":"setAppStyleSheet(stylesheet)","clearAreaUserDataItem":"clearAreaUserDataItem(areaID,key)","setLabelOnEnter":"setLabelOnEnter(labelName, luaFunctionName, optional any amount of arguments)","getCustomEnvColorTable":"envcolors = getCustomEnvColorTable()","setLabelMoveCallback":"setLabelMoveCallback(labelName, luaFunctionName, optional any amount of arguments)","getExitStubs1":"stubs = getExitStubs1(roomid)","getLineNumber":"getLineNumber([window])","hasExitLock":"status = hasExitLock(roomID, direction)","setLabelClickCallback":"setLabelClickCallback(labelName, luaFunctionName, optional any amount of arguments)","setIrcServer":"setIrcServer( hostname, port )","hasFocus":"hasFocus()","setIrcChannels":"setIrcChannels( channels )","expandAlias":"expandAlias(command, true/false)","enableKey":"enableKey(name)","setGaugeText":"setGaugeText(gaugename, css, ccstext )","setGaugeStyleSheet":"setGaugeStyleSheet(gaugeName, css, cssback, csstext)","killAnonymousEventHandler":"killAnonymousEventHandler(handler id)","getRoomWeight":"room weight = getRoomWeight(roomID)","getRoomUserData":"getRoomUserData(roomID, key)","insertText":"insertText([optional windowName], text)","hasSpecialExitLock":"status = hasSpecialExitLock(from roomID, to roomID, command)","getMapLabels":"arealabels = getMapLabels(areaID)","enableTrigger":"enableTrigger(name)","getRoomUserDataKeys":"getRoomUserDataKeys(roomID)","stopSounds":"stopSounds()","setGauge":"setGauge(gaugeName, currentValue, maxValue, gaugeText)","installPackage":"installPackage(location)","openUrl":"openUrl (url)","setDoor":"setDoor(roomID, exitCommand, doorStatus)","createStopWatch":"createStopWatch()","display":"display( content )","getEpoch":"getEpoch()","getExitStubs":"stubs = getExitStubs(roomid)","setButtonStyleSheet":"setButtonStyleSheet(button, markup)","feedTriggers":"feedTriggers(text)","deleteArea":"deleteArea(areaID or areaName)","getRoomArea":"areaID = getRoomArea(roomID)","selectCaptureGroup":"selectCaptureGroup(groupNumber)","enableScrollBar":"enableScrollBar(windowName)","setBorderLeft":"setBorderLeft(size)","setBorderRight":"setBorderRight(size)","lowerWindow":"lowerWindow(labelName)","addCustomLine":"addCustomLine(roomID, id_to, direction, style, color, arrow)","setBorderColor":"setBorderColor(r,g,b)","setBorderBottom":"setBorderBottom(size)","moveWindow":"moveWindow( name, x, y )","resetRoomArea":"resetRoomArea (areaID)","setBgColor":"setBgColor([windowName], r,g,b )","getCurrentLine":"getCurrentLine()","setBackgroundColor":"setBackgroundColor(labelName, red, green, blue, transparency)","moveGauge":"moveGauge(gaugeName, newX, newY)","setAreaName":"setAreaName(areaID or areaName, newName)","getButtonState":"getButtonState()","setLabelOnLeave":"setLabelClickCallback(labelName, luaFunctionName, optional any amount of arguments)","sendSocket":"sendSocket(data)","echoPopup":"echoPopup([window], text, {commands}, {hints}, [current or default format])","deselect":"deselect([optional window name])","permKey":"permKey(name, parent, <i>modifier</i>, key code, lua code)","sendGMCP":"sendGMCP(command)","appendCmdLine":"appendCmdLine()","send":"send( command, show on screen )","selectString":"selectString( [windowName], text, number_of_match )","createMapImageLabel":"labelID = createMapImageLabel(areaID, filePath, posx, posy, posz, width, height, zoom, showOnTop)","getProfileName":"name = getProfileName()","setRoomArea":"setRoomArea(roomID, newAreaID or newAreaName)","saveMap":"saveMap(location)","roomExists":"roomExists(roomID)","getIrcNick":"getIrcNick()","isPrompt":"isPrompt()","highlightRoom":"highlightRoom( roomID, color1Red, color1Green, color1Blue, color2Red, color2Green, color2Blue, highlightRadius, color1Alpha, color2Alpha)","getMainConsoleWidth":"getMainConsoleWidth()","echoUserWindow":"echoUserWindow(windowName)","setUnderline":"setUnderline(windowName, bool)","getRoomIDbyHash":"roomID = getRoomIDbyHash(hash)","setMergeTables":"setMergeTables(module)","getLastLineNumber":"getLastLineNumber(window)","getAreaExits":"getAreaExits(areaID, showExits)","getAreaRooms":"getAreaRooms(area id)","moveCursorEnd":"moveCursorEnd( windowName )","addMapEvent":"addMapEvent(uniquename, event name, parent, display name, arguments)","getColorWildcard":"getColorWildcard(ansi color number)","createLabel":"createLabel(name, Xpos, Ypos, width, height, fillBackground)","disableScrollBar":"disableScrollBar(windowName)","restartIrc":"restartIrc()","hideWindow":"hideWindow(name)","lockRoom":"lockRoom (roomID, lock = true/false)","sendATCP":"sendATCP(message, what)","sendMSDP":"sendMSDP(variable[, value][, value...])","getLineCount":"getLineCount()","wrapLine":"wrapLine(windowName, lineNumber)","getRoomName":"roomName = getRoomName(roomID)","getColumnCount":"getColumnCount([window])","disableKey":"disableKey(name)","getMudletLuaDefaultPaths":"getMudletLuaDefaultPaths()","hecho":"hecho(window, text)","getModulePriority":"priority = getModulePriority(module name)","alert":"alert(<i>seconds</i>)","setLabelDoubleClickCallback":"setLabelDoubleClickCallback(labelName, luaFunctionName, optional any amount of arguments)"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you pretty-print it and name lua-function-list.json
to be in line with the rest of resources?
src/mudlet.cpp
Outdated
bool mudlet::loadLuaFunctionList() | ||
{ | ||
qDebug() << "Loading the luaFunctionList via loadLuaFunctionList()..."; | ||
QFile* jsonFile = new QFile(QStringLiteral(":/luaFunctionList.json")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 perfect
…be themed appropriately now and should be using the currently set font.
Prettified `lua-function-list.json`
@dicene let us know when 1.0 is good for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though its not much on the Mudlet side
src/dlgTriggerEditor.cpp
Outdated
@@ -193,6 +193,50 @@ dlgTriggerEditor::dlgTriggerEditor(Host* pH) | |||
|
|||
mudlet::loadEdbeeTheme(mpHost->mEditorTheme, mpHost->mEditorThemeFile); | |||
|
|||
edbee::StringTextAutoCompleteProvider* provider = new edbee::StringTextAutoCompleteProvider(); | |||
//QListIterator<QString> i(mudlet::); | |||
foreach(QString key, mudlet::mLuaFunctionNames.keys()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foreach
is an outdated Qt macro - go with for (auto key : mudlet::mLuaFunctionNames.keys())
@@ -193,6 +193,50 @@ dlgTriggerEditor::dlgTriggerEditor(Host* pH) | |||
|
|||
mudlet::loadEdbeeTheme(mpHost->mEditorTheme, mpHost->mEditorThemeFile); | |||
|
|||
edbee::StringTextAutoCompleteProvider* provider = new edbee::StringTextAutoCompleteProvider(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to a QScopedPointer
so we don't have to worry about a memory leak when the profile is closed
src/mudlet.cpp
Outdated
|
||
auto json_doc = QJsonDocument::fromJson(data); | ||
|
||
if(json_doc.isNull()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run the clang-formatter on this (just the functions you've made)
…ndle other fonts based on config.
…vent-handling much easier.
Could someone test it in Linux, run from a console, and see if they're getting Edbee memory leak messages? I've had no luck finding those messages when I test in Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - just clean up some of the commented out things
src/TLuaInterpreter.cpp
Outdated
#include <QSslConfiguration> | ||
#include <QString> | ||
#include <QStringList> | ||
#include <QStringBuilder> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed for this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No clue where the QSslConfiguration is coming from. I don't remember adding it, heh. I'll see what I can remove without breaking things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git merge
conflict resolution of the development
branch into this one at: b6bb142 {Ian ieadkins@gmail.com 2018-06-21 16:35:05 - "Merge branch 'development' into autocomplete"} at that point TWO instances of #include "post_guard.h"
got in, each with a different set of #include
lines preceding them... 👎
P.S. QSslConfiguration
is needed to be available in the TLuainterpreter
class as it is used by the downloadFile
function {apropos of other current OpenSSL stuff currently going on, this is provided QT_NO_OPENSSL
is NOT defined! 😮 }
provider->add("then", 14); | ||
provider->add("true", 14); | ||
provider->add("until", 14); | ||
provider->add("while", 14); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add goto
here given that we know that's coming in 5.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can doooo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, I thought we were stuck on Lua 5.1.x because changing that would break backwards compatibility - or are we planned a step-change/break with Mudlet 5.0 (or, um, 4.0)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No plans, but can't hurt to hint to avoid that as a variable name
src/mudlet.cpp
Outdated
@@ -508,6 +515,12 @@ void mudlet::initEdbee() | |||
// We only need the single Lua lexer, probably ever | |||
grammarManager->readGrammarFile(QLatin1Literal(":/edbee_defaults/Lua.tmLanguage")); | |||
|
|||
//Open and parse luaFunctionList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a very good comment - the functions name is luaFunctionList to begin with - what is this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make it more insightful
Yeah, that's likely what's causing that issue. I don't think there's a fix for this besides making a pass at every Lua function in the wiki and cleaning them up so they're all suitable for this use. I can do that in this PR or another, whatever is most appropriate. |
Not sure if adjusting wiki is a viable option here. It seems to me like a bug in your code, because in one place, you can display equal sign "=" just fine, only in a different place it is a problem. Here is another example of the same, to show you it is not easy to remove in wiki, because for example we want to display return parameters for clarification: |
I have had unexpected crashes quite a few times now while testing autocompletion when clicking into other windows (not Mudlet) - how should I report details for you to review? |
…utosave when the list shows up.
@Kebap Not sure what you mean by one of those comments. I think it's fair to have certain expectations about the wiki's format, or else it'll be impossible to scrape. I don't think it'll ever be necessary to have two equals signs in a function's signature, so I'll be sure to clear up the ones that break that rule. Looking into the other issue. |
Which one comment was unclear? I did not find any function with two equal signs. The problems arose whenever there was one equal sign. |
The one that starts with "Not sure if adjusting wiki is a viable option here...". The reason you don't find any function with two equal signs is because I fixed them yesterday. 😄 The issue where it's showing the wrong tooltip is something I'm tracking down right now. |
Ok fair enough. I have now seen the 3 changes you did in the wiki yesterday a few hours after I was active there. Then again, there were no double equal signs == visible to me. You removed only single ones, right? What is more, none of those functions were involved in the issues reported above. Maybe we are constantly misunderstanding?! |
There were two issues. The first occurred when there was a second = sign anywhere in the function's signature. The three(I think three) functions that I had to change had another = sign in the parameters list. They were something like |
Looking at the lua function list json there are about 30 functions with an equal sign = in the definition. Most of them are not inside the parameters list, but instead used to display the returned value from that function. I would welcome some code to display them in your autocomplete list, and not remove them from wiki. |
Reviewing those 30 function definitions, most of them can be axed easily after all. They seem utterly obvious and therefore irrelevant like |
The ones with a single equals sign are fine. I'm using that equals sign to grab the return name. It was only an issue that those functions had an extra one in the parameters. And that wrong line issue is strange. I'll have to do some more testing to try and reproduce that. Gonna get the other known issue, the incorrect tooltip showing, cleaned up today. |
And I'll rescrape the functions so those 3 equals sign duplicates are fixed. |
…isplayed. Updated lua-function-list.json to fix three occasions of unnecessary equals sign's messing up the list generation(equal's sign shouldn't be anywhere in the function's signature except between the return value and the function's name.
Corrects placement of autocomplete list when editor isn't scrolled to the very top. Updates tooltip placement to only display to the left if there is enough room left, and not enough room right. If there isn't room in either direction, it's shown right so there isn't confusion about whether the tooltip for that entry actually exists.
…st. List placement now takes into account the actual line-number-margin size as well as the horizontal scrollbar. All placement issues should be fixed.
@Kebap is this good to go? |
Brief overview of PR changes/additions
Initial commit of autocomplete support for edbee textbox
Motivation for adding to Mudlet
Coding in Mudlet can take a significant amount of time due to the massive list of lua functions added and the lack of any documentation in the program itself. It often ends up requiring having the Lua Function list on the Wiki open the entire time and feels like a significant impedance to quickly writing code unless you have another monitor open with said Function list. Hopefully, adding an autocomplete feature will make the process of writing code significantly less daunting for new and old users alike.
Other info (issues closed, discussion etc)
Remaining changes before I think it's ready to be added to the next release:
Known issues: