{"id":24778476,"url":"https://github.com/willlillis/lspresso-shot","last_synced_at":"2025-10-12T03:30:20.820Z","repository":{"id":273150471,"uuid":"916454798","full_name":"WillLillis/lspresso-shot","owner":"WillLillis","description":"A concentrated dose of LSP testing power!","archived":false,"fork":false,"pushed_at":"2025-06-24T03:29:37.000Z","size":545,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T05:55:33.710Z","etag":null,"topics":["lsp","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WillLillis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-14T06:01:14.000Z","updated_at":"2025-06-02T03:13:07.000Z","dependencies_parsed_at":"2025-03-13T06:21:00.006Z","dependency_job_id":"1f91c75e-09b1-4406-b2b8-3164813c5a56","html_url":"https://github.com/WillLillis/lspresso-shot","commit_stats":null,"previous_names":["willlillis/lspresso-shot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WillLillis/lspresso-shot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillLillis%2Flspresso-shot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillLillis%2Flspresso-shot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillLillis%2Flspresso-shot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillLillis%2Flspresso-shot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WillLillis","download_url":"https://codeload.github.com/WillLillis/lspresso-shot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WillLillis%2Flspresso-shot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010148,"owners_count":26084692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lsp","testing"],"created_at":"2025-01-29T08:37:31.688Z","updated_at":"2025-10-12T03:30:20.815Z","avatar_url":"https://github.com/WillLillis.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LSPresso-Shot\n\nA concentrated dose of LSP testing power!\n\n## Goal\n\nProvide an easy way to perform integration tests on language servers implemented in Rust.\n\n## Usage\n\nFirst, add lspresso-shot as a dependency to your Rust project:\n\n```shell\ncargo add --dev lspresso-shot\n```\n\nWrite a test:\n\n```rust\n#[test]\nfn it_does_the_hover_thing() {\n    let hover_test_case = TestCase::new(\n        \"Path to server\",\n        TestFile::new(\"Source file name\", \"Contents\")\n    )\n    .other_file( // Optional\n        TestFile::new(\"Other file name\", \"Other contents\")\n    );\n\n    let cursor_pos = Position::new(1, 2);\n    lspresso_shot!(test_hover(\n        hover_test_case,\n        cursor_pos,\n        Some(\u0026Hover {\n            range: Some(Range {\n                start: lsp_types::Position {\n                    line: 1,\n                    character: 2,\n                },\n                end: lsp_types::Position {\n                    line: 3,\n                    character: 4,\n                },\n            }),\n            contents: lsp_types::HoverContents::Markup(MarkupContent {\n                kind: lsp_types::MarkupKind::Markdown,\n                value: \"Hover window contents here\".to_string(),\n            })\n        })\n    ));\n}\n```\n\nOr a benchmark:\n\n```rust\nfn blazingly_fast() {\n    let references_test_case = TestCase::new(\n        \"Path to server\",\n        TestFile::new(\"Source file name\", \"Contents\")\n    );\n\n    let cursor_pos = Position::new(1, 2);\n    let include_declaration = true;\n    let measurements: Vec\u003cDuration\u003e = benchmark_references(\n        \u0026test_case,\n        BenchmarkConfig::default(),\n        cursor_pos,\n        include_declaration,\n    );\n}\n```\n\nThat's it!\n\n## Dependencies:\n\nNeovim must be available on your `$PATH`. See the project's [documentation][nvim-install-docs]\nfor installation instructions. Versions at or later than [`517ecb8`][nvim-min-commit]\nare necessary.\n\n## Examples:\n\n- The library's test corpus uses [rust-analyzer][rust-analyzer]. See [`test-suite/src/*`][repo-tests]\nfor examples of how to use the library.\n- TODO: Add asm-lsp/other LSPs here once it's being used.\n\n## Gotchas/Known Issues\n\n- If your server undergoes some sort of indexing process at startup before it's ready\nto service a given request, you need to account for this by specifying `ServerStartType::Progress(NonZeroU32, String)`\nto the test case. The `NonZeroU32` specifies *which* `end` message to issue the request\nafter (in case there are multiple). The `String` provides the relevant [progress token][progress-token].\n\n- **String comparison of results**: Many LSP client implementations do some post processing\nof responses returned by a given language server before displaying it to the user. Your expected\nresponse may need to be minimally altered from what you see in your editor in order for tests\nto pass.\n\n- **Uri fields**: If a response contains a Uri field with an absolute path, this field\nwill be sanitizd to a relative path up to the test case's root directory. Your test case's\nexpected results may need to be adjusted to reflect this.\n\n- **Variance in LSP client implementation**: The [LSP Spec][lsp-spec] is somewhat loosely defined,\nleaving plenty of room for client implementations to behave differently from one another. This\nproject utilizes [neovim][nvim-repo]'s, meaning that unexpected behavior may occur when your server\nis used with other editors' clients.\n\n- **Ambiguous Deserialization of Response Types**: Several response types specified in the \n[LSP Spec][lsp-spec] are ambiguously deserialized to multiple types from their JSON representations.\nBecause the LSP specification is defined over JSON RPC, this means that the value received by the\nLSP client may not match the value sent by your server. Any request affected by ambiguity will treat\nsuch values as equal in using the default comparison logic. Error messages may still display incorrect\nor misleading types, however.\n\n## Contributing\n\n- In addition to [neovim][nvim-repo], working on this project also requires having having\n[rust-analyzer][rust-analyzer] rust-analyzer 1.87.0 (17067e9 2025-05-09) on your `$PATH`, as it is used in the project's test suite.\n\n[lsp-spec]: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/\n[progress-token]: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progress\n[nvim-repo]: https://github.com/neovim/neovim\n[nvim-install-docs]: https://github.com/neovim/neovim#install-from-source\n[nvim-min-commit]: https://github.com/neovim/neovim/commit/517ecb85f58ed6ac8b4d5443931612e75e7c7dc2\n[rust-analyzer]: https://github.com/rust-lang/rust-analyzer\n[repo-tests]: https://github.com/WillLillis/lspresso-shot/tree/master/test-suite/src\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilllillis%2Flspresso-shot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilllillis%2Flspresso-shot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilllillis%2Flspresso-shot/lists"}