Skip to content

[bug] cargo install ast-grep failsΒ #2525

@rg7663

Description

@rg7663

Please read the FAQ for the bug you encountered.

  • I have read the existing FAQ

⏯ Playground Link

https://ast-grep.github.io/playground.html#n/a

πŸ’» Code

N/A

πŸ™ Actual behavior

cargo install ast-grep fails with:

   ...
   Compiling ast-grep-lsp v0.41.0
error[E0063]: missing field `offset_encoding` in initializer of `tower_lsp_server::ls_types::InitializeResult`
  --> /home/dev/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ast-grep-lsp-0.41.0/src/lib.rs:86:8
   |
86 |     Ok(InitializeResult {
   |        ^^^^^^^^^^^^^^^^ missing `offset_encoding`

For more information about this error, try `rustc --explain E0063`.
error: could not compile `ast-grep-lsp` (lib) due to 1 previous error

Same behaviour with cargo install ast-grep@=0.40, but works with cargo install ast-grep@=0.39.

πŸ™‚ Expected behavior

cargo install ast-grep installs 0.41 successfully.

Additional information about the issue

Tested on Raspberry Pi running Raspbian and Arch Linux x86_64, as well as within archlinux docker containers on both, with exactly same outcomes in all cases. Recent or latest rust installs using rustup as well.

I've had a look git blame for ast-grep-lsp, tower-lsp-server, and ls-types and, as far as I can see, the problem likely arises where ast-grep has bumped the tower-lsp-server version from 0.21 to 0.23 which in turn bumped ls-types from github main branch to 0.0. However, the introduction of offset_encoding stems from a 5 year-old commit. So... I don't know why this is only appearing now.

What's strange, at least for me, is that ast-grep 0.41 compiled and installed successfully for me recently, i.e. within the last month or so, so I don't know why this is happening to me now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions