LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.29k stars 305 forks source link

xmake function scope related support #2690

Closed yao-weijie closed 3 months ago

yao-weijie commented 4 months ago

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Completion, Libraries

Expected Behaviour

在xmake中有描述域和脚本域这种概念,有些函数只能在内部作用域调用,例如


-- 外部作用域
target('tar1', function()
    set_xxx() -- 内部作用域
    on_load(function(target)

    end)
end)

自定义一个addon,在meta文件中

---@meta

---@alias XmakeTargetCallback fun()

---@param name string
---@param opts (XmakeTargetInitOpts|XmakeTargetCallback)?
---@return XmakeTarget
function target(name, opts) end

luals能否实现约束set_xxx和on_xxx这类函数仅作用在XmakeTargetCallback函数内部 并提供补全呢,在外部不提供补全

Actual Behaviour

如上

Reproduction steps

  1. Go to '...'
  2. Click '...'
  3. See error '...'

Additional Notes

No response

Log File

No response

CppCXY commented 4 months ago

xmake是把lua用作了DSL, 如果想要补全最好的办法是单独写个ls插件提供补全功能.

aana-h2 commented 3 months ago

@yao-weijie 我也是neovim,补全什么都没有,能不能教下我怎么做才能有补全呢? 是不是只能自己定义一些meta文件之类的?如果是这样的话老哥能不能分享下你的配置文件?

yao-weijie commented 3 months ago

@yao-weijie 我也是neovim,补全什么都没有,能不能教下我怎么做才能有补全呢? 是不是只能自己定义一些meta文件之类的?如果是这样的话老哥能不能分享下你的配置文件?

等等吧,最近在用2.9.2导出的api自动生成meta文件,但是因为xmake.lua分作用域,要进行过滤就比较麻烦