Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Introduce the StatusBarItem #1237

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented May 4, 2025

The primary motivation for this PR is to make the vscode-haskell extension much friendlier for newcomers.
My idea to improve this is a StatusBarItem that looks like this:

image

The StatusBarItem offers the following actions:

  • Print the extension version
  • Open the Logs for HLS
  • Restart HLS
  • Restart the extension (this is useful for reloading configs, e.g. serverExecutablePath is not picked up by Restart HLS)

image

My goal would be for the future to extend the features presented here, for example:

  • If no server was successfully launched, the Status Bar Item should be red and display options to help the user understand what went wrong. For example, it could offer to re-display the error message, or some kind of "debug this error" functionality.
  • Display the version and location of launched HLS binaries
  • Set the debug level for debugging
  • Display more information when downloading, etc...

That's the main motivation.

Initially, I felt it was tricky to do the kinds of changes I wanted to implement, so I went on a complete tangent and started refactoring the extension to avoid side effects, ad-hoc logic, non-uniform accesses to configuration and similar.
Thus, large parts of this PR are about improving the extension to make it easier to maintain and extend. The main refactorings are:

  • Proper parsing and validation of configuration
  • Updating typescript code to be warnings free
  • Avoid global state modification in functions and prefer return values
  • Introduce more types
  • Add more documentation
  • Extract code into functions which are documented
  • Extract ghcup process management into dedicated class
  • and even more...

I am still unhappy with the code path for finding HLS binaries using GHCup. This is rather complicated logic, for which I couldn't extract or find a pattern, yet.
Even without it, I think I am overall improving the readability of most of the extension.

fendor added 8 commits May 4, 2025 12:51
Includes the arguments passed to the server, the logging configuration,
working directory, anything that is supposed to stay constant during the
execution of a single HLS instance. Note, it is not promised to stay
constant over restarts.
@fendor fendor force-pushed the enhance/refactor branch from 233e88a to 8d3f45b Compare May 4, 2025 13:05
@fendor
Copy link
Collaborator Author

fendor commented May 4, 2025

I don't know how to review this huge patch, the best way is probably to check it out and trying to understand how the extension is now structured. The commits themselves are somewhat self containing, at least I tried to make sure they are.

Happy for any feedback, otherwise I will just merge it in a couple of weeks and deal with any fallout.

@fendor fendor requested review from hasufell, michaelpj and July541 May 4, 2025 13:19
fendor added 5 commits May 4, 2025 15:36
This 'StatusBarItem' improves the discoverability of the most important
interactions between the user and the extension.

This includes debug information, such as the version of the extension,
showing the output panel to find the logs more easily, but also to
restart all running Haskell Language Server binaries and the extension
itself.
@fendor fendor force-pushed the enhance/refactor branch from 214da85 to fdeff6a Compare May 4, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant