Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Introduce theStatusBarItem#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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
fendor wants to merge13 commits intohaskell:master
base:master
Choose a base branch
Loading
fromfendor:enhance/refactor

Conversation

fendor
Copy link
Collaborator

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

image

TheStatusBarItem 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 byRestart 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 bered 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
  • Extractghcup 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.

July541 reacted with thumbs up emojiJuly541 and dyniec reacted with heart emojiJuly541 reacted with rocket emoji
@fendor
Copy link
CollaboratorAuthor

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.

@hasufell
Copy link
Member

I just skimmed over it. I have no idea what's going on. What did you do to the code? 😭

Can we at least make a prerelease/alpha for this before hitting users with a brick?

fendor reacted with laugh emoji

@fendor
Copy link
CollaboratorAuthor

What did you do to the code?

It is more or less a rewrite :) It is less a rewrite, as I am not re-implementing new functionality, except for the config parsing, but I am fixing a couple of lints, removing unused functions, introducing some abstractions, more functions and move them to separate files. It is probably impossible to review from the GitHub page, you'd have to check it out, but Ibelieve it is easier to read now.

fendor added13 commitsJune 2, 2025 09:30
Includes the arguments passed to the server, the logging configuration,working directory, anything that is supposed to stay constant during theexecution of a single HLS instance. Note, it is not promised to stayconstant over restarts.
This 'StatusBarItem' improves the discoverability of the most importantinteractions 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 torestart all running Haskell Language Server binaries and the extensionitself.
`---\n\n` +
`[$(terminal) Open Logs](command:${constants.OpenLogsCommandName} "Open the logs of the Server and Extension")\n\n` +
`[$(debug-restart) Restart Server](command:${constants.RestartServerCommandName} "Restart Haskell Language Server")\n\n` +
`[$(refresh) Restart Extension](command:${constants.RestartServerCommandName} "Restart vscode-haskell Extension")\n\n`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
`[$(refresh) Restart Extension](command:${constants.RestartServerCommandName} "Restart vscode-haskell Extension")\n\n`,
`[$(refresh) Restart Extension](command:${constants.RestartExtensionCommandName} "Restart vscode-haskell Extension")\n\n`,

fendor reacted with laugh emoji
logger.error(`${e.stack}`);
}
}
await handleInitializationError(e, logger);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
awaithandleInitializationError(e,logger);
awaithandleInitializationError(e,logger);
clients.delete(clientsKey);

otherwise slot will be forever taken

fendor reacted with thumbs up emoji
resolve: (value: string | PromiseLike<string>) => void,
reject: (reason?: HlsError | Error | string) => void,
) => void;
const haskellConfig = workspace.getConfiguration('haskell');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If it's const, it will stay with initial config value. So if user changes hls path, the change wouldn't take effect

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Exactly, that's essentially the main difference between restarting hls and restarting the extension. One merely restarts the already running binary, while the other performs some work to figure out the correct HLS binary. So far, this has been a feature, since restarting HLS is much faster than restarting the whole extension, as GHCup might perform non-trivial work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, but it currently stay the same even if user restarts extension via status bar. I do have small diffhere that reloads those globals on restartExtension

@@ -15,6 +14,6 @@
"strictNullChecks": true,
"strictBuiltinIteratorReturn": false
},
"include": ["./src/**/*.ts", "./test/**/*.ts"],
"include": ["./src/**/*.ts", "./test/**/*.ts", "eslint.config.mjs"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

is fileeslint.config.mjs needed for build process? To me it looks like linter config

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dyniecdyniecdyniec left review comments

@hasufellhasufellAwaiting requested review from hasufell

@michaelpjmichaelpjAwaiting requested review from michaelpj

@July541July541Awaiting requested review from July541

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@fendor@hasufell@dyniec

[8]ページ先頭

©2009-2025 Movatter.jp