-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix(vscode): recovers server process if terminated #850
Conversation
"activationEvents": [ | ||
"onStartupFinished" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The activate
method is invoked when the startup is finished.
export async function activate(context: vscode.ExtensionContext) { |
const port = await ports.acquire(); | ||
service = new Service(port); | ||
await service.start(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the activation event, the service is started, which handles starting the server.
export const ping = async (port: number, timeout: number = 30 * 1000): Promise<boolean> => { | ||
try { | ||
await wait({ | ||
resources: [ | ||
`http-get://${HOST}:${port}` | ||
], | ||
timeout: timeout | ||
}); | ||
return true; | ||
} catch (e) { | ||
console.warn("failed waiting for port", e); | ||
return false; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to
publisher/extensions/vscode/src/servers.ts
Lines 55 to 56 in 95a2a9c
private async isRunning(): Promise<boolean> { | |
try { |
extensions/vscode/src/servers.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this implementation is pulled from assistant.ts
, which has been deleted, with a few refactors. Notably, the panel is now managed by services.ts
. servers.ts
and panels.ts
can be thought of as the backend/frontend.
|
||
class StateManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed all of the StateManager code since I now understand how VSCode manages the extension lifecycle. The implementation initially existed as both a safety-check and a state logging facility.
Screen.Recording.2024-01-19.at.2.51.43.PM.mov
Intent
Modifies the extension flow to restart the server if necessary before displaying the UI. This is accomplished by checking if...
Resolves #825
Resolves #846
Type of Change
Approach
Automated Tests
Directions for Reviewers
Checklist