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

begin using emmylua_ls #33344

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

lewis6991
Copy link
Member

@lewis6991 lewis6991 commented Apr 6, 2025

I don't plan on merging this as-is, just a place to hold all the fixes so I can post issues upstream.

Once this gets big enough, I'll cherry pick all the changes which are LuaLS compatible.

@github-actions github-actions bot added build building and installing Neovim using the provided scripts lsp labels Apr 6, 2025
@clason
Copy link
Member

clason commented Apr 6, 2025

Note: these luacats files seem umaintained. We should try to get them upstreamed (so we can point to them in our .deps checkout) or, if necessary, bundle them as meta files.

(They're the exact same ones luals uses, though.)

@telemachus
Copy link
Contributor

telemachus commented Apr 6, 2025

Note: these luacats files seem umaintained.

Agreed. I don't know about the other repos, but I've had an open PR on LuaCATS/luv for nearly a year with no response. The larger point being that without some tweaking, I wasn't able to get that repo to work.

@clason
Copy link
Member

clason commented Apr 6, 2025

Yes, that's how I could tell :)

@@ -88,6 +88,7 @@ local function modifiers_from_number(x, modifiers_table)
return modifiers
end

--- @async
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the implications of this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any function that has a route to coroutine.yield() is marked by the tool as async. The @async annotation is make this explicit. This helps find bugs where the code is called from the main thread but acidentally enters a code path that may yield.

I've got gitsigns fully typed with @async here and have found it a very useful diagnostic as it finds places where functions that are expected to execute synchronously are calling async functions.

"${3rd}/busted/library",
"${3rd}/luv/library"
"luv"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to add a separate emmyrc.json for a sliding migration?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I don't plan on merging this as-is, just a place to hold all the fixes so I can post issues upstream.

Once this gets big enough, I'll cherry pick all the changes which are LuaLS compatible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, assuming (as I do) that we'll eventually want to migrate, would it then(!) make sense to bundle a preconfigured lsp/emmyluals.lua as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too early to tell. EmmyLuaLs is compatible with .luarc.json. The main difference atm is the libraries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The same applies to lsp/luals.lua.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry I misunderstood the question. Yeah sure, we can bundle both.


.PHONY: emmylua-check
emmylua-check: luv
emmylua_check --config=$(PWD)/.luarc.json runtime/lua
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for the purpose of testing in this PR, I'd just vendor these files as runtime/lua/vim/uv/_meta/*; then emmyluals will pick them up automatically (also in downstream projects).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, vendoring will be best just so uv is available in $VIMRUNTIME.

@lewis6991 lewis6991 added the DO NOT MERGE Nothing to see here; move along label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build building and installing Neovim using the provided scripts DO NOT MERGE Nothing to see here; move along lsp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants