Skip to content

Commit

Permalink
Fix: Stop saving all open editors when saving a bitbake file
Browse files Browse the repository at this point in the history
The default behavior of vscode is to save all open editors when a task
is run. We currently run the parsing task for any bitbake file save.
This means that if you have multiple bitbake files open, all of them
will be saved when any one of them is saved which is not the desired
behavior.

This patch temporarily disables the saveBeforeRun setting when the
bitbake/parseAllRecipes request is received.
  • Loading branch information
deribaucourt committed Dec 7, 2023
1 parent 7200f02 commit 542b91d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/src/language/languageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ export async function activateLanguageServer (context: ExtensionContext): Promis
})

client.onRequest('bitbake/parseAllRecipes', async () => {
return await commands.executeCommand('bitbake.parse-recipes')
// Temporarily disable task.saveBeforeRun
// This request happens on bitbake document save. We don't want to save all files when any bitbake file is saved.
const saveBeforeRun = await workspace.getConfiguration('task').get('saveBeforeRun')
await workspace.getConfiguration('task').update('saveBeforeRun', 'never', undefined, true)
await commands.executeCommand('bitbake.parse-recipes')
await workspace.getConfiguration('task').update('saveBeforeRun', saveBeforeRun, undefined, true)
})

client.onRequest('bitbake/rescanProject', async () => {
Expand Down

0 comments on commit 542b91d

Please sign in to comment.