diff --git a/client/README.md b/client/README.md index be4b98c09..d9c6f6bc3 100644 --- a/client/README.md +++ b/client/README.md @@ -73,6 +73,10 @@ user settings. } ``` +Note that the extension deactivates the "files.trimTrailingWhitespace" setting for +Python and Shell script, as it interferes with the functioning of features related +to embedded languages. + ## Features ### Syntax highlighting diff --git a/client/src/extension.ts b/client/src/extension.ts index 29ba6c4ad..3557c4fd9 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -51,6 +51,16 @@ function updatePythonPath (): void { } } +async function disableInteferingSettings (): Promise { + const config = vscode.workspace.getConfiguration() + for (const languageKey of ['[python]', '[shellscript]']) { + const languageConfig = config.get>(languageKey) ?? {} + // 'files.trimTrailingWhitespace' modifies the embedded languages documents and breaks the mapping of the positions + languageConfig['files.trimTrailingWhitespace'] = false + await config.update(languageKey, languageConfig, vscode.ConfigurationTarget.Workspace) + } +} + export async function activate (context: vscode.ExtensionContext): Promise { logger.outputChannel = vscode.window.createOutputChannel('BitBake') @@ -60,6 +70,7 @@ export async function activate (context: vscode.ExtensionContext): Promise bitbakeDriver.loadSettings(vscode.workspace.getConfiguration('bitbake'), vscode.workspace.workspaceFolders?.[0].uri.fsPath) bitBakeProjectScanner.setDriver(bitbakeDriver) updatePythonPath() + await disableInteferingSettings() bitbakeWorkspace.loadBitbakeWorkspace(context.workspaceState) bitbakeTaskProvider = new BitbakeTaskProvider(bitbakeDriver) client = await activateLanguageServer(context)