-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: added FileSystemWatcher for pyproject.toml #163
Conversation
src/extension.ts
Outdated
@@ -44,6 +45,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<void> | |||
} | |||
}; | |||
|
|||
const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; |
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.
You will need to do this on each of the workspace folders.
src/extension.ts
Outdated
|
||
if (workspaceFolder) { | ||
const fullPath = `${workspaceFolder.uri.fsPath}/pyproject.toml`; | ||
watcher = vscode.workspace.createFileSystemWatcher(fullPath); |
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 watcher should be added to context.subscriptions
so it can be disposed.
src/extension.ts
Outdated
|
||
watcher.onDidChange((uri) => { | ||
console.log('pyproject.toml changed'); | ||
vscode.commands.executeCommand('mypy-type-checker.restart', uri.fsPath); |
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.
You can directly call the restart method that is available in this context.
vscode.commands.executeCommand('mypy-type-checker.restart', uri.fsPath); | |
await runServer(); |
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.
Thanks for suggestions. please check new commit.
@microsoft-github-policy-service agree |
f1ad910
to
24b2991
Compare
@xytian315 Sorry for the delayed response on this. I have refactored the code to be simpler for our case. |
24b2991
to
c39f0d9
Compare
Closing as stale, we can re-open this, if you want to continue working on this. |
Closes #122