-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
refactor(lsp): use LPeg for watchfiles matching #23788
Conversation
Interesting that the test is passing on FreeBSD but nowhere else. I'm having trouble repro-ing but I'll keep digging. |
I feel like I've made a reasonable effort to repro the CI failures locally by following along with the CI config but haven't had any luck. I can try hitting CI hard in a separate branch on my fork, but had a question to maybe help me not hit any usage limits: |
I have a local repro now. It's a simple (but maybe not easy) bug in the new matching that was only surfacing based on the path used in the test. |
$NVIM_LOG_FILE is printed on test failure, but currently only C code can log to that. |
-- TODO: '*' inside a {} condition is interpreted literally but should probably have the same | ||
-- wildcard semantics it usually has. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW after a cursory look through a few server implementations, I didn't find any that would be affected by this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome use of lpeg, nice code reduction.
This change is also compatible with 0.9 AFAICT, so backporting this to better enable #23500 to be backported would be great if the not-really-public interface changes and minor behavioral differences here aren't a big issue. |
I think lpeg isn't available in 0.9, it was bundled later in #23216 |
My understanding of that PR is that it doesn't introduce lpeg but changes how lpeg is included in the build process and exposes it in the runtime as @bfredl Does that sound right? Can modules in |
That's because you still have the build dependencies lying around. If you install Neovim via, e.g., homebrew, |
It will work in a local build as it is a build time dependency, but it won't work with distributed binaries. Lpeg as a documented runtime dependency is new for 0.10 and thus this shouldn't be backported. |
This PR updates the LSP glob matching implementation from a hand-rolled parser based on VSCode to be LPeg-based. The grammar is defined using LPeg and outputs an LPeg pattern used to match against incoming events. The motivation for this change is to simplify and improve performance for some of the necessary changes in #23500.
This also fixes a couple of outstanding edge cases. There is one new class of edge case with these changes regarding
**
that's described in theTODO
in the tests. Overall I think this is a net-positive change in terms of correctness though.There should be no other user-facing changes unless users are calling the private
_match
function, which now accepts an LPeg pattern instead of an array of Lua patterns.For reference, the LSP glob syntax is described here: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern