`onDidChangeConfiguration` overwrites all settings instead of just changed settings, breaking Helix support
dansalvato opened this issue · 1 comments
dansalvato commented
m68k-lsp/server/src/providers/ConfigurationProvider.ts
Lines 10 to 15 in ea0a308
According to LSP spec, onDidChangeConfiguration
only provides changed settings, but the above function assumes that all settings are being provided.
This discrepancy causes m68k-lsp-server
to not work properly in the Helix editor, because Helix sends multiple onDidChangeConfiguration
calls which causes the LSP to overwrite the user's initialization options with the defaults.
I confirmed that this workaround successfully fixes Helix support:
async onDidChangeConfiguration() {
const oldConfig = this.ctx.config;
const newConfig = await this.ctx.connection.workspace.getConfiguration(
"m68k"
);
this.ctx.config = {
...oldConfig,
...newConfig,
format: {
...oldConfig.format,
...newConfig?.format,
align: {
...oldConfig.format.align,
...newConfig?.format?.align,
},
},
vasm: {
...oldConfig.vasm,
...newConfig?.vasm,
},
};
}
grahambates commented
Thanks for this. I'll get it fixed.