LuaLS / LuaLS/lua-language-server
Proper Parameter Support for Class Inheritance via "require" in "lua-language-server"
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
Overview:
I'm using the "lua-language-server" plugin and encountering an issue with class inheritance notation. The inheritance is performed using the syntax class("DemoComp", require("BaseComp")).
Problem Description:
The issue lies in the way "lua-language-server" handles the require function within the class inheritance context. Despite configuring the "Lua.runtime.special" settings, the plugin does not provide accurate hints for classes defined this way. This is because require requires the script path as its first parameter to function properly, making the standard configuration ineffective.
Desired Solution:
I'd like to suggest enhancing the "lua-language-server" plugin's ability to correctly parse and provide class name hints even in cases where class inheritance is written in the form of class("DemoComp", require("BaseComp")).
Suggested Approach:
To achieve this, the plugin could be designed to recognize and parse the parameters of the require function, allowing it to accurately determine the base class in class inheritance scenarios involving require.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by tracing how Lua.runtime.special handles require parameters and how class inheritance hints are derived for class("DemoComp", require("BaseComp")); done means the language server identifies the required module as the base class and provides accurate class-name hints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100