Skip to content

Add EmmyLua_LS support - #60

Closed
notpeter wants to merge 2 commits into
zed-extensions:mainfrom
notpeter:emmylua_ls
Closed

notpeter wants to merge 2 commits into
zed-extensions:mainfrom
notpeter:emmylua_ls

Conversation

@notpeter

Copy link
Copy Markdown
Contributor

Add support for emmylua_ls using the same pattern as the Zed Ruby extension to support multiple LSPs (distinct IDs, settings, paths, etc). Only LuaLS will be enabled by default. While making these changes I also improved LSP Symbol and Completion handling for both the existing and new language servers.

  • Add support for emmylua_ls in addition to lua-language-server
  • Support config specified binary/args/env; PATH found binary with worktree.which; Zed auto-download from GitHub releases (both LSPs)
  • Keep managed downloads isolated by language server
  • Preserve server-provided metadata in custom completion labels. Previously, custom labels omitted signatures, inferred types, and source descriptions.
  • Handle PROPERTY completions same as existing FIELD completions (both LSPs)
  • Highlight symbols by LSP kind without parsing their labels
  • Improve README.md with advanced configuration examples and links

Prior to shipping an extension in the Zed extension store with this code, a companion PR to the Zed repo with new default settings is needed so Zed will automatically prefer LuaLS and disable EmmyLuaLS by default (merge, cherry-pick to preview; wait a week to minimize impact):

    "Lua": {
     "language_servers": ["lua-language-server", "!emmylua_ls", "..."],
    },

@notpeter notpeter mentioned this pull request Aug 27, 2026
@notpeter

notpeter commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Meh. Closed in favor of a competing extension: EmmyLuaLs/Zed-EmmyLua, search extensions for EmmyLua.

Personally I'd suggest this official Zed Lua extension adopt EmmyLuaLS as the default. That extension also include DAP debug support. I'd relegate lua-language-server to 2nd tier (no-default) status. But shrug I'm no longer a Zed maintainer.

@notpeter notpeter closed this Sep 2, 2026
@Fringale

Copy link
Copy Markdown
Contributor

@notpeter Somewhat out of topic for this PR but since you're recommending EmmyLua over LuaLS, I'm curious about your experience with EmmyLua's new internal formatter, that has replaced EmmyLuaCodeStyle since around May I believe.

I gave EmmyLua a serious try some months ago but found the new formatter too intrusive for my taste (no "preserve" setting for tables and functions) and not as stable as EmmyLuaCodeStyle (with the "auto" settings it could get stuck in a state where each consecutive save would alternate between expanding/collapsing some function calls), so I just made a mental note to check back again once it would have matured more and moved back to LuaLS.

@notpeter

Copy link
Copy Markdown
Contributor Author

TBH I'm not writing a whole lot of Lua these days so I haven't used it extensively. If you have a test-case which does not result in stable formatting I would absolutely file that upstream. EmmyLuaCodeStyle also has some cases which don't have stable formatting:

If you have an alternate formatter you prefer to use in Zed, you can just set "format.enable": false in your .luarc.json and configure Zed to use an external CLI formatter instead. See Zed Lua Docs: StyLua Formatting for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants