Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions spx-gui/src/components/editor/code-editor/code-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,18 @@ export class CodeEditor extends Disposable {
this.hoverProvider = new HoverProvider(this.lspClient, this.documentBase)
}

async setLocale(locale: string) {
await this.lspClient.initialize(
Comment thread
go-wyvern marked this conversation as resolved.
{ signal: new AbortController().signal },
{
processId: null,
rootUri: null,
Comment thread
go-wyvern marked this conversation as resolved.
capabilities: {},
locale
}
)
}

private registerMCPTools(): void {
// Register tools for code editor
this.registry.registerTools(
Expand Down
4 changes: 4 additions & 0 deletions spx-gui/src/components/editor/code-editor/lsp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ export class SpxLSPClient extends Disposable {
})
}

async initialize(ctx: RequestContext, params: lsp.InitializeParams): Promise<lsp.InitializeResult> {
return this.request<lsp.InitializeResult>(ctx, lsp.InitializeRequest.method, params)
}

async workspaceExecuteCommandSpxGetDefinitions(
ctx: RequestContext,
...params: spxGetDefinitions.Arguments
Expand Down
9 changes: 9 additions & 0 deletions spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,19 @@ watch(
signal.addEventListener('abort', () => {
codeEditorCtx.mustEditor().detachUI(ui)
})

await codeEditorCtx.mustEditor().setLocale(i18n.lang.value)
Comment thread
go-wyvern marked this conversation as resolved.
},
{ immediate: true }
)

watch(
() => i18n.lang.value,
async (newLang) => {
await codeEditorCtx.mustEditor().setLocale(newLang)
Comment thread
go-wyvern marked this conversation as resolved.
}
)

const codeEditorUICtx = computedShallowReactive<CodeEditorUICtx>(() => ({
ui: uiRef.value
}))
Expand Down
Loading