Skip to content
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

[PREVIEW] a new lua language server #3017

Open
CppCXY opened this issue Dec 31, 2024 · 29 comments
Open

[PREVIEW] a new lua language server #3017

CppCXY opened this issue Dec 31, 2024 · 29 comments
Labels

Comments

@CppCXY
Copy link
Collaborator

CppCXY commented Dec 31, 2024

This language server has excellent performance and rich features, and it’s compatible with most of luals’ features. If you’re interested, feel free to give it a try.

language server: https://github.com/CppCXY/emmylua-analyzer-rust
vscode plugin: https://marketplace.visualstudio.com/items?itemName=tangzx.emmylua

@Mc-GrowlR
Copy link
Contributor

Can I export the document now?

@CppCXY
Copy link
Collaborator Author

CppCXY commented Jan 1, 2025

Can I export the document now?

Exporting documentation is actually not the job of the language server, but I also agree that there is no good tool for exporting documentation that supports luacats well. The documentation export function of luals itself is not very effective and not highly usable. I might consider adding a standalone CLI for documentation export in the future, but not now.

@CppCXY
Copy link
Collaborator Author

CppCXY commented Jan 1, 2025

The release was too rushed yesterday, and I didn't provide a detailed description of the features. However, I plan to describe its features once I am almost done (in about ten days).

@Mc-GrowlR
Copy link
Contributor

Can I export the document now?我现在可以导出文档吗?

Exporting documentation is actually not the job of the language server, but I also agree that there is no good tool for exporting documentation that supports luacats well. The documentation export function of luals itself is not very effective and not highly usable. I might consider adding a standalone CLI for documentation export in the future, but not now.导出文档实际上不是语言服务器的工作,但我也同意没有一个好的工具可以很好地支持 luacats 来导出文档。luals 本身的文档导出功能不是很有效,也不是很好用。我可能会考虑在未来添加一个独立的 CLI 来导出文档,但现在不会。
Agreed, this is indeed the case with exporting documents, and I would like to have a good tool for exporting documents. I look at the last dozens of issues, and the proportion of issues about exporting documents is also quite a lot, and it seems that everyone has a great demand for this feature.

@Mc-GrowlR
Copy link
Contributor

Regarding the purpose of exporting documents, I feel that I can use the JSON documents exported from the document to convert the Lua library files annotated with Luacats into library files in various Lua dialects in batches, so that we can quickly share various Lua ecological components in various Lua dialects.

@CppCXY
Copy link
Collaborator Author

CppCXY commented Jan 1, 2025

Regarding the purpose of exporting documents, I feel that I can use the JSON documents exported from the document to convert the Lua library files annotated with Luacats into library files in various Lua dialects in batches, so that we can quickly share various Lua ecological components in various Lua dialects.

If it's just for this purpose, all you need is a parser and simple analysis to achieve your goal, and I have already provided such a parser.

@Mc-GrowlR
Copy link
Contributor

What kind of form is it? Can I get the results of my analysis?

@CppCXY
Copy link
Collaborator Author

CppCXY commented Jan 2, 2025

What kind of form is it? Can I get the results of my analysis?

a rust lib, I described this library in a previous issue, and it supports both strongly-typed APIs and simple APIs. Additionally, they can be converted freely between each other.

@CppCXY
Copy link
Collaborator Author

CppCXY commented Jan 10, 2025

The current language server and plugin have been released. If you're interested, you can give them a try. My next step is to plan the design of export documentation.

@Mc-GrowlR
Copy link
Contributor

The current language server and plugin have been released. If you're interested, you can give them a try. My next step is to plan the design of export documentation.当前的语言服务器和插件已经发布。如果您感兴趣,可以尝试使用。我的下一步是规划导出文档的设计。

Ok。thanks

@ParadiseFallen
Copy link

can it run in wasm for mocano?

@CppCXY
Copy link
Collaborator Author

CppCXY commented Jan 30, 2025

can it run in wasm for mocano?

I'm unsure if WASM supports asynchronous operations, and my codebase is fully asynchronous. Additionally, the file system poses another issue—I don't know how to load the workspace in the WebIDE. Perhaps a dedicated crate needs to be written to support the WASM runtime. On another note, since the language server itself supports TCP connections, that might be a viable solution.

@tomlau10
Copy link
Contributor

我嘗試在 macbook 上安裝 vscode plugin tangzx.emmylua,但好像遇到 server start error

dyld: Symbol not found: __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
  Referenced from: /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/emmylua_ls
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/emmylua_ls
[Error - 11:35:29 AM] Server process exited with signal SIGABRT.
[Error - 11:35:29 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 

因特殊原因我 macos 是停留在 11.6
是不是太舊了所以 prebuilt binary 不支持。。。
我只能手動 build 嗎? @CppCXY

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 21, 2025

我嘗試在 macbook 上安裝 vscode plugin tangzx.emmylua,但好像遇到 server start error

dyld: Symbol not found: __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
  Referenced from: /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/emmylua_ls
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/emmylua_ls
[Error - 11:35:29 AM] Server process exited with signal SIGABRT.
[Error - 11:35:29 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 

因特殊原因我 macos 是停留在 11.6 是不是太舊了所以 prebuilt binary 不支持。。。 我只能手動 build 嗎? @CppCXY

我不清楚github有没有提供低版本的mac, 有的话你可以试试, 或者你可以在拥有rust工具链后, 一键编译

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 24, 2025

我嘗試在 macbook 上安裝 vscode plugin tangzx.emmylua,但好像遇到 server start error

因特殊原因我 macos 是停留在 11.6 是不是太舊了所以 prebuilt binary 不支持。。。 我只能手動 build 嗎? @CppCXY

我不清楚github有没有提供低版本的mac, 有的话你可以试试, 或者你可以在拥有rust工具链后, 一键编译

我根据deepseek的提示在项目中添加了配置:

[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-mmacosx-version-min=10.15"]

你可以试试是否有用, 毕竟我没有mac
可以从这里下载试试看: https://github.com/CppCXY/emmylua-analyzer-rust/actions/runs/13489606355

@tomlau10
Copy link
Contributor

你可以试试是否有用, 毕竟我没有mac
可以从这里下载试试看: https://github.com/CppCXY/emmylua-analyzer-rust/actions/runs/13489606355

我下載後放到 ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/
好像還是不行 ☹ 一樣的錯誤

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ ls -l
total 45528
-rwxrwxrwx@ 1 tomlau10  staff  11592844 Feb 24 11:02 emmylua_ls
-rwxrwxrwx  1 tomlau10  staff  11713384 Feb 21 11:34 emmylua_ls.bak

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ ./emmylua_ls
dyld: Symbol not found: __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
  Referenced from: /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/./emmylua_ls
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/./emmylua_ls
Abort trap: 6

我問 gpt4o 他也是給出同樣的解決方法 ...

[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-mmacosx-version-min=11.6"]

而這裡找到另1個是說 xcode build c++ project 遇到類似問題 🤔
https://developer.apple.com/forums/thread/724390

And solved -- it needs to have -target ${arch}-apple-${os}${version}, eg x86_64-apple-macos11.5.

但這個似是 xcode project 的配置,我不知怎樣用在 rust project 上...

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 24, 2025

你可以试试是否有用, 毕竟我没有mac
可以从这里下载试试看: https://github.com/CppCXY/emmylua-analyzer-rust/actions/runs/13489606355

我下載後放到 ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/ 好像還是不行 ☹ 一樣的錯誤

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ ls -l
total 45528
-rwxrwxrwx@ 1 tomlau10  staff  11592844 Feb 24 11:02 emmylua_ls
-rwxrwxrwx  1 tomlau10  staff  11713384 Feb 21 11:34 emmylua_ls.bak

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ ./emmylua_ls
dyld: Symbol not found: __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
  Referenced from: /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/./emmylua_ls
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/./emmylua_ls
Abort trap: 6

我問 gpt4o 他也是給出同樣的解決方法 ...

[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-mmacosx-version-min=11.6"]
而這裡找到另1個是說 xcode build c++ project 遇到類似問題 🤔 https://developer.apple.com/forums/thread/724390

And solved -- it needs to have -target ${arch}-apple-${os}${version}, eg x86_64-apple-macos11.5.

但這個似是 xcode project 的配置,我不知怎樣用在 rust project 上...

主要是github已经把macos 10.15的虚拟机停用了, 得另寻他法

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 24, 2025

但這個似是 xcode project 的配置,我不知怎樣用在 rust project 上...

主要是github已经把macos 10.15的虚拟机停用了, 得另寻他法

我尝试了:

export MACOSX_DEPLOYMENT_TARGET=10.15

感觉应该可能可以, 有机会可以再试试

@Issues-translate-bot
Copy link

Sumneko Lua translate bot


But this seems to be a configuration of xcode project, I don't know how to use it on the rust project...

Mainly, Github has deactivated the virtual machine of macos 10.15, so we have to find another way

I tried:

export MACOSX_DEPLOYMENT_TARGET=10.15

It seems like it should be possible, I can try it again if I have the chance

@tomlau10
Copy link
Contributor

從這個 stackoverflow 的回覆中

  • -mmacosx-version-min 本身是 gcc 的 flag
  • MACOSX_DEPLOYMENT_TARGET 根據 gcc 的 man page 說,是和 -mmacosx-version-min 一樣效果的
  • 但是 ‼ apple 是換成 clang
    而 clang 在支持這個 option 時,將 flag name 改成 -mmacos-version-min (沒有 x)

https://stackoverflow.com/questions/25352389/what-is-the-difference-between-macosx-deployment-target-and-mmacosx-version-min#comment137650077_62470735


不知真假 🤔
google "-mmacos-version-min" 的話,確實有一些文章是用這個 沒有 x 的 flag
比如這個:
https://www.cnblogs.com/z16166/p/16861268.html

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 25, 2025

從這個 stackoverflow 的回覆中

  • -mmacosx-version-min 本身是 gcc 的 flag
  • MACOSX_DEPLOYMENT_TARGET 根據 gcc 的 man page 說,是和 -mmacosx-version-min 一樣效果的
  • 但是 ‼ apple 是換成 clang
    而 clang 在支持這個 option 時,將 flag name 改成 -mmacos-version-min (沒有 x)

https://stackoverflow.com/questions/25352389/what-is-the-difference-between-macosx-deployment-target-and-mmacosx-version-min#comment137650077_62470735

不知真假 🤔 google "-mmacos-version-min" 的話,確實有一些文章是用這個 沒有 x 的 flag 比如這個: https://www.cnblogs.com/z16166/p/16861268.html

我尝试了这个方案:

RUSTFLAGS="-C link-args=-mmacos-version-min=10.15" cargo build 

试试: https://github.com/CppCXY/emmylua-analyzer-rust/actions/runs/13517997221/job/37770686540

@tomlau10
Copy link
Contributor

我尝试了这个方案:

RUSTFLAGS="-C link-args=-mmacos-version-min=10.15" cargo build

试试: https://github.com/CppCXY/emmylua-analyzer-rust/actions/runs/13517997221/job/37770686540

剛試了,無效。。。 🤦‍♂

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ ls -l
total 47456
-rwxrwxrwx@ 1 tomlau10  staff  11601164 Feb 26 10:51 emmylua_ls
-rwxrwxrwx  1 tomlau10  staff  11713384 Feb 21 11:34 emmylua_ls.bak

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ ./emmylua_ls
dyld: Symbol not found: __ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
  Referenced from: /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/./emmylua_ls
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/tomlau10/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server/./emmylua_ls
Abort trap: 6

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 26, 2025

我尝试了这个方案:

RUSTFLAGS="-C link-args=-mmacos-version-min=10.15" cargo build

试试: https://github.com/CppCXY/emmylua-analyzer-rust/actions/runs/13517997221/job/37770686540

剛試了,無效。。。 🤦‍♂

应该是libc++版本问题, 你能尝试升级吗

@tomlau10
Copy link
Contributor

用 otool 檢查的額外訊息

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls | grep -A5 LC_VERSION

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls.bak | grep -A5 LC_VERSION
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.12
      sdk 14.5
Load command 10
      cmd LC_SOURCE_VERSION
  • 最新下載的 沒有 LC_VERSION_MIN_MACOSX
  • 反而原始版 (即現有安裝 vscode 插件自帶的 binary) 的是有指明 10.12 😳

应该是libc++版本问题, 你能尝试升级吗

你是指升級 macos 嗎?
我是因為要使用某些軟件,最多只支援 macos 11
所以一直沒再升級 macos

或者我看看 libc++ 能否單獨升級 🤔

@Issues-translate-bot
Copy link

Sumneko Lua translate bot


Extra messages checked with otool

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls | grep -A5 LC_VERSION

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls.bak | grep -A5 LC_VERSION
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.12
      sdk 14.5
Load command 10
      cmd LC_SOURCE_VERSION
  • Latest downloads No LC_VERSION_MIN_MACOSX
  • On the contrary, the original version (that is, the binary that comes with the existing vscode plug-in installed) is specified 10.12 😳

It should be a libc++ version issue, can you try to upgrade

Do you mean upgrading macos?
I want to use some software, and only support macos 11 at most
So I haven't upgraded macos

Or I can see if libc++ can be upgraded separately 🤔

@CppCXY
Copy link
Collaborator Author

CppCXY commented Feb 26, 2025

用 otool 檢查的額外訊息

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls | grep -A5 LC_VERSION

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls.bak | grep -A5 LC_VERSION
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.12
      sdk 14.5
Load command 10
      cmd LC_SOURCE_VERSION
  • 最新下載的 沒有 LC_VERSION_MIN_MACOSX
  • 反而原始版 (即現有安裝 vscode 插件自帶的 binary) 的是有指明 10.12 😳

应该是libc++版本问题, 你能尝试升级吗

你是指升級 macos 嗎? 我是因為要使用某些軟件,最多只支援 macos 11 所以一直沒再升級 macos

或者我看看 libc++ 能否單獨升級 🤔

看来一番努力并没有用, 他就是最低支持到10.12的, 我还提高到了10.15去了, 剩下的看能否处理libc++的问题了, 其实你装个rust工具链就可以自己编译了

@Issues-translate-bot
Copy link

Sumneko Lua translate bot


Extra messages checked with otool

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls | grep -A5 LC_VERSION

tomlau10@tomlau10-lakoo ~/.vscode/extensions/tangzx.emmylua-0.9.13-darwin-x64/server
$ otool -l ./emmylua_ls.bak | grep -A5 LC_VERSION
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.12
sdk 14.5
Load command 10
cmd LC_SOURCE_VERSION
  • Latest download No LC_VERSION_MIN_MACOSX
  • On the contrary, the original version (that is, the binary that comes with the existing vscode plug-in installed) is specified 10.12 😳

It should be a libc++ version issue, can you try to upgrade

Are you referring to upgrading macos? I have not upgraded macos again because I want to use certain software, which only supports macos 11 at most.

Or I can see if libc++ can be upgraded separately 🤔

It seems that some efforts are useless. It only supports it to 10.12 at the minimum, and I have also increased it to 10.15. The rest depends on whether I can handle the libc++ problem. In fact, you can compile it yourself by installing a rust toolchain.

@tomlau10
Copy link
Contributor

tomlau10 commented Mar 1, 2025

我剛剛在1個 macos 12 的 vm 上測試 compile,然後放到1個 macos 10.15 的 vm 上跑
各種方式之中只有你最初提出的 MACOSX_DEPLOYMENT_TARGET=10.15 cargo build 的方式是有效
(至於那個 -mmacos-version-min / -mmacosx-version-min 完全沒效。。。 🤦‍♂ )

而在網上找 issue 的過程中


如果 @CppCXY 有空的話,可以考慮再試一次這個方式 🙏

@xuhuanzy
Copy link
Contributor

当前进度为主要诊断已完成, 来点好伙计测试下诊断是否正常

Currently, the main diagnostic functions have been completed, and we require more test cases to ensure their accuracy. If you encounter any anomalies in the diagnostics, please raise an issue so that it can be addressed and fixed.

If there are any diagnostics you still need completed, please provide an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants