feat: add lsp_status
component to display active LSPs and progress
#1376
+150
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1375.
Following an example of a simple LSP progress using notifications: https://github.com/folke/snacks.nvim/blob/main/docs/notifier.md#-examples, we implement a simple
lsp_status
component that:autocmd
onLspProgress
to update the spinner state and refreshes Lualine if the state changedNot all LSPs support progress (e.g.,
bashls
does not). In that case, we simply skip the spinner and display only the LSP name.LSPs are separated by a configurable delimiter. The progress state symbols are also configurable.
Screenshots:
![lualine-bashls-no-progress](https://private-user-images.githubusercontent.com/5368018/412258741-da44e21a-2e1f-49dd-90aa-6c38f13c2c76.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODg0MzQsIm5iZiI6MTczOTU4ODEzNCwicGF0aCI6Ii81MzY4MDE4LzQxMjI1ODc0MS1kYTQ0ZTIxYS0yZTFmLTQ5ZGQtOTBhYS02YzM4ZjEzYzJjNzYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDI1NTM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTgyODY3NGVjN2I3ZDRiNzkyYWI3NzA3YTU2MGRhZTkwMDAxOGQ1Zjk2MGRhZDQxNzAxYzc1MmRhMjlkZmQ2ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.GgDhIjX3MPSo7aBZBUwiz5AEmchn5M2BvPeAJIZFG3s)
![lualine-lua_ls-done](https://private-user-images.githubusercontent.com/5368018/412258747-16880b41-0577-4d9b-9722-67617f6bce87.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODg0MzQsIm5iZiI6MTczOTU4ODEzNCwicGF0aCI6Ii81MzY4MDE4LzQxMjI1ODc0Ny0xNjg4MGI0MS0wNTc3LTRkOWItOTcyMi02NzYxN2Y2YmNlODcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMDI1NTM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWZjYTRiNDhjMzE4N2IyYmVmY2U5MGU1NWY4NzRlNTRmMWI3ZjZiYzlhNDM1MThmMGUzM2YxNGZmMmY0MzJlMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Vn7vugMQ-z9e5Q9tFB0J65Ppt3C77M1TwgqzymCSG_s)
![lualine-lua_ls-progress](https://private-user-images.githubusercontent.com/5368018/412258751-e899aeb0-5093-4414-8262-82f61b6fa4b1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6Ik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