mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
current file fix will vs did
This commit is contained in:
parent
f60d5cad2f
commit
da6710a079
2 changed files with 8 additions and 16 deletions
|
|
@ -143,8 +143,8 @@ export class TerminalToolService extends Disposable implements ITerminalToolServ
|
||||||
|
|
||||||
openTerminal: ITerminalToolService['openTerminal'] = async (terminalId) => {
|
openTerminal: ITerminalToolService['openTerminal'] = async (terminalId) => {
|
||||||
if (!terminalId) return
|
if (!terminalId) return
|
||||||
|
|
||||||
const terminal = this.terminalInstanceOfId[terminalId]
|
const terminal = this.terminalInstanceOfId[terminalId]
|
||||||
|
if (!terminal) return // should never happen
|
||||||
this.terminalService.setActiveInstance(terminal)
|
this.terminalService.setActiveInstance(terminal)
|
||||||
await this.terminalService.focusActiveInstance()
|
await this.terminalService.focusActiveInstance()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,12 +103,6 @@ export class VoidCommandBarService extends Disposable implements IVoidCommandBar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const updateActiveURI = () => {
|
|
||||||
const currentUri = this._codeEditorService.getActiveCodeEditor()?.getModel()?.uri ?? null
|
|
||||||
this.activeURI = currentUri
|
|
||||||
if (!currentUri) return;
|
|
||||||
this._onDidChangeActiveURI.fire({ uri: currentUri })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// for every new editor, add the floating widget and update active URI
|
// for every new editor, add the floating widget and update active URI
|
||||||
|
|
@ -120,7 +114,11 @@ export class VoidCommandBarService extends Disposable implements IVoidCommandBar
|
||||||
// mount the command bar
|
// mount the command bar
|
||||||
const d1 = this._instantiationService.createInstance(AcceptRejectAllFloatingWidget, { editor });
|
const d1 = this._instantiationService.createInstance(AcceptRejectAllFloatingWidget, { editor });
|
||||||
disposablesOfEditorId[id].push(d1);
|
disposablesOfEditorId[id].push(d1);
|
||||||
const d2 = editor.onWillChangeModel((e) => { if (e?.newModelUrl?.scheme === 'file') updateActiveURI() })
|
const d2 = editor.onDidChangeModel((e) => {
|
||||||
|
if (e.newModelUrl?.scheme !== 'file') return
|
||||||
|
this.activeURI = e.newModelUrl;
|
||||||
|
this._onDidChangeActiveURI.fire({ uri: e.newModelUrl })
|
||||||
|
})
|
||||||
disposablesOfEditorId[id].push(d2);
|
disposablesOfEditorId[id].push(d2);
|
||||||
}
|
}
|
||||||
const onCodeEditorRemove = (editor: ICodeEditor) => {
|
const onCodeEditorRemove = (editor: ICodeEditor) => {
|
||||||
|
|
@ -410,21 +408,15 @@ class AcceptRejectAllFloatingWidget extends Widget implements IOverlayWidget {
|
||||||
editor.addOverlayWidget(this);
|
editor.addOverlayWidget(this);
|
||||||
|
|
||||||
this.instantiationService.invokeFunction(accessor => {
|
this.instantiationService.invokeFunction(accessor => {
|
||||||
|
|
||||||
const uri = editor.getModel()?.uri || null
|
const uri = editor.getModel()?.uri || null
|
||||||
|
|
||||||
const res = mountVoidCommandBar(root, accessor, { uri, editor } satisfies VoidCommandBarProps)
|
const res = mountVoidCommandBar(root, accessor, { uri, editor } satisfies VoidCommandBarProps)
|
||||||
if (!res) return
|
if (!res) return
|
||||||
|
|
||||||
this._register(toDisposable(() => res.dispose?.()))
|
this._register(toDisposable(() => res.dispose?.()))
|
||||||
|
this._register(editor.onWillChangeModel((model) => {
|
||||||
this._register(editor.onDidChangeModel((model) => {
|
|
||||||
const uri = model.newModelUrl
|
const uri = model.newModelUrl
|
||||||
res.rerender({ uri, editor } satisfies VoidCommandBarProps)
|
res.rerender({ uri, editor } satisfies VoidCommandBarProps)
|
||||||
}))
|
}))
|
||||||
|
})
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue