diff --git a/spx-gui/src/components/editor/code-editor/ui/CodeEditorCard.vue b/spx-gui/src/components/editor/code-editor/ui/CodeEditorCard.vue index 03a3acf1f..095ecb4d1 100644 --- a/spx-gui/src/components/editor/code-editor/ui/CodeEditorCard.vue +++ b/spx-gui/src/components/editor/code-editor/ui/CodeEditorCard.vue @@ -1,12 +1,5 @@ - - diff --git a/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue b/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue index ddbe7d29d..f61d8d456 100644 --- a/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue +++ b/spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue @@ -8,12 +8,6 @@ export function useCodeEditorUICtx() { if (ctx == null) throw new Error('useCodeEditorUICtx should be called inside of CodeEditorUI') return ctx } - -export function makeContentWidgetEl() { - const el = document.createElement('div') - el.className = 'code-editor-content-widget' - return el -} diff --git a/spx-gui/src/components/editor/code-editor/ui/completion/index.ts b/spx-gui/src/components/editor/code-editor/ui/completion/index.ts index dfd7b43e6..298435055 100644 --- a/spx-gui/src/components/editor/code-editor/ui/completion/index.ts +++ b/spx-gui/src/components/editor/code-editor/ui/completion/index.ts @@ -10,7 +10,6 @@ import { } from '../../common' import { type monaco } from '../../monaco' import type { CodeEditorUI } from '../code-editor-ui' -import { makeContentWidgetEl } from '../CodeEditorUI.vue' import { fuzzyScoreGracefulAggressive as fuzzyScore, type FuzzyScore } from './fuzzy' export type CompletionContext = BaseContext @@ -53,25 +52,6 @@ export class CompletionController extends Emitter<{ super() } - widgetEl = makeContentWidgetEl() - - private widget = { - getId: () => `completion-for-${this.ui.id}`, - getDomNode: () => this.widgetEl, - getPosition: () => { - if (this.nonEmptyItems == null) return null - const monaco = this.ui.monaco - const cursorPos = this.ui.editor.getPosition() - return { - position: cursorPos, - preference: [ - monaco.editor.ContentWidgetPositionPreference.BELOW, - monaco.editor.ContentWidgetPositionPreference.ABOVE - ] - } - } - } satisfies monaco.editor.IContentWidget - private currentCompletionRef = shallowRef<{ ctrl: AbortController textDocument: ITextDocument @@ -223,15 +203,6 @@ export class CompletionController extends Emitter<{ }) ) - // Manage completion widget (visibility, position, ...) - editor.addContentWidget(this.widget) - this.addDisposer(() => editor.removeContentWidget(this.widget)) - this.addDisposer( - watch( - () => this.nonEmptyItems, - () => editor.layoutContentWidget(this.widget) - ) - ) this.addDisposer( watch( () => [this.ui.activeTextDocument, this.ui.cursorPosition] as const, @@ -242,7 +213,6 @@ export class CompletionController extends Emitter<{ !positionEq(this.currentCompletion.position, position) ) { this.stopCompletion() - editor.layoutContentWidget(this.widget) } } ) diff --git a/spx-gui/src/components/editor/code-editor/ui/context-menu/ContextMenu.vue b/spx-gui/src/components/editor/code-editor/ui/context-menu/ContextMenu.vue index 6db190327..43e3d65cc 100644 --- a/spx-gui/src/components/editor/code-editor/ui/context-menu/ContextMenu.vue +++ b/spx-gui/src/components/editor/code-editor/ui/context-menu/ContextMenu.vue @@ -5,10 +5,11 @@ import type { ContextMenuController, InternalMenuItem, MenuData } from '.' const props = defineProps<{ controller: ContextMenuController - data: MenuData + data: MenuData | null }>() const pos = computed(() => { + if (props.data == null) return { x: 0, y: 0 } return { x: props.data.position.left, y: props.data.position.top @@ -21,9 +22,9 @@ function handleItemClick(item: InternalMenuItem) {