Feat: cpplinter.lua improvements, commenting most library functions - #4910
Feat: cpplinter.lua improvements, commenting most library functions#4910AvajiOT wants to merge 4 commits into
Conversation
|
i don't like idea of |
Yup! It would be. Which is why a quick python script is provided to update every single line in cpplinter.lua. (https://github.com/AvajiOT/forgottenserver-cpplinter-updater) However, for this pull request it can be easily removed if running a python script is too much or seen as cumbersome. luascript.cpp is not touched very often, https://github.com/otland/forgottenserver/commits/master/src/luascript.cpp. In the past 5 months, the only change to lines was reverting the revised NPC system. The last change to luascript.cpp lines before the reverts was 8b9e0b0, which added a couple lines. Again, updating this would take less then a second with the python script provided. While using it for my own uses, it has been quite helpful to quickly go to the specific function instead of having to Ctrl+F through the file. Overall, I did this for myself and my own use-case, and figured at least one person may benefit from the work as well. This pull request does not need to be merged, I won't be torn up about it. Wanted this to be available somewhere for people to take advantage of. |
Pull Request Prelude
Changes Proposed
Working off of EvilHero's initial work on the cpplinter, I did the following work;
Understanding that luascript.cpp is quite big, and adding source lines to every single function starts making it near unmaintainable, I created a simple python script found here; https://github.com/AvajiOT/forgottenserver-cpplinter-updater which will take luascript.cpp and cpplinter.lua and update all "---@source" lines for any luascript.cpp specific lines. To support this, I did add the function with a special prefix "--*" infront of the function.
To maintain now, the function and source line needs to get added, and whenever something changes in luascript.cpp, the python script gets run and every line will be updated as required.
For updated enum/consts, I did not add that specific support, however these should be done extremely less often and can be handled with find/replace lines
Overall, I did this as I wanted to learn more about the lua language server by sumneko, https://github.com/LuaLS/lua-language-server which this required for full usage. I've tested it with VSCode and CLion, and both work extremely well. No more hovering over functions and getting zero information.
Issues addressed: nil
How to test: Hover over lua functions with a properly typed variable, ctrl+click enums or functions, etc..