Comments (5)
We don't have a way to do this currently. You may be interested in writing a short plugin that would do that for you.
from lua-language-server.
In my opinion, inject field diagnostic isn't smart enough yet and has its false positives. I suggest opening an issue or looking if an issue about this was already reported.
from lua-language-server.
I looked into plugins and I can e.g. replace ---@override
with a ---@see parent.method
, but I don't know how I can retrieve the parents function definition directly.
from lua-language-server.
Oh, looks like the Wiki docs aren't up to date anymore. There is more info on plugins on the project's GitHub pages: https://luals.github.io/wiki/plugins/. I can't really help you from here, I haven't used plugin api.
from lua-language-server.
Alright thank you for the links, I made a plugin which injects ---@alias
at definitions, and ---@type
and ---@see
at overrides. Only param/return comments disappear but otherwise seems to be working fine for me.
However I struggle to understand another concept, maybe you can help me here :)
---@class (exact) A
---@field ox number
local a = {}
function a:init()
--This is fine
self.ox = 0
end
---@class (exact) B : A
local b = {}
function b:init()
--This is an injection and thus invalid
self.ox = 0
end
---@type B
local x
--But this is fine again?
x.ox = 0
Why does it want to inject a new field into B in the B's init? How can I specify that its fine to inject when its already inherited?
Another viewpoint would be: I don't want inheritance, but composition. Right now I have A.ox
AND B.ox
, but in my case it doesn't matter who introduced that value, its now just ox
.
from lua-language-server.
Related Issues (20)
- Trailing slash for rootUri will duplicate folder name HOT 1
- Do not shadow/re-inject fields in child-classes HOT 1
- @overload not as expected check param in class instance
- Possible typo when handling `workspace.library`
- [Feature request] Support for the upvalue limit HOT 1
- neovim补全项对比vscode下有缺漏
- generic in the loop HOT 1
- Collapsing of functions in the editor breaks if there is a comment before and after the function declaration
- How to link to treesitter folder from `workspace.library`? HOT 3
- VSCode pop-up error `Request textDocument/documentSymbol failed.` when typing
- When using alias values as its keys, Dictionary types don't give completion when defining an instance of that dictionary
- Error returning derived classes
- Optional not removed in if/elseif block for field in filter
- 目录重命名, 移动目录, 在自动修改req路径时, 新路径会出现多余字符, 或者不修改
- [Future Ruquest] Add tracking for `rawset()` in function runtime and etc
- [Feature Request] Support custom file extension
- Command line doc_out_path arg doesn't work
- Missing fields on inherited class not resulting in diagnostics warnings
- Function with generic variable return type loses typing after first return
- ---@class with function return question
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-language-server.