Skip to content
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

Add command to restart language service #1942

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

sheridanchris
Copy link
Contributor

@sheridanchris sheridanchris commented Oct 5, 2023

WHAT

🤖 Generated by Copilot at 8a851bf

This pull request adds a new feature to the extension that allows users to restart the F# language service from the command palette or a keyboard shortcut. It defines a new command fsharp.restartLanguageService and registers it in the release/package.json, src/Core/LanguageService.fs, and src/fsharp.fs files.

🤖 Generated by Copilot at 8a851bf

If your F# extension is slow
And you want to give it a go
Use fsharp.restartLanguageService
With a key or a palette, your choice
And it will reload the language flow

🔄🌐🔧

This will close #1911
image

WHY

Ionide frequently has corner cases and needs refresh, I think it would improve to some extend developer experience just to have a way to completely restart ionide from vscode, when nothing else works, instead of closing and reopening vscode.

#1911

HOW

🤖 Generated by Copilot at 8a851bf

  • Define the command "fsharp.restartLanguageService" in package.json with the title "Restart Language Service" and the category "F#" (link)
  • Assign a keybinding to the command when the editor language is F# in package.json (link)
  • Implement the command logic in LanguageService.fs by defining a "restart" function that stops and starts the language service using a promise (link)
  • Register the "restart" function as a command handler and subscribe it to the extension context's disposable resources in LanguageService.fs (link)
  • Activate the language service feature when the extension is activated by calling "tryActivate" with the feature name "languageservice" and the activation function LanguageService.activate in fsharp.fs (link)

@sheridanchris
Copy link
Contributor Author

sheridanchris commented Oct 5, 2023

This seems to work for a multi-project solution but I'll have to test it more to make sure there aren't any oddities. I could invoke the fsharp.clearCache command but I'm not sure how useful that is, feedback is required.

Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

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

Thanks for this!. Seems to work fine with latest changes.

@TheAngryByrd TheAngryByrd merged commit 94dc2c0 into ionide:main Oct 6, 2023
2 checks passed
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.

Refresh ionide command from >
4 participants